-3

cmd を使用して、easyflow-gui.jar という名前の jar にバンドルされている Java プログラムを実行しようとしています。

java -classpath "." -jar easyflow-gui.jar

作業ディレクトリは、関連するすべてのライブラリを含むディレクトリです。

実行しようとしているjarファイルのマニフェストファイルの内容は次のとおりです。

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
Created-By: 1.6.0_32-b27 (Sun Microsystems Inc.)
Main-Class: easyflow.custom.jgraphx.editor.SchemaEditor

この試行の結果は次のとおりです。

Exception in thread "main" java.lang.NoClassDefFoundError: com/mxgraph/util/mxEventSource$mxIEventListener
Caused by: java.lang.ClassNotFoundException: com.mxgraph.util.mxEventSource$mxIEventListener
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: easyflow.custom.jgraphx.editor.SchemaEditor. Program will exit.

質問: 実際に見つからないクラスはどれですか? mxEventSource$mxIEventListener またはメイン クラス easyflow.custom.jgraphx.editor.SchemaEditor ?

編集 1: フォルダーを確認して jar を抽出したところ、両方のクラスが利用可能であることがわかりました (作業ディレクトリ内のそれぞれの jar にバンドルされています)。

$ls easyflow/custom/jgraphx/editor/SchemaEditor*
easyflow/custom/jgraphx/editor/SchemaEditor$1.class
easyflow/custom/jgraphx/editor/SchemaEditor$2.class
easyflow/custom/jgraphx/editor/SchemaEditor.class
easyflow/custom/jgraphx/editor/SchemaEditor.java
$ls com/mxgraph/util/mxEventSource*
com/mxgraph/util/mxEventSource$mxIEventListener.class
com/mxgraph/util/mxEventSource.class
4

3 に答える 3

0

例外を正しく読むと、エラーの原因が次のように表示されます。

Caused by: java.lang.ClassNotFoundException: com.mxgraph.util.mxEventSource$mxIEventListener

を含む jar ファイルをcom.mxgraph.util.mxEventSource$mxIEventListenerクラスパスに含めませんでした。簡単な Google 検索から、jGraph ライブラリが必要になります。

これが役立つことを願っています。

于 2013-06-29T18:59:40.070 に答える
0

デフォルトのクラスパスは現在の作業ディレクトリです。したがって、現在の作業ディレクトリに既に jar がある場合は、クラスパスを明示的に指定する必要はありません。

次のコマンドが機能するはずです

java -jar easyflow-gui.jar
于 2013-06-29T19:39:10.907 に答える