0

ここに画像の説明を入力

ここに画像の説明を入力

クラスパス

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry exported="true" kind="lib" path="lib/jsoup-1.7.2.jar"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

次のエラーが表示されます。

Exception in thread "main" java.lang.NoClassDefFoundError: gSportsParser (wrong
name: gSportsParser/gSportsParser)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

これは、Java が Jsoup jar を見つけられないことが原因です。私はこの問題を調べ、ビルド パスを編集して、jsoup を .class と同じディレクトリと、クラスのディレクトリ (/lib) のサブディレクトリに配置しようとしましたが、役に立ちませんでした。Javaにjsoupがあることを認識させるにはどうすればよいですか?

4

2 に答える 2

0

In Eclipse (the same as using javac to compile and java or javaw to run), the build classpath is separate from the runtime classpath. Adding JARs to your build classpath does not necessarily add them to the runtime classpath of your program/app.

You didn't mention how you're running your app, but in Eclipse there is the concept of Launch Configurations that are used to configure the runtime for a program. A Launch Configuration is created when you do something like right-click on a project or class and choose Run As... You can also view and edit the launch configurations from the toolbar buttons for Run and Debug. The bottom line is that Launch Configurations have a classpath and it must included all the projects and libraries (JARs) that your code uses.

于 2013-11-14T19:54:56.580 に答える