Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Compile a Java EE source code

 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I can not compile a Java EE source code.

I get the following message:

package javax.Servlet does not exist

First I installed Java SE. After I installed Java EE.

I think, I do not need Java SE anymore? I do not understand how Java SE and Java EE are related. I think, Java EE is includes Java SE.

First I had the following path (Microsoft Windows XP, System):

C:\Programme\Java\jdk1.5.0_06\bin

After I changed to:

C:\Programme\Java\jdk\bin

I think, this should be the compiler for Java EE. How is it?
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Java EE comes with support for EJB's.

To get servlets compiled, you need servlet-api.jar.
If you are using Tomcat, get it from Tomcat's lib folder.
 
Urs Waefler
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Yes, I use Apache Tomcat. I found the jar file servlet-api in the folder bin. How can I compile a servlet now?

I tried like this:

javac myFirstServlet.java

It does not work.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
use classpath attribute to locate servlet-api.jar in order to compile your servlet e.g.

javac -classpath <path to the lib folder of tomcat server>/servlet-api.jar/ yourServlet.java

Vilish
 
Urs Waefler
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
It is like that:

C:\Programme\Apache Software Foundation\Tomcat 6.0\lib\servlet.jar

Then:

javac -classpath C:\Programme\Apache Software Foundation\Tomcat 6.0\lib\servlet.jar myFirstServlet.java

But it does not work till now. What is wrong?
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please read this for more information.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic