OpenWrt Forum Archive

Topic: Run java code on OpenWrt

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

At this moment I'm working with a Bananapi which runs some java code (a jar file) which does some image analyzing (on the input from the webcam). Eventually, the results of the analysis have to be send to a server. Since I want to be able to use the bananapi everywhere, including places without wifi/an ethernet connection, I want to connect a 3/4G dongle to it.

Since I have some experience with OpenWrt in combination with a dongle, I was wondering if there is someone who knows if it would be feasible to run Openwrt (on the bananapi) with java? My other option would be to make the dongle work with the current operating system of the bananapi (lububtu), but I don't have any experience with that.

Cheers!

If the results of analysis are send to a server, run the java code in the server.

Since no one seems to really know, I will allow myself to write what I thinkā€¦

Obviously, most OpenWRT-machines have too little RAM and storage to run a JVM. So, it is not strange at all that there is little experience, and that java is not a standard package. However, with more powerful hardware (like the bananapi), running java on OpenWRT becomes more possible.

I don't see any strong reasons why it would not be possible to download Java source code for Linux, and build it for OpenWRT. However, I can imagine the list of dependencies is long, and contains things not normally included in OpenWRT. That could cause problems both building it at all with the toolchain, and also to actually deploy it. I can imagine cross compiling JRE is not trivial. And I can imagine building a static JRE binary is also not very common, and perhaps quite tricky.

I suppose you don't have the Java source code to your program? In that case it could be possible to build the OpenWRT toolchain with Java support, and compile the Java sources directly to native binaries (gcc has that capability: gcj).

You could TRY to copy the java binary from lubuntu, along with its dependencies (ldd /usr/bin/java), to OpenWRT.
I know little enough about this to think that both failure and success are possible outcomes.

koningh wrote:

At this moment I'm working with a Bananapi which runs some java code (a jar file) which does some image analyzing (on the input from the webcam). Eventually, the results of the analysis have to be send to a server. Since I want to be able to use the bananapi everywhere, including places without wifi/an ethernet connection, I want to connect a 3/4G dongle to it.

Since I have some experience with OpenWrt in combination with a dongle, I was wondering if there is someone who knows if it would be feasible to run Openwrt (on the bananapi) with java? My other option would be to make the dongle work with the current operating system of the bananapi (lububtu), but I don't have any experience with that.

Cheers!

I recently had JamVM 2.0 + Classpath 0.99 pulled into the packages trunk; you will likely want to slim classpath's glibj.zip down to the classes your application uses. At the very least, you'll want to unzip and re-zip glibj.zip with -0 compression - otherwise it gets larger and slower in squashfs.

Cheers -
Dana

The discussion might have continued from here.