Class not found issue
-
I am just started playing with java an I am having this issue. I did the simple hello world app like this: class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } } And when I run it in eclipse the console shows Hello World!, But if I run it in the terminal as "java Hello?WorldApp.class" It will not run it just gives me the error "Class not found". Why is this? Thanks. Running Ubuntu 10.04. Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp/class Caused by: java.lang.ClassNotFoundException: HelloWorldApp.class at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) Could not find the main class: HelloWorldApp.class. Program will exit."
Y*Live Long And Prosper*Y
-
I am just started playing with java an I am having this issue. I did the simple hello world app like this: class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } } And when I run it in eclipse the console shows Hello World!, But if I run it in the terminal as "java Hello?WorldApp.class" It will not run it just gives me the error "Class not found". Why is this? Thanks. Running Ubuntu 10.04. Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp/class Caused by: java.lang.ClassNotFoundException: HelloWorldApp.class at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) Could not find the main class: HelloWorldApp.class. Program will exit."
Y*Live Long And Prosper*Y
Why did you add ".class" after the class name ? You should execute it like this:
java HelloWorldApp
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++ -
Why did you add ".class" after the class name ? You should execute it like this:
java HelloWorldApp
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++Ohhhh... I didn't know that. Thanks!
Y*Live Long And Prosper*Y