Results 1 to 3 of 3
Thread: Very basic question
- 10-30-2007, 06:32 AM #1
Member
- Join Date
- Oct 2007
- Posts
- 6
- Rep Power
- 0
Very basic question
I am sure you must have come across this problem and I did google for the solution but it dint work
I am doing my school assignment and I try to write a very simple program (just a helloworld to start with)
When I compile with javac no issues. but when I try to run the program(Test) java Test
I get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: test
I found that I need to set the classpath variable but I am not sure where or how or what value to set the classpath at.
If any of you gurus can help that would be great . I have a complex xml parsing program in java to write but am stuck at this simple step. I am beginner in java so sorry if this is too simple
Thanks for your time
G
- 10-30-2007, 06:53 AM #2
Member
- Join Date
- Jun 2007
- Location
- Colombo, Sri Lanka
- Posts
- 32
- Rep Power
- 0
I'm fairly new to Java too. In my opinion there is no need to setup class paths to run simple Java programs like 'Hello World' applications. It should work fine. However here are some points you can check.
1. Is the name of your class equal to the name of the file? (your file name should be Test.java only if your class name is Test - I think you got this right since your program gets compiled without errors)
2. Check whether a file called Test.class is generated in the same directory once you compile the program.
3. To run the program issue the command 'java Test' (not 'java Test.class')
4. Have you encapsulated your class in a package? (sometimes this can cause problems when trying to run the application)
If you still want to try setting the class path refer the following article from Sun.
Setting the class path
Hope this helps. All the best.
Regards,
Hiranya
- 10-30-2007, 06:30 PM #3
Member
- Join Date
- Oct 2007
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
Question mark colon operator question
By orchid in forum Advanced JavaReplies: 9Last Post: 12-19-2010, 08:49 AM -
Basic question about EJB
By javaplus in forum Enterprise JavaBeans (EJB)Replies: 2Last Post: 07-15-2008, 05:44 PM -
Basic Applet
By jkswebsite in forum Java AppletsReplies: 4Last Post: 01-13-2008, 09:14 PM -
basic question about files
By oregon in forum New To JavaReplies: 1Last Post: 08-05-2007, 02:34 AM -
help with basic example
By fred in forum New To JavaReplies: 1Last Post: 07-20-2007, 05:45 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks