This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Compiling, but not running !!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compiling, but not running !!!" Watch "Compiling, but not running !!!" New topic
Author

Compiling, but not running !!!

Niyas Ahmed Sheikh
Ranch Hand

Joined: Jun 15, 2005
Posts: 129
Hi,

I am facing problem in runningthe class file. I can able to compile the java files, but while compiling I am getting error.

I had successfully compiled and ran the java programs before I started learning Servlets and JSP. For Servlets and JSP, I included the CLASSPATH.

Now, I can't able to ran the class file and It's compiling. I am getting the following error:

Exception in thread "main" java.lang.NoclassDefFoundError: HelloWorld

In fact I tried ro run the simple program Hello World.

Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
CLASSPATH=??


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Niyas Ahmed Sheikh
Ranch Hand

Joined: Jun 15, 2005
Posts: 129
Here is my autoexec.bat file
----------------------------
SET PATH=C:\JDK1.5\bin;%PATH%
SET JAVA_HOME=C:\JDK1.5;
SET CATALINA_HOME=C:\Tomcat;
SET CLASSPATH = .;C:\Tomcat\common\lib\servlet-api.jar;C:\Tomcat\common\lib\jsp-api.jar%CLASSPATH%
Steve McCann
Ranch Hand

Joined: Oct 20, 2004
Posts: 81
Are you running this from the same folder as the .class file? If not then you will need to specify the path of the file when you use javac.

Steve
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
SET CLASSPATH = .;C:\Tomcat\common\lib\servlet-api.jar;C:\Tomcat\common\lib\jsp-api.jar%CLASSPATH%

Also (maybe a typo), you need a semicolon between "jsp-api.jar" and "%CLASSPATH%"
 
 
subject: Compiling, but not running !!!
 
Similar Threads
protected class-compile error
Question about compiling
can't able to run java program
Error Messages...
javac: no classpath found