抛出print
:
NoClassDefFoundError
Compiler4.java为Disposable类导入正确的包名:
public class Main {
public static void main(String[] args) {
try {
System.out.println("Starting Compiler4..");
Compiler4.main(args);
System.out.println("Compiler4 finished successfuly");
} catch (Throwable ex) {
System.out.println("Compiler4 threw an exception: " + ex);
ex.printStackTrace();
Throwable cause = ex.getCause();
if (cause != null) {
System.out.println("Cause: " + cause);
cause.printStackTrace();
}
System.out.println("End of Compiler4 exception");
}
}
}
类路径:
import com.intellij.openapi.Disposable;
罐子里有一次性用品:
$ echo $CLASSPATH
./tmp/lcc4/util.jar
通过$ jar -tf ./tmp/lcc4/util.jar | grep Disposable.class
Picked up _JAVA_OPTIONS: -Xmx4g
com/intellij/openapi/Disposable.class
命令找到一次性(可以没有java
方法):
main()
有人会认为它应该正确运行,但它不会:
java com/intellij/openapi/Disposable
Picked up _JAVA_OPTIONS: -Xmx4g
Error: Main method not found in class com.intellij.openapi.Disposable, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
我在Mac上。