java -d 多个参数_java的-D参数运行
在windows的F盘根目录下:TestParamter.java文件:publicclassTestParameter{publicstaticvoidmain(String[]args){System.out.println(System.getProperty("log_path"));}}编译:java...
在windows的F盘根目录下:TestParamter.java文件:
public class TestParameter {
public static void main(String[] args) {
System.out.println(System.getProperty("log_path"));
}
}
编译:
javac TestParameter.java没问题
运行:
java -Dlog_path=D:ABC TestParameter
提示:
F:>java -Dlog_path=D:ABC TestParameter
Exception in thread "main" java.lang.NoClassDefFoundError: TestParameter
Caused by: java.lang.ClassNotFoundException: TestParameter
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: TestParameter. Program will exit.
但在unix下编译运行均没问题。请指点!谢谢!
是我贴错了,就是TestParameter.java。
展开
在windows的F盘根目录下:TestParamter.java文件:publicclassTestParameter{publicstaticvoidmain(String[]args){System.out.println(System.getProperty("log_path"));}}编译:java... 在windows的F盘根目录下:TestParamter.java文件: public class TestParameter { public static void main(String[] args) { System.out.println(System.getProperty("log_path")); } } 编译: javac TestParameter.java没问题 运行: java -Dlog_path=D:ABC TestParameter 提示: F:>java -Dlog_path=D:ABC TestParameter Exception in thread "main" java.lang.NoClassDefFoundError: TestParameter Caused by: java.lang.ClassNotFoundException: TestParameter at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: TestParameter. Program will exit. 但在unix下编译运行均没问题。请指点!谢谢! 是我贴错了,就是TestParameter.java。 展开