0

Im doing a small Java project with some school kids to teach them programming and at the end of this project hopefully we will have a small Game. I would like to give these kids some sort of "exe" file(on an USB-Stick) that should run if you double click it. I can produce a .jar file, but that wont execute on double clicking it. The first thing i can think of is a .bat file with java -jar [game.jar] as content but this would require an installed JRE. Is there any better(but not too complex) way to generate a file(or directory with file in it) that could run anywhere(on Windows is enough) like a portable JRE?

The best solution would be a single File like a self-extracting zip.

ahe
  • 128
  • 1
  • 9
  • There is no official portable JVM but you can look into JamVM for an unofficial/third-party solution – Govind Parmar Jun 24 '16 at 15:07
  • You could use a tool such as launch4j http://stackoverflow.com/questions/9330209/whats-the-best-way-to-start-java-applications-on-windows-7 and maybe even include a jre with your bundle: http://stackoverflow.com/questions/7071133/how-to-bundle-a-jre-with-launch4j – zapl Jun 24 '16 at 15:10

3 Answers3

0

You can use Launch4j, it makes an .exe which tries to run the program and if no JRE is found it leads them to the download page of the JRE. I'm just not sure if it can make an .exe with embedded JRE.

Their website: http://launch4j.sourceforge.net/

xcept
  • 43
  • 1
  • 6
0

Because you are using Java, which is dependent on the JRE to run, you are not going to get around not having the JRE installed without significant legwork. Just package instructions with the flash drives you give the kids!

If you're committed though, look into http://www.excelsiorjet.com/ or http://www.duckware.com/jexepack/index.html.

As well as this SO question: How can I convert my Java program to an .exe file?

Community
  • 1
  • 1
0

I can produce a .jar file, but that wont execute on double clicking it.

Why doesn't this work? Is it an issue with having a JRE present, and that these kids might not have it, or might not be able to install it on other's machines?


I suggest you go here if you want go the "exe" route.

http://www.excelsiorjet.com/free

if you click "free licenses" you can get apply for a free license of I believe the "standard edition."

This should be "Good enough" for your intended purposes, and you wont need a JRE present.

It's more work on your end, but it should work nicely for your needs.

XaolingBao
  • 1,034
  • 1
  • 18
  • 34