0

I generated an .exe file from my jar using Launch4j. I was using ZipInputStream to read files inside my .jar before but now it is not working anymore (zip.getNextEntry() returns null).

The only solution I found was to drop the .exe and use a Runnable jar instead. Is it the only solution though ?

3
  • 2
    You should be using Class.getResourceAsStream to load resources. Commented Jan 16, 2017 at 20:28
  • Sorry let me rephrase what I mean: how to browser the file inside the .exe to get their name ? Commented Jan 16, 2017 at 20:31
  • Use a library like Reflections to do the heavy lifting for you. Commented Jan 16, 2017 at 21:31

1 Answer 1

1

Why would you use a .exe? Do you have to? Otherwise just provide a .bat file which executes the java command to start the jar.

Put this into myapp.bat

start javaw -jar myapp.jar

see Run .jar from batch-file

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

3 Comments

Its rather for aestetic purpose: having a custom icon for my application and a custom one in the task bar since my program is for a video game
You can change the icon in the task bar afaik and provide an icon for your .bat file too. See stackoverflow.com/questions/10575541/… and in general you don't want to ship your java app as .exe except you will provide your own jre. Otherwise you still need java installed.
If you are going to do that, I'd look at using Java Web Start rather than a bat file. stackoverflow.com/questions/1453369/…

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.