• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How attach servlet classfiles.zip into java

 
ee bayar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I want to use servlet classes but my servlet classes not available in java. So I have to attach servlet classes into my java and use it, how to ... help me !!

Dear en.bayaraa
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"bayar bayar", please check your private messages for an important administrative matter.
 
Henry Wong
author
Marshal
Pie
Posts: 21420
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ee bayar wrote:Hello I want to use servlet classes but my servlet classes not available in java. So I have to attach servlet classes into my java and use it, how to ... help me !!

Dear en.bayaraa



What do you mean by "servlet classes not available in java"?

Henry
 
Sunil Kumar
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think bayer means the servlets's .class files are available (in jar or opened) and not the .java files.
If thats the case, you can use them as a jar, just like other API's available in jars. Or even the open .class files, you just need to copy them in your application (at correct location).
 
Bert Bates
author
Sheriff
Posts: 8900
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmmm... someplace other than the beginner's forum... maybe servlets?
 
ee bayar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"servlet classes not available in java" this mean in "C:\Program Files\Java\jdk1.6.0_07\src.zip" that in file`s javax folder don`t contain "servlet" folder. When write import javax.servlet.http in my eclipse .... problem !.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java SE doesn't contain the Servlet API.
Java EE does.

So you need Java EE SDK rather than the Java SE JDK.

The Java EE SDK ships with under each Sun Java Application Server (also known as Glassfish) which is a concrete implementation of the Servlet API. The javax.servlet classes are present in its javaee.jar file.

Alternatively (and more recommendable) you can just keep the Java SE and separately download Apache Tomcat which is also a concrete implementation of the Servlet API. The javax.servlet classes are present in its servlet-api.jar file.

Assuming that you're using Eclipse for Java EE (which contains the Web Tools Platform), you can just integrate the application server in it. Go to the servers view, add a new server entry, choose the installed application server (Glassfish or Tomcat or whatever you have installed) and add it. Then you should create a new Dynamic Web Project and associate it with the integrated server. This way Eclipse will take all libraries of the server in the build path (the classpath in Eclipse's terms). Then you should be able to code with the Servlet API!

You can get more information and helpful hints out of this tutorial: http://balusc.blogspot.com/2008/01/jsf-tutorial-with-eclipse-and-tomcat.html You may ignore and skip the JSF part if you aren't going to use it, but you should include the JSTL part as it is extremely useful. With JSTL you can control the flow in JSP pages.
 
ee bayar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot , I try it .
 
stef li
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can add the j2ee library into your project's classpath.
or add servelt-api.jar into your project's classpath.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic