java - ClassNotFoundException thrown when compiling basic Hello World Program -
I'm just trying to compile and run a very simple test program, but it will not work only, And I do not know what the problem is.
I have a Java project that has stacked on me, and I do not know anything about Java. Especially compilation of Windows command line
I have a need to compile a simple "Hello World" program I have two jars with I
Here's my "Buildkbat"
C: \ jdk1.6.0_21 \ bin \ javac -cp "C: \ Users \ FREYERA \ Desktop \ Test"; "C: \ Users \ FREYERA \ Desktop \ Test \ test1.jar", "C: \ Users \ FREYERA \ Desktop \ Test \ test2.jar"; "C: \ Users \ FREYERA \ Desktop \ Test \ sample.java"
Then, I:
C: \ jdk1.6.0_21 \ bin \ Java sample
gives it force back the error:
"main" exception java.lang.NoClassDefFoundError Thread: sample which: java. lang ClassNotFoundException: java.net.URLClassLoader $ 1.run (URLClassLoader.java:202) sample java.security.AccessController.doPrivileged (Native URLClassLoader on java.net.URLClassLoader.findClass method (java.lang.ClassLoader. java: 190 sun.misc.Launcher $ AppClassLoader.loadClass (launcher .loadClass (ClassLoader.java:307). Java: at java.lang.ClassLoader.loadClass (ClassLoader.java # 48)
No matter How do I set up my classpath, I can not get this Hello World program to run for the life of me.
Can anyone help me out? I'm pulling my hair out in.
you can also make specific use of the Classpath for the interpreter to find out your class :
Java-classpath "c: \ user \ friday \ desktop \ test"; "C: \ Users \ Ferrari \ Desktop \ Test Test 1 .jar", "C: \ Users \ FREYERA \ Desktop \ Test \ test2.jar"; Sample
This will run your class from any working directory.
Comments
Post a Comment