在安装JRE时需要帮助吗?

编程入门 行业动态 更新时间:2024-10-26 03:30:54
本文介绍了在安装JRE时需要帮助吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果系统没有JRE,我必须安装JRE可编程性,我是否已在系统中安装了JRE,但是我不知道如何以编程方式安装JRE,有人说您可以使用安装程序,但是我我不知道如何为此目的使用安装程序,我在sun documnet中搜索过,以静态模式安装JRE,我也不知道如何使用该命令iie.fing.edu.uy/ense/asign/...

i have to install JRE Programmability if the System does not have JRE, i had dected JRE is installed in the system or not, but i have no idea how to install JRE programmtically, some people said you can use installer, but i donot know how to use installer for this purpose i searched in sun documnet, installing JRE in slient mode, there's also i donot know how to use that command iie.fing.edu.uy/ense/asign/…

推荐答案

为了运行Java程序,您可以在不安装JRE的情况下执行此操作,即可以在没有JRE的计算机上运行应用程序,每天.

In order to run your Java program, you can do that without installing the JRE, that its, you can run the application in a computer without JRE, we do that every day.

方法是使用嵌入式JRE部署应用程序,并使用脚本(.bar,.sh)使用嵌入式JRE执行应用程序.因此,您的应用程序是独立的,不需要外部JRE.您需要将整个JRE文件夹复制到您的应用程序中,并开始使用测试错误"方法删除未使用的文件.您还可以减小文件大小,以删除不需要的类,例如在rt.jar中(您可以解压缩,删除未使用的类并再次压缩).

The way is to deploy you application with an embedded JRE and use a script (.bar, .sh) to execute you application using the embedded JRE. So your application is self-contained and no requires external JRE. You need to copy the entire JRE folder into your application and start removing unused files using the test-error approach. You can also decrease the file sizes removing not needed classes, like in rt.jar (you can decompress, remove unused classes and zip again).

此方法的问题在于,当您分发文件较少的JRE时,您违反了Oracle/SUN JRE分发策略.如果该应用程序仅供内部使用,我认为还可以,如果您要重新分发该应用程序,则会遇到麻烦.

The problem with this approach is that you are violating the Oracle/SUN JRE distribution policy as you are distributing a JRE with fewer files. If the application is for internal use, I think it's OK, if you want to redistribute the application, you are in trouble.

另一个问题是如何通过代码安装JRE,您可以尝试使用安装程序将JRE随应用程序一起提供,使用安装程序来检测是否已安装JRE并安装其ID.在Java代码中这样做并非易事,您可以使用Runtime执行外部程序...

Another question is how to install the JRE by code, you can try to ship the JRE with your application, using an installer detect if JRE is already installed and install it id needed. Doing that in Java code is not trivial, you can use Runtime to exec external programs...

请不要依赖JAVA_HOME,因为如今没有被积极使用.

Do not rely on JAVA_HOMEas is not actively used nowadays.

示例: 假设您的应用程序名称为"A",则文件夹结构如下所示:

Example: Say you application name is 'A', you folder structure can look like:

A |-> Run.bat |- jre |- bin |- lib |- lib |-> A.jar

您的应用程序主类是软件包a中的Main.java.您的Run.bat看起来像START "" jre\bin\javaw.exe -cp lib\A.jar a.Main

You application main class is Main.java in package a. Your Run.batcan look like START "" jre\bin\javaw.exe -cp lib\A.jar a.Main

通过调用bin\javaw.exe并传递jar和主类,您仅可以调用jre文件夹中的嵌入式jre. jre文件夹可以包含从c:\Program Files (x86)\Java\jre6\(Windows 7)复制的内容和整个JRE.

You only are calling the embedded jre in jre folder, by calling the bin\javaw.exe and passing the jar and main class. The jre folder can content and entire JRE as copied from c:\Program Files (x86)\Java\jre6\ (Windows 7).

更多推荐

在安装JRE时需要帮助吗?

本文发布于:2023-10-26 23:10:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1531622.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时需   JRE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!