File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem getting started

 
J Chandler
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I just wrote my first servlet but the compiler can't find the supporting J2EE 1.4 API....
It doesn't recognize any of the Servlet classes i.e. HttpServletRequest, HttpServletResponse, ServletException....

I have downloaded the J2EE1.4 bundle and set environmental variables, but I'm obviously pointing the vm down the wrong path.
Does anyone know the name of the target folder that contains the additional api code?

I already had J2sdk1.4 - the path to this is assigned to JAVA_HOME

Do I substitute this with the new path?
Can I have both, taking into consideration that the J2EE bundle also contains another copy of jdk?

Do I set the path to go to the bin directory of the server: C:\Sun\AppServer\bin
OR
set the path to the bin directory of the jdk within the J2EE bundle?
C:\Sun\Appserver\jdk\bin

I'm extremely confused

Help!
Regards, J
 
Vijayendra V Rao
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just get the servlet.jar file and add it in your classpath.
 
Ken Robinson
Ranch Hand
Posts: 101
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have the J2EE 1.4 bundle you should have a file called j2ee.jar in your %J2EE_HOME%\lib\ directory. Put j2ee.jar in your classpath when compiling and you'll be fine. You do not need to distribute this in your web app/ejb app when you deploy since the server you will be running on will have it's own implementation of these classes.
 
J Chandler
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ken,

hi, thanks for your comments...

I have located j2ee.jar at: C:\Sun\AppServer\lib\j2ee.jar

Put j2ee.jar in your classpath when compiling and you'll be fine.


Do you mean : cd C:\Sun\AppServer\lib
C:\Sun\AppServer\lib> javac //j2ee.jar somewhere around here?
If so, how will the compiler find my .java file?

Also, I still don't know which path to set for JAVA_HOME - leave it pointing to j2sdk1.4, or redirect?
If it's the latter, should I redirect to j2ee.jar?



J
[ August 04, 2004: Message edited by: J Chandler ]
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
read up on the differences between path and classpath and what the compiler and JVM do with each of them.
Only when you understand that you should even start thinking of doing anything involving J2EE.
 
J Chandler
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good point, well put.

Occasionally, one just needs to be grasped by the shoulders and pointed in the right direction Jeroen...

J
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic