0

I have a Swing desktop application and have created a jar file which depends on library (which is kept in ./lib/) and a .txt file in the same folder. Now to execute the jar I have written a .bat file which checks if Java is installed or not. If installed then I run the jar file with command:

javaw -jar TagEdit.jar

Now there are two problems I am facing with this:

  1. I would rather prefer a single executable, if possible.
  2. As using bat file, the console is visible in back (looks kind of weird). Is it possible to turn it off?
  3. Java is everywhere, and there are lots of applications that are built in Java and packaged in a setup, or given as exe. I Googled a lot but could not find a way to create a setup for the software or an exe. How are those software packaged?

Have tried jlaunch, but could not get that to work correctly.

4
  • For single execution, why not just add the javaw -jar TagEdit.jar to the bottom of your script if it would have returned true? Commented Nov 10, 2011 at 16:18
  • did you try one-jar.sourceforge.net solution. Commented Nov 10, 2011 at 16:19
  • @glowcoder .. yes doing it currently in the bat file Commented Nov 10, 2011 at 16:21
  • "txt file in the same folder" What exactly is the text file for? Is it for read only, or does it need to be written to? Commented Nov 10, 2011 at 16:46

3 Answers 3

1

Himz, Eclipse can automatically build a so-called "fat-jar" for you. It is a jar that contains all the dependencies you need.

If you are a happy Maven user, then you have two brilliant alternatives - the shade plugin, and the assembly plugin. They both can produce a "fat-jar" for you. :)

Sign up to request clarification or add additional context in comments.

Comments

1

There are various answers to this.

  • javaws.exe will execute the jar without the console appearing behind

But I feel this isn't really the best way.

  • I think should investigate using Java Web Start, So you create a JNLP file and have it jar downloaded from the web, I think, you can also have a desktop icon.

If you don't want that

  • I think you can get/buy binary wrappers for the jar.

Comments

0

You could convert it to an executable. Try Googling java to exe.

Once that is done, you could package it up as an installer using NSIS.

1 Comment

Most of the links i am getting are paid ones.The free one i got was jlaunch . But could not get that to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.