• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiling, but not running !!!

 
Niyas Ahmed Sheikh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CLASSPATH=??
 
Niyas Ahmed Sheikh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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%"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic