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

Problems with SDK

jon mantoan
Greenhorn

Joined: Mar 13, 2001
Posts: 9
I can run applets from my SDK but not applications.
I pasted this into a .java file
public class HelloWorld
{
public static void main( String args[] )
{
System.out.println("hello world!");
}
}

and this is the error i get:
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
Any help would greatly be appreciated.
Richard Boren
Ranch Hand

Joined: Mar 01, 2001
Posts: 233
You might have a problem with your CLASSPATH. Make sure you have ;.; in it or it will not find the local directory.
This might help you:
http://www.javaranch.com/ubb/Forum19/HTML/000184.html.
Also it would help if you told everyone the OS you're using.
[This message has been edited by Richard Boren (edited May 23, 2001).]
jon mantoan
Greenhorn

Joined: Mar 13, 2001
Posts: 9
i am using NT. and i am executing the java command from the bin directory. it compiles and allows me to run an applet out of that directory. i don't have privilages to change classpath or path(its a work pc).
any other suggestions?
Richard Boren
Ranch Hand

Joined: Mar 01, 2001
Posts: 233
Is the HelloWorld.class in that directory?
You can use
java -classpath c:\whereYourClassIs HelloWorld
This link has both instructions for setting the environment in NT and an example of a batch file I created to set the path and classpath for a given DOS window on NT 4.0 http://www.javaranch.com/ubb/Forum33/HTML/002245.html. I cannot change the settings at my work either, but the batch file allows me to set the paths for only the current DOS widow with out effecting the NT enviornment. After you exit the DOS window the settings are terminated.
Hope this helps.
[This message has been edited by Richard Boren (edited May 23, 2001).]
jon mantoan
Greenhorn

Joined: Mar 13, 2001
Posts: 9
Cool that works! Thanks alot! any idea why i have to run the whole command of java -classpath PATH CLASS_FILE_NAME?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9052
    
  12
-classpath ... tells the JVM where to find the class you've compiled, sort of a temporary CLASSPATH.

[This message has been edited by Marilyn deQueiroz (edited May 23, 2001).]


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with SDK