• Post Reply 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

making class files together

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have some class files in WEB-INF/classes directory in tomcat. and i am calling all these classes through
http://localhost:8080/servlet/<classname>.
My question is, can we put all class files in one JAR file ? and still is it possible to call by
http://localhost:8080/servlet/<classname>. if so, how to do that ?
 
Ranch Hand
Posts: 37
Oracle Tomcat Server Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the jar command to jar up your class files.

C:\Java> jar -cfv myFile.jar *.class
or
C:\Java> jar -cfv myFile.jar *
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i am calling all these classes through





Danger, warning - this sounds like you are depending on the Invoker servlet rather than mapping URLs to servlet classes. This is a very very very bad idea.

See this ranch FAQ on the pitfalls involved.

Much much better to take the extra effort and use the web.xml deployment descriptor.

Bill
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Jar the files using
jar -cf jar_file_name space_seperated_file_names


2. put the jar file into WEB-INF/lib folder and restart.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Vignesh Babu M.J. " please check your private messages for an important administrative matter. You can check them by clicking the My Private Messages link above.
 
reply
    Bookmark Topic Watch Topic
  • New Topic