Results 1 to 3 of 3

Thread: exception in thread "main" error

  1. #1

    Thread Starter
    Fanatic Member ZeBula8's Avatar
    Join Date
    Oct 2002
    Posts
    548

    Resolved exception in thread "main" error

    i am brand new to java and i get this error at the command line with this code below -

    i compiled into class and then try to run

    ***********************************************
    c:\>javac GetPropertyDemo.java

    c:\>java GetPropertyDemo
    Exception in thread "main" java.lang.NoClassDefFoundError: GetPropertyDemo
    ************************************************

    could someone explain to me why this is?

    Code:
    import java.lang.*;
    
    class GetPropertyDemo {
    	public static void main(String args[]) throws SecurityException {
    		System.out.println ("OS Name: " + System.getProperty("os.name"));
    		System.out.println ("OS Architecture: " + System.getProperty("os.arch"));
    		System.out.println ("OS Version: " + System.getProperty("os.version"));
    		System.out.println ("User: " + System.getProperty("user.name"));
    		System.out.println ("Home Dir: " + System.getProperty("user.home"));
    		System.out.println ("Java Version: " + System.getProperty ("java.version"));
    		System.out.println ("Java Home: " + System.getProperty ("java.home"));
    	}
    
    }
    Last edited by Dilenger4; Oct 7th, 2004 at 05:12 PM.

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Set the classpath in the autoexec.bat file or run with the -classpath switch c:\>java -classpath C:\JavaClassFiles; GetPropertyDemo

  3. #3

    Thread Starter
    Fanatic Member ZeBula8's Avatar
    Join Date
    Oct 2002
    Posts
    548

    thanks -

    works now, Dilenger4 -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width