File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Java App failed to run Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java App failed to run" Watch "Java App failed to run" New topic
Author

Java App failed to run

Timothy Leong
Ranch Hand

Joined: May 25, 2005
Posts: 55
hi guys,

I have the following code



I compile the program and create html coding. however my java app failed to run. It says "Loading java applet failed".

I even ran it as java Tutorial1

This is what I get.....
Exception in thread "main" java.lang.NoClassDefFoundError: Tutorial1

What can I do to make the program going? Thank you
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41601
    
  55
This is not an applet (it doesn't extend JApplet), so a browser wouldn't be able to start it from an HTML page.

On the command line, instead of "java Tutorial1", try to run it wirh "java -classpath . Tutorial1"


Ping & DNS - my free Android networking tools app
Timothy Leong
Ranch Hand

Joined: May 25, 2005
Posts: 55
hi Dittmer, thanks for your reply.

This is my classpath setting in Environment Variables.

C:\Program Files\Java\jdk1.5.0_02\lib\tools.jar

normally how does classpath directory looks like?
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
At this point, you should NOT use the CLASSPATH variable at all. If you remove the CLASSPATH variable, it should fix your problem.

Layne


Java API Documentation
The Java Tutorial
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Moving to Java in General (Beginner).


[Jess in Action][AskingGoodQuestions]
Ken MacClune
Greenhorn

Joined: Jan 14, 2006
Posts: 1
Similar problem here. I compile my FirstApp and get the error (Exception in thread "main" java.lang.NoClassDefFoundError) when attmpting to run in the command window. ? Using or not using -classpath seems not to matter.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Originally posted by Ken MacClune:
Similar problem here. I compile my FirstApp and get the error (Exception in thread "main" java.lang.NoClassDefFoundError) when attmpting to run in the command window. ? Using or not using -classpath seems not to matter.


Ken,

Please start your own thread and include the following details:

  • The full path to the directory where your .java file is saved
  • Which directory your command prompt is at before you try to compile
  • What you type at the command-line to compile your program


  • From there we will be able to help you correct the problems you have encountered.

    Layne
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Java App failed to run