aspose file tools*
The moose likes Cattle Drive and the fly likes running HelloWorld Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "running HelloWorld" Watch "running HelloWorld" New topic
Author

running HelloWorld

David Malott
Greenhorn

Joined: May 27, 2002
Posts: 6
Having trouble running HelloWorld. I have my programs in a folder called "java" off the c: drive. When I type in "java java\HelloWorld" I get the error message "Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld". I was able to complile it.
Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 421
You work as follows:
staying in directory "work" contaning directory java
thus you have: ..\work\java\HelloWorld.java
and HelloWorld.java containing: "package java;"
compile:
javac java\HelloWorld.java
run:
java java.HelloWorld
YOu see the point and not the backslash?
But this should be asked at the beginners thread not here?!
Pauline McNamara
Sheriff

Joined: Jan 19, 2001
Posts: 4012
    
    6
Yup, moving it over there now...
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
Actually, it's in the first lesson of the Cattle Drive. I would have left it open here.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Pauline McNamara
Sheriff

Joined: Jan 19, 2001
Posts: 4012
    
    6
Oops! Opened it up again (no replies in the Java in General forum, where it will be deleted now).
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
David,
I wonder why you are typing "java java\HelloWorld". After you compile HelloWorld.java using javac HelloWorld.java, can you see HelloWorld.class in the C:\java subdirectory? Did you add C:\java to your classpath? If so, you should be able to type "java HelloWorld" and watch the program run.
 
 
subject: running HelloWorld
 
Similar Threads
running HelloWorld
java on command
HelloWorld NoClassDefFoundError
Inherited main method question
Why does my java program only run with -debug in my parameters