OpenWrt/DD-WRT 上的 Java

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2856843/
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-08-13 13:44:16  来源:igfitidea点击:

Java on OpenWrt/DD-WRT

javaopenwrt

提问by Hannes de Jager

I have an existing solution written in Java which I would love to run on OpenWrtrouters. Will OpenWrt even run Java without installing a lot of dependencies? Anyone ever tried this?

我有一个用 Java 编写的现有解决方案,我很想在OpenWrt路由器上运行它。OpenWrt 甚至可以在不安装大量依赖项的情况下运行 Java 吗?有人试过这个吗?

采纳答案by orftz

I've never done it, but it is definitively possible. You won't be able to run the fullJava VM, only specialized versions of it (JamVM, PhoneME, SableVM). Also please be aware that running a Java VM is fairly a lot overhead for this kind of machine.

我从来没有这样做过,但这绝对是可能的。您将无法运行完整的Java VM,只能运行它的专用版本(JamVMPhoneME、 SableVM)。另请注意,对于此类机器,运行 Java VM 的开销相当大。

I won't get much in detail because others have already done it. Check out these links.

我不会详细介绍,因为其他人已经这样做了。查看这些链接。



EDIT: SableVM is unmaintained.

编辑:SableVM 未维护。

EDIT: As Amigable Clark Kantmentioned, you could compile your Java code to nativeby using the GNU Compiler for Java.

编辑:正如Amigable Clark Kant 所提到的,您可以使用GNU Compiler for Java您的 Java 代码编译为本机

回答by Prof. Falken contract breached

Since your goal is to get the existing solution running on the router, and not explicitly get a JVM running on the router, I would suggest going the other way:

由于您的目标是让现有解决方案在路由器上运行,而不是明确地在路由器上运行 JVM,因此我建议采用另一种方式:

compile the Java code to native! This also has the potential to be just as fast a C code.

将Java代码编译为本机!这也有可能与 C 代码一样快。

There is an article in Linux journalabout this.

Linux 杂志上一篇关于此的文章

If not your cup of tea, JAMVMseems a better fit for a small system such as OpenWRT.

如果不是你的一杯茶,JAMVM似乎更适合像 OpenWRT 这样的小型系统。

回答by PeterMmm

I have done this on a Asus WL-HDD some time ago with SableVM. The WL-HDD can run Debianand connect some memory/hdd through USB. But performance was really bad.

前段时间我在 Asus WL-HDD 上使用SableVM完成了此操作。WL-HDD可以运行 Debian并通过 USB 连接一些内存/硬盘。但是性能真的很差。

回答by feder

Use the Embeded JRE these days. http://www.oracle.com/technetwork/java/embedded/overview/index.html

这些天使用嵌入式 JRE。http://www.oracle.com/technetwork/java/embedded/overview/index.html

It also exists for ARM and not only for Intel architecture platforms.

它也适用于 ARM,不仅适用于 Intel 架构平台。