6

I wrote a Java software. Now I want to copy it on a USB key and make it able to run in a stand-alone way on computers that probably don't have JVM. Is this possible?

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239

5 Answers5

4

Sure there is. Don't listen to the spoil sports. launch4j lets you bundle your executable jar, any dependency jars, and even a JRE into an executable file.

There is, unfortunately, no way to make one cross-platform solution, because JRE implementations themselves are not cross-platform.

Chris Bode
  • 1,265
  • 7
  • 16
1

You could try a Java to EXE program, like Exelsior JET.

MrLore
  • 3,759
  • 2
  • 28
  • 36
1

i think best way will be if you will try to fit jvm on that usb stick.

user902383
  • 8,420
  • 8
  • 43
  • 63
0

For each computer/architecture you want to run your java code on you need a JVM.

You could provide several JVM's next to your java code for different architectures.

Or you can create an executable for a specific platform (such as MS Windows) see How do I create an .exe for a Java program?

Community
  • 1
  • 1
michiel
  • 6,036
  • 1
  • 18
  • 13
0

Wikipedia has a collection of Portable Application Creators. If that's an overkill, just use a private JRE.

If you need to save space on your USB key, have a look at this 7-Zip SFX trick (works for both private JRE and Excelsior JET.)

Dmitry Leskov
  • 3,233
  • 1
  • 20
  • 17