Compilation Issues
Hi,
I have the grasp of java basics, but I have just started out in Web Applications using java and am very eager to get up and running.
I have encountered 2 problems:
Im using the first exmple from Struts in action, downloaded a war, decomiled it and placed the files in the correct folders.
1.) When running this app I am unable to get past the login page so I started to tinker with the code. But I have been unable to compile it. I think the classpath is setup correctly as I can execute the javac command anywhere with the directory structure. The errors I get during compilation are as follows:
RegisterAction.java:3: package javax.servlet.http does not exist
import javax.servlet.http.*;
I am also importing the following but no errors are thrown for this
import java.io.*;
2. I also get following error
RegisterAction.java:2: package org.apache.struts.action does not exist
import org.apache.struts.action.*;
I understand that the struts jar file has to be added to the class path - i have tried this but to no avail. It has also been recomended to use Ant, but I am eager just to get this first app working.
Can anyone shed some light on these issuse as I really want to get going with this!
Thanks
My Application is set up as follows
C:\Tomcat 5.5\webapps\register
C:\Tomcat 5.5\webapps\register\WEB-INF\classes\app
Windows XP
C:\Tomcat 5.5
C:\jakarta-struts-1.2.4
C:\Program Files\Java\jdk1.5.0
[1538 byte] By [
deafjam] at [2007-9-30 20:25:30]

Are you compiling a servlet or a JSP?
If you are compiling a JSP, are you doing so within Tomcat, on the command line, or within an IDE?
If you are compiling a servlet, are you doing so on the command line, or within an IDE?
The reason I ask is because the javax.servlet... packages are stored in servlet.jar. You can usually find this in the server/lib, server/endorsed, common/lib, or common/endorsed directories under Tomcat. IDEs like Netbeans automatically mount servlet.jar (as well as xerces.jar, xalan.jar, and some others) in order to compile servlets and such.
If you are compiling on the command-line, it is imperative that you find servlet.jar (and struts.jar for that matter) and add them to the javac classpath. Depending on your IDE, you may need to configure the IDE compiler classpath to include these libraries as well.
If you get these errors while viewing a JSP for the first time in Tomcat, then something is wrong with your Tomcat installation (no servlet.jar or struts.jar). Ensure that servlet.jar is somewhere in your Tomcat heirarchy, and that struts.jar is in WEB-INF/lib in your webapp directory (if you can procure a copy of servlet.jar elsewhere, you should also be able to stick it in WEB-INF/lib as well.
Hope that helps,
- Jesse
Thankd for your contirbutions.
I ahve set my class path to the following: (My Computer > Properties > Enviroment Variables > System variables > Path
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Java\jdk1.5.0\bin;C:\Tomcat 5.5\common\lib\servlet-api.jar;C:\jakarta-struts-1.2.4\lib\struts.jar
Im still getting the same errors (i have also restarted PC)
Any ideas?
Thanks