Talk:Java Tutorial/Hello World!

Latest comment: 14 years ago by Sigma 7 in topic How do you run it?

How do you run it?

edit

I got everything installed, including notepad++ (neato!), saved HelloWorld.java and compiled it and now have a file HelloWorld.class. So how do I run it? I thought it was just: "java HellowWorld.class", but I am getting a traceback of a "class doesn't exist" exception:

Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/class
Caused by: java.lang.ClassNotFoundException: HelloWorld.class
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
 --Softtest123 18:02, 23 March 2008 (UTC)Reply
You need to use class name as the first parameter, not the file name. In your case, you want to type java HelloWorld. --Sigma 7 21:08, 24 November 2009 (UTC)Reply
Return to "Java Tutorial/Hello World!" page.