• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with SDK

 
jon mantoan
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 233
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 233
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-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).]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic