• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to let jar file running on a server  RSS feed

 
cake naiyou
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • 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.
 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • 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).
 
tarun mall
Greenhorn
Posts: 13
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!