我可以随我的应用程序一起分发 JDK 吗?
我正在开发一个名为 Enchanting 的应用程序。该应用程序基于 Scratch,生成 Java 源代码并对其进行编译,以便上传到 LEGO Mindstorms NXT 机器人。
虽然该应用程序还很早期,但用户安装起来却很困难。
现在 Windows 用户必须:
- 下载并安装 Java 开发工具包
- 下载并安装 LeJOS(NXT 的 Java 库)
- 可能调整环境变量
- 然后他们可以下载、安装和运行 Enchanting 本身
如果我可以提供一个安装程序,其中包括JDK和LeJOS,我可以在运行时找出环境变量,过程变成:
- 下载、安装和运行 Enchanting
有没有办法重新分发JDK?
(顺便说一下,Processing(一种简化的基于文本的编程环境)似乎提供了 JDK 附带的版本,所以看起来有一个合法的方法可以做到这一点)。
附录:我希望未安装 java 的 Windows 用户能够运行单个 .exe 文件来安装 JDK、LeJOS 和 Enchanting。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
有关重新分发的信息位于 此处(适用于 Java 10 JDK) 和此处对于 Java 8 JDK。目前,Java 8 比 Java 10 更加详细。
您可以使用 PackJacket 来打包您需要的所有文件并创建安装程序。
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.
假设您满足分发内容所需的所有法律条款,您可以使用 izpack 安装所有先决条件,包括JDK/JVM以及环境变量的配置。
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.
很多基于 IBM Eclipse 的工具都附带有 JDK。
Quite a number of IBM Eclipse based tools have JDKs with them.
或者你可以直接发出字节码。您可以捆绑一个比 JDK 小得多的 JVM 动态语言,然后使用它编译为字节码或使用为此目的而制作的库。
(我从 使用 Kawa 的项目 页面获得以下内容)
App Inventor for Android 使用Kawa 翻译其视觉块语言。
...Nice 编译器 (nicec) 使用 Kawa 的
gnu.expr
和gnu.bytecode
包来生成 Java 字节码。 ...就是这最后一个,就是使用Kawa语言框架生成字节码的。
不要忘记 Groovy、Jython、Clojure 和 Ruby。关于 Groovy 的一个有趣事实是,解释器可以编译 Java 代码,因为 Groovy(或多或少)是 Java 的超集。
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
andgnu.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.