My project is to develop an installer which is an executable for Windows, Mac and Ubuntu. The executables on Windows, Mac and Ubuntu are .exe, .app and .deb respectively. So, I converted my .jar file to a .exe file on Windows using a software called launch4j. And on MAC I used a software called Jar-Bundler to convert my jar in to .app file. I want to know if there is any specific software on Ubuntu to convert my jar file in to a .deb file.

  • Ya .But I want it to be converted to an executable probably .deb file which is my requirement.For example on windows I used launch4j software to convert the .jar file to .exe file and on mac I used Jar-Bundler software to convert .jar to .app file. – user272954 Apr 23 '14 at 11:03
  • 2
    Ok then consider editing your question to clarify what you are asking. On a side note, why do you want to make an installer for a java program ? One of the strong side about this language is that it is cross platform. If you keep your jar file, it could be run on either windows, ubuntu, or OSX, without any modification – Aserre Apr 23 '14 at 11:10
  • 1
    Apparently your are mixing some concept, at least on the Ubuntu side : a .deb find IS NOT an executable, this is a package possibily CONTAINING some files, some of them could be executable files under Ubuntu. The purpose of the .deb file is to allow easy distribution, installation and update of an application. Usually you can execute the code contained into a .jar file by doing java -jar <yourjarfile> [name of the main java class]. – Benoit Jun 6 '14 at 14:02

you can create a DEB from .jar file.

You have to add following code to your pom.xml file

<build>
    <groupId>org.test</groupId>
    <artifactId>some-lib</artifactId>
    <version>1.0</version>
    <plugins>
      ...
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>deb-maven-plugin</artifactId>
        <configuration>
          <description>A test project</description>
              <maintainer>Tim OBrien &lt;tobrien@discursive.com&gt;</maintainer>
              <section>libs</section>
              <priority>optional</priority>     
              <architecture>all</architecture>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>deb</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      ...
    </plugins>
  </build>

and after that running

mvn package

will gives your a .DEB file.

For more information you must read this : http://mojo.codehaus.org/deb-maven-plugin/using-deb.html

  • This link doesn't work for me anymore – wanderer0810 Jan 11 at 20:31

You can use the Jar2exe software to convert .jar file into .exe file. And you can start the application just double clicking on .exe file.

But make sure you can not convert .war file to .exe.

Click here to download the Jar2exe Software.

Just install it and use.

  • 2
    By executable the OP didn't mean a windows executable. – jobin Apr 23 '14 at 11:24

I would say that your question mainly refers to packaging: having a jar file is just an element of the package.

So, consider using "packaging" keyword for looking into this site, for example: What is the simplest Debian Packaging Guide?

A .jar is an archive file that can be made executable with the right configuration.

If you configured the MANIFEST.MF file correctly, you could run your java installer using the following command :

java -jar myfile.jar [args]

Where args are the arguments you might need to run your program (for instance the path where to install the program).

  • Ya .But I want it to be converted to an executable probably .deb file which is my requirement.For example on windows I used launch4j software to convert the .jar file to .exe file and on mac I used Jar-Bundler software to convert .jar to .app file. – user272954 Apr 23 '14 at 11:03

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.