dcsimg
My .java's compiles, but the .class's wont run
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Bjornie_Wikstroem
Posted On:   Sunday, June 2, 2002 03:09 PM

Hi! I'm having trouble with running classes in Linux. I do like this: $ javac Test.java $ java Test I get the errormessage: Exception in thread "main" java.lang.NoClassDefFoundError: Test My Test.java: public class Test {     public static void main ( String[] args ) {         System.out.println ( "Hello World!" );     } } As you can see there's noting special about my class, just a simple test-class. What could be wrong? Best regards, Bjornie    More>>

Hi!

I'm having trouble with running classes in Linux. I do like this:

			
$ javac Test.java
$ java Test


I get the errormessage:

Exception in thread "main" java.lang.NoClassDefFoundError: Test


My Test.java:

			
public class Test {
    public static void main ( String[] args ) {
        System.out.println ( "Hello World!" );
    }
}


As you can see there's noting special about my class, just a simple test-class. What could be wrong?


Best regards,

Bjornie    <<Less

Re: My .java's compiles, but the .class's wont run

Posted By:   michael_dean  
Posted On:   Tuesday, June 4, 2002 01:45 PM

Probably your system has a CLASSPATH environment variable that does not include the current directory defined. To verify, try:




java -classpath . Test


For more information on setting the CLASSPATH environment variable, see After installing a JDK on Linux, how do you set the PATH and CLASSPATH to run Java programs? in the Linux FAQ.

About | Sitemap | Contact