Results 1 to 9 of 9
Thread: can't run the java file
- 01-03-2011, 01:46 PM #1
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
can't run the java file
hi, I was wondering what might be wrong with my java setup on my system
i can compile my java files with no errors and the class files corresponding the java file will appear.
problem comes when I try to do the java command
I am able to compile this with no errors using 'javac H.java' on the command line
but when I do 'java H' on the terminal it gives me this error messageJava Code:public class H { public static void main (String[] args) { System.out.println('fubar"); } }
should I need to declare stuff like system variables or anything that is necessary to setup firstJava Code:Exception in thread "main" java.lang.NoClassDefFoundError: H Caused by: java.lang.ClassNotFoundException: H 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) Could not find the main class: H. Program will exit.
thanks for reading, all suggestions would be appreciated :D
- 01-03-2011, 01:50 PM #2
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
correction
Java Code:System.out.println('fubar");
- 01-03-2011, 01:57 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,399
- Blog Entries
- 7
- Rep Power
- 17
- 01-03-2011, 02:06 PM #4
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
jeez,,
the correction was the same with the wrong code on the first post. Sorry, already fixed that.
- 01-03-2011, 02:08 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,399
- Blog Entries
- 7
- Rep Power
- 17
- 01-03-2011, 02:09 PM #6
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
still got the same problem with the class though, not seeing the compiled class
- 01-03-2011, 02:16 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,399
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 01-03-2011, 02:29 PM #8
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
oh, when I run this using 'javac H.java'
I get no complain, but when I do 'java H', i get thisJava Code://H.java public class H { public static void main (String[] args) { System.out.println("fubar"); //got the quotes right } }
Java Code:Exception in thread "main" java.lang.NoClassDefFoundError: H Caused by: java.lang.ClassNotFoundException: H 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) Could not find the main class: H. Program will exit.
- 01-03-2011, 02:34 PM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,399
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
how to split large xml file into small xml file in java
By enggvijaysingh@gmail.com in forum XMLReplies: 2Last Post: 02-07-2011, 09:34 AM -
To open an image file such as Jpeg file using JAva Program
By itmani2020 in forum Advanced JavaReplies: 10Last Post: 07-11-2008, 09:57 AM -
How to parse the CSV(Comma separation values)file and validate the file using java
By padmajap13 in forum Advanced JavaReplies: 7Last Post: 05-23-2008, 03:46 AM -
How to read a text file from a Java Archive File
By Java Tip in forum Java TipReplies: 0Last Post: 02-08-2008, 09:13 AM -
Converting text file(.txt) to JPG file(.jpg) in java
By javadeveloper in forum Advanced JavaReplies: 0Last Post: 11-09-2007, 04:22 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks