java 是否可以在 android 上运行 JNLP 文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35434016/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 00:08:54  来源:igfitidea点击:

Is it Possible to run JNLP files on android?

javajnlp

提问by henk

I want to know if there is a way to start Java fat-clients via JNLP on my android.

我想知道是否有办法在我的 android 上通过 JNLP 启动 Java 胖客户端。

With an app or a webapplication or maby convert it to an other file format - annything would help me.

使用应用程序或网络应用程序或 ma​​by 将其转换为其他文件格式 - annything 会帮助我。

thank you in advance.

先感谢您。

回答by Edwin Buck

The core virtual machine in Android is not a JVM but a DVM. The Davlik virtual machine is a non-stack based virtual machine (it is register based) that can run Davlik byte code (similar to Java Bytecode, but with register based operations instead of stack based operations).

Android中的核心虚拟机不是JVM而是DVM。Davlik 虚拟机是一个非基于堆栈的虚拟机(它是基于寄存器的),它可以运行 Davlik 字节码(类似于 Java 字节码,但使用基于寄存器的操作而不是基于堆栈的操作)。

So, in general, JNLP would not be expected to work without some extra effort, as the binaries transmitted in an JNLP launch would contain Java bytecode and not Davlik instructions.

因此,一般而言,如果不做一些额外的努力,JNLP 就不会工作,因为在 JNLP 启动中传输的二进制文件将包含 Java 字节码而不是 Davlik 指令。

If you want this functionality to work, you would need to either intercept the JVM bytecode and cross compile it to Davlik bytecode (not sure if this has been done before, but google may be your friend). Or, you would have to install a true JVM on the android platform (again not sure about this approach, but it gives you a starting point).

如果您希望此功能起作用,则需要拦截 JVM 字节码并将其交叉编译为 Davlik 字节码(不确定以前是否已完成此操作,但 google 可能是您的朋友)。或者,您必须在 android 平台上安装真正的 JVM(同样不确定这种方法,但它为您提供了一个起点)。

The confusion between both of these platforms come from that fact that the source code (the text you would write) is Java source code; however, the compilation process for both environments does not result in JVM bytecode, which is required for running on a Java platform. This is one of the primary reasons that it's called a Davlik virtual machine, and not a Java one.

这两个平台之间的混淆来自于源代码(您将编写的文本)是 Java 源代码这一事实;但是,这两种环境的编译过程都不会产生 JVM 字节码,这是在 Java 平台上运行所必需的。这是它被称为 Davlik 虚拟机而不是 Java 虚拟机的主要原因之一。