Talk:Java Tutorial/Hello World!

From Wikiversity
Jump to navigation Jump to search

How do you run it?[edit source]

I got everything installed, including notepad++ (neato!), saved 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$ Source)
        at Method)
        at 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[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[reply]