aspose file tools*
The moose likes Beginning Java and the fly likes Weird message when running class file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Weird message when running class file" Watch "Weird message when running class file" New topic
Author

Weird message when running class file

Logan Knecht
Greenhorn

Joined: Jun 05, 2008
Posts: 16
I just installed the SDK and was trying to run a hellworld.class file that was compiled by javac, but when I do java helloworld.class in the correct directory it gives me this.

C:\Documents and Settings\Work\Desktop>java helloworld.class
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)

Does anyone know what the problem is or how to fix it?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31062
    
232

Logan,
Welcome to JavaRanch!

The correct command is "java helloworld". The .class is not part of the command.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Logan Knecht
Greenhorn

Joined: Jun 05, 2008
Posts: 16
Haha oops, thank you very much.
 
 
subject: Weird message when running class file