Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar all the servlets?

 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I heard that it is better to jar your servlets rather than keep your classes

in web-inf/classes in a web application....Is it so?

If so whats is the reason...?


Thanks in advance..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Portability, if that's important to you.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't see any
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will jar up tag libraries into a nice and tidy package. And any classes or servlets that are part of "frameworks" or other systems meant to be shared across multiple web apps. But for servlets that are speicfic to a particular web app, I just put those under WEB-INF/classes.
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you....

but i dont think that there are no security issues involved if we

dont keep the classes as a jar....Isnt it so?

Regards
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is as secure to put them under the classes directory as it is to put them in a jar under the lib directory.
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you...Satou
 
dema rogatkin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found classes more convenient for development for some servlet containers, you can replace just a single .class or .properties without jarring. From other side I use signed jar which includes a servlet, a web started app and applet, so see one jar for everything!
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

______________________________________________________________________

From other side I use signed jar which includes a servlet, a web started app and applet, so see one jar for everything



______________________________________________________________________


Sorry i didnt get this..
 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
compiler will give preference to load .class files present in classes folder and then it loads .class files present in jar. and there is no difference. but when u deploy u r applicaion from one server to another it will be easy to deploy if ur application is in the form of jar.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sai prasanna, JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

Please read this for more information.

thanks,
bear
Forum Bartender
 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
classloader will give preference to load .class files present in WEB-INF/classes and then it loads .class files present in jar. If same name is present in both precedence is given to WEB-INF/classes.

clients cannot access files under WEB-INF directory as it is private to web container. only container can access files under WEB-INF(so security issues doesn't come here)

jar files are easy to distribute
 
dema rogatkin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which class loader? Why? Easy to distribute in jars? Have you heard about war or ear? All classes you developed have to be stored under classes. All classes you got as is should be stored under lib.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by dema rogatkin:
All classes you developed have to be stored under classes. All classes you got as is should be stored under lib.


Completely false. You can jar up your own classes if you like and put them in the lib folder.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:


Completely false. You can jar up your own classes if you like and put them in the lib folder.


You could also unpack a third party jar file and put the class files under the classes directory. There is usually no reason to do so, but you could.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic