简体   繁体   中英

Easy way to make a runnable program out of a java project

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.

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/

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM