Can I distribute a JDK with my application?
Asked Answered
P

4

6

I am working on an application called Enchanting. The application, based on Scratch, emits Java source code and compiles it for uploading onto LEGO Mindstorms NXT Robots.

While the application is very early, users have a hard time installing it.

Right now Windows users have to:

  • download and install a Java Developer Kit
  • download and install LeJOS (a java library for the NXT)
  • possibly tweak environment variables
  • then they can download, install, and run Enchanting itself

If I could provide an installer that would include the JDK, and LeJOS, I could figure out the environment variables at run time, and the process becomes:

  • Download, install, and run Enchanting

Is there a way to redistribute a JDK?

(Incidentally, Processing (a simplified text-based programming environment) seems to offer a version that comes with the JDK, so it appears that there is a legitimate way to do so).

Addendum: I would like a Windows user who does not have java installed to be able to run a single .exe file to install the JDK, LeJOS, and Enchanting.

Patentor answered 9/11, 2010 at 0:19 Comment(1)
Yes, the JDK is freely redistributable. How you'd do that depends on your environment and implementationKukri
S
4

The information regarding redistribution is here for Java 10 JDK and here for Java 8 JDK. Currently Java 8's is substantially more detailed than Java 10's.

and you can use PackJacket, to package all the files you need and create an installer.

Shih answered 9/11, 2010 at 1:4 Comment(1)
I finally tried it out -- although I said a JDK is required, and it gives me an .exe, as soon as it runs, it asks for a JRE so it can run the installer. That's somewhat frustrating -- what is the point of creating an .exe for an installer if it is going to ask for Java to run it? (I had thought that it would unpack a JDK, run Java, install my software, and leave the JDK with it.)Patentor
S
0

Assuming you satisfy all the legal terms required to distribute stuff, you can use izpack to install all the prerequisites, including a JDK/JVM and configuration of environment variables.

Statement answered 9/11, 2010 at 0:30 Comment(0)
D
0

Quite a number of IBM Eclipse based tools have JDKs with them.

Doehne answered 9/11, 2010 at 0:33 Comment(0)
T
0

Or you could just emit bytecode directly. You could bundle a much smaller (than the JDK) JVM dynamic language then use it to compile to bytecode or use libraries made for that purpose.

(I got the following from the Projects using Kawa page)

App Inventor for Android uses Kawa to translate its visual blocks language.

...The Nice compiler (nicec) uses Kawa's gnu.expr and gnu.bytecode packages to generate Java bytecode. ...

It's this last one is the one that uses the Kawa language framework to generate bytecode.

Don't forget about Groovy, Jython, Clojure, and Ruby. Interesting fact about Groovy, the interpreter can compile Java code since Groovy is (more or less) a superset of Java.

Torero answered 9/11, 2010 at 1:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.