• 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

How to let jar file running on a server

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After downloading some open-source software in a jar file, i.e., test.jar we can run it using command line like



At present, I want to learn how to integrate this jar file into a web-based applications. In other words, I want this jar file to keep running on a server. After user submitting the request through the webpage, this request can be transferred to the waiting jar file, and get the result thereafter.

How to fulfill this kind of task in Java framework? Thanks.
 
Ranch Hand
Posts: 344
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your server java code just needs to call the main() method in the class that is defined in the "Main-Class" attribute in the jar's manifest file (unzip jar file to find and open its manifest file).
 
Greenhorn
Posts: 13
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to my understanding, providing jar to server and accessing jar from some code running on server are two different things.
If your server is trying to connect some other sever or DB and it requires the jar then you have to provide the jar to server in some lib folder inside server, depends on what server you are using.
If you are trying to access some jar from some code that is deployed on server than all you need to do is keep the jar in classpath and start the code, the code will look into it. One more thing, I dont think any code EVER look for jars, jars are considered just as collection of java code/classes. So it doesn't matter if you put jar in same format or extract it and then put.
reply
    Bookmark Topic Watch Topic
  • New Topic