convert war file to exe file

12,418

Solution 1

First of all why you need to do such thing?

As stated on wiki :

A war file is a JAR file used to distribute a collection of JavaServer Pages, servlets, Java classes, XML files, tag libraries and static Web pages (HTML and related files) that together constitute a Web application.

A war file is you application which is ready to run on server. As you said you are using tomcat you just need to put the war file in webapps folder of tomcat. And start the tomcat server. Its done. Your project will successfully run. No need to build exe [of war] for this.

If you wanna give client a setup that will look like set up and setups all things to run your app then you can use a exe maker software (like installJammer)and make your exe such that it includes tomcat with your war in webapps. Make shortcut to startup file of tomcat. So now when user clicks on shortcut tomcat will start and with it your application will also start and user can access it on browser.

Solution 2

Both war and jar are ZIPs. Thus, they can be easily converted.

However, wars usually store webs, while jars contain desktop programs.
So, converting a war to a jar would not be useful because, as the war contained a web, the converted jar will also contain a web, so trying to run it (as a program) will cause an error.

If you're looking to convert a web (the war) into a desktop app, this is not the way.
Please, take a look at Prism.

Solution 3

.war files are intended to be run inside a web container. So what you might want to do it to put the .war file in one, and run the web container from the task scheduler. I've done something like this before (although not with a task scheduler) using Jetty. Jetty itself is a java program, so you just start it by running java.exe -jar start.jar in the Jetty directory.

Share:
12,418
syafikah
Author by

syafikah

Updated on June 04, 2022

Comments

  • syafikah
    syafikah almost 2 years

    I have a file in .war format.
    Is it possible to convert it to an .exe or .jar file?

  • syafikah
    syafikah about 13 years
    Thank you for your answer. What i'm trying to do is register .war program to task scheduler so that it can run automatically based on my expectation. As I know, that program should be in .exe to run in task scheduler. That's why im trying to convert that .war to .exe.
  • Alba Mendez
    Alba Mendez about 13 years
    Thanks for the details. When you say "run the .war program", what do you exactly mean? Consult a page or a Servlet on the .war, maybe?