简体   繁体   English

可以在不包含JVM的机器上运行桌面应用程序

[英]Possibility to run desktop application in a machine that doesn't contain a JVM

I am going to create a Desktop application in Java. 我将用Java创建一个桌面应用程序。 I don't know whether user having JAVA VIRTUAL MACHINE or not. 我不知道用户是否具有JAVA VIRTUAL MACHINE。

My questions are: 我的问题是:

  1. I want to know whether its possible to run Java application in a machine that doesn't contains JVM. 我想知道是否有可能在不包含JVM的计算机上运行Java应用程序。

  2. If its possible, I want to know whether this case is possible, I will created a application say MyApps, I will to convert this as .exe file and if user clicks MyApps.exe it should run my Java application and install JVM and run in that machine. 如果可能,我想知道是否可能发生这种情况,我将创建一个名为MyApps的应用程序,将其转换为.exe文件,如果用户单击MyApps.exe,它将运行我的Java应用程序并安装JVM并在其中运行那台机器。

Use webstart, and to install java automatically, see the great comment of Andrew Thompson. 使用webstart并自动安装Java,请参阅Andrew Thompson的精彩评论。

  • Then the user is free to use Solaris, Mac or Linux if he likes. 然后,用户可以随意使用Solaris,Mac或Linux。
  • and updates for the JVM will be shipped to him. JVM的更新将交付给他。 You don't need to rollout a new update for every bugfix in the JVM or Java-libs. 您无需针对JVM或Java库中的每个错误修正推出新的更新。
  1. You can run a Java application on a machine which does not have a JVM, provided you install the version of Java you need first. 如果先安装需要的Java版本,则可以在没有JVM的机器上运行Java应用程序。
  2. You can create an application which will install java as required and then run your application. 您可以创建一个应用程序,该应用程序将根据需要安装Java,然后运行您的应用程序。 However you cannot write this in Java (unless you have a JVM installed already) 但是,您不能用Java编写此代码(除非已经安装了JVM)

This is not completely pointless as many system have some version of Java but may not have the version you need. 这并不是完全没有意义的,因为许多系统都有Java的某些版本,但可能没有您需要的版本。

Nope, you need a JVM to run the Java bytecode. 不,您需要一个JVM来运行Java字节码。 The only solution would be to transform the bytecode into a different executable format. 唯一的解决方案是将字节码转换为其他可执行格式。

Finally I got the solution for running my Java application without Java Virtual Machine, by bundling JRE in the exe file. 最终,我通过将exe文件绑定到JRE,获得了无需Java虚拟机即可运行Java应用程序的解决方案。 I did this by using the following link. 我通过使用以下链接来做到这一点。

It's really working awesome. 真的很棒。

JAVA without JVM using Launch4J 使用Launch4J的没有JVM的JAVA

If we maintain the Directory Path as given we can get .exe with JRE bundled that will run without JVM. 如果我们按照给定的方式维护目录路径,则可以获取捆绑有JRE的.exe,而无需使用JVM就可以运行它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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