我正在尝试在 64 位 Fedora 上运行 .jar,它可以在 Windows 上完美运行。
起初我尝试:
java -version
java version "1.6.0_17"
java -jar myprog_TABS_Dec30.jar
我得到了:
Exception in thread "main" java.lang.ClassCastException: javax.swing.tree.DefaultMutableTreeNode cannot be cast to myprog.view.tree.DataObject_Node
然后我检查了:
file Analyseries2011_TABS.class
Analyseries2011_TABS.class: compiled Java class data, version 49.0 (Java 1.5)
所以我安装了:jdk-1_5_0_22-linux-amd64-rpm.bin:
/usr/java/jdk1.5.0_22/bin/java -jar myprog_TABS_Dec30.jar
结果 :
Exception in thread "main" java.lang.NoClassDefFoundError: javax/swing/filechooser/FileNameExtensionFilter
最后,我在 META-INF 目录中查看了 MANIFEST.MF:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.7.0_01-b08 (Oracle Corporation)
Class-Path:
X-COMMENT: Main-Class will be added automatically by build
Main-Class: myprog.core.main.myprog_TABS
好的,让我们试试:
/usr/java/jre1.7.0_01/bin/java -jar myprog_TABS_Dec30.jar
你猜怎么着...
Exception in thread "main" java.lang.ClassCastException: javax.swing.tree.DefaultMutableTreeNode cannot be cast to myprog.view.tree.DataObject_Node
我的想法不多了。