Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need of copying jars from Tomcat to JDK

 
Faraz Ka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Experts,

I am new to Tomcat and in this regard wants to know why there is a need to copy the following jars from Tomcat lib directory to JDK lib directory.
1. servlet-api.jar
2. jsp-api.jar
3. el-api.jar
4. tomcat-dbcp.jar

Thanks,
Faraz
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no need to do so. Why do you think there is?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact, not only is there no need to do so, you should never do so.
 
Faraz Ka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. Actually I am following a book where its written copy the jars, so I asked the question as I did not have any clue why? But when I read further the book says if you have included the Tomcat lib directory to the classpath then its not needed.
Can you direct me to the topic or link that talks in detail as how classes are loaded and the role of JVM?

Thanks,
Faraz
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so there are two different objectives here.

Firstly, Tomcat needs all its libraries so that it can function properly. For that, don't move around anything.

Secondly, there's your need to have some of those same libraries in your classpath during development. I advise against copying any of those libraries into the JDK directories. Rather, include them in your "-cp" option if you compile from the command line, or add them to your project if you're using Ant or an IDE. But you shouldn't alter the behavior of the core JRE by adding libraries to it.
 
Faraz Ka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf!
 
Faraz Ka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf/Bear,

I am somewhat confused here. Whats the difference between web application and JSP/Servets?
Will it be correct to say that JSPs and Servlets together constitute a web application?

Thanks,
FKA
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Faraz Ka wrote:Hi Ulf/Bear,

I am somewhat confused here. Whats the difference between web application and JSP/Servets?
Will it be correct to say that JSPs and Servlets together constitute a web application?

Thanks,
FKA


It would be more correct to say that a WAR or EAR constitutes a (j2EE) web application.

The sum total of a J2EE/JEE web application is the collection of executable objects (JSPs and servlets), resources (CSS, JavaScript, images and so forth) and deployment description information (WEB-INF/web.xml) gathered together in a specific relationship and in its strictly standards-compliant form, bundled up in a ZIP file. Although many webapp servers allow using the unzipped form of all of that directly.

That, of course is what in traditional systems would be considered the "application program". Then, when you deploy the webapp to the server, you get an "application instance". Or, in some cases, multiple instances.
 
Faraz Ka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is awesome Tim!
Your explanation really helped!

What do think which book should be the best for the first timers on JSP/Servlets?

Thanks,
Faraz
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic