我写了一个简单的java程序
package abc.def.ghi
public class Foobar{
public String printS(String s){
System.Out.println(s);
public static void main(String [] args){
String s = args[0];
Foobar foobar = new Foobar();
foobar.printS(s);
}
现在我做了 javac Foobar.java
它创建了一个类文件
然后我做了
java Foobar
没用
java Foobar hi //args
没用
爪哇-cp。abc.def.ghi.Main
没有工作。
我得到的错误是:
Exception in thread "main" java.lang.NoClassDefFoundError: abc/def/ghi/Main
Caused by: java.lang.ClassNotFoundException: com.intel.hadoop.graphbuilder.conf.Main
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: com.intel.hadoop.graphbuilder.conf.Main. Program will exit.