is it possible to run Java/Swing applications on Java Embedded environment? - java

we need to run windows based Swing applications on an embedded ARM9/11 device; since the whole Java 7 SDK is too heavy for these kind of devices we thought to install Java Embedded that should be design for these use cases. Regretefully, we are not able to find out any reference about Java/Swing on Java Embedded environment in java documentation, neither on NetBeans ones. Does anybody know something on this topic?

The Caciocavallo project does this.
Unfortunately the Caciocavallo direct framebuffer code is not ready for end use applications.
They would like help with it.
http://openjdk.java.net/projects/caciocavallo/

I have successfully run Java SE 6 Embedded (headful) on an N900 smartphone, including Swing apps such as JEdit.
It doesn't run particularly fast (startup time obviously much longer than a modern desktop) but it does work.

While I don't think that ARM9/11 devices would be strong enough to run even the Embedded Java SE 6/7/8, newer ARM SOCs like the Cortex-A9 and COrtex-A15 are.
I have been able to run several non-trivial Java Swing applications on my Samsung Series 3 ARM Chromebook and they seem to be performing well (this is a dual-Cortex A15 machine (Exynos 5250) with 2GB of RAM).
Squirrel SQL and the Swing app of my company run well on JDK8 ARM Linux hardfloat which has just been released as early access in Aug 2013.

Related

Running a Java Program from a Browser without Plugins

Some weeks ago I wrote a little Java program showing a real time plot chart (i.e. records with tracking of current time), with a modest 25 kbps streaming rate, 20fps framing rate, and no relevant user interaction. Thinking on its eventual deployment as a Mobile App, a Web Server chart or simply as a PC as a program, being Java a perfect selection for me.
Before starting now the Web version of this program, i started to investigate and according the 2016 Oracle White Paper Migrating from Java Applets to Plugin Free Java Technologies:
The deprecated plugin technology will be completely removed from the
Oracle Java Development Kit (JDK) and Java Runtime Environment (JRE) in a
future Java release (TBD). Java Web Start applications do not rely on a
browser plugin and will not be affected by these changes.
And according 2019 OpenWebStart:
Java Web Start (JWS) was deprecated in Java 9, and starting with Java
11, Oracle removed JWS from their JDK distributions
And then I get lost.
Hence, which is the way to go with a Java program like this? Which is the proper sustainable Java way to do this (and not subject to something like what happened to Java Web Start)?.
Or should I simply move to another way to do it, now that the program is in its infancy, considering I am not precisely a fan of Phyton, considering PHP is not precisely the way for programming these kind of numerical things, and considering I am not so willing to give Microsoft technologies a chance?
It is not a problem for me to adapt and rewrite my current code if necessary, but possibly not doing this every 5 years.
Which article would you recommend me to get back to the proper path?
Thanks in advance.
The easiest and highest-performance option is TeaVM, a transpiler that converts Java classes into JavaScript. Your code then runs in the browser natively without any plugin.
Read an introductory article here: https://blogs.oracle.com/javamagazine/java-in-the-browser-with-teavm
TeaVM's main site is here: http://teavm.org/
Thinking on its eventual deployment as a Mobile App, a Web Server
chart or simply as a PC as a program, being Java a perfect selection
for me.
(..)
Hence, which is the way to go with a Java program like this? Which is
the proper sustainable Java way to do this (and not subject to
something like what happened to Java Web Start)?
Two lines of Java
What happened is that our old friend, the Java Standard Edition, split into two lines:
Oracle Java SE ("commercial Java"): needs paid license for commercial use for releases since April 16th, 2019
OpenJDK ("open source Java"): open source (GPLv2 with linking exception), does not contain Oracle's Java Web Start implementation
The Oracle Java SE version keeps Java Web Start and Java FX available and supported only for Java SE 8. Newer Java versions, esp. Java SE 11 do not carry these anymore.
It is not a complete client / desktop technology removal, because Oracle, according to the Java Client Roadmap Update 2018, continues to support AWT and Swing for at least 5 more years on both Java SE 8 and Java SE 11.
You can continue deployment via Java Web Start
Open source Java got a decent implementation of Java Web Start, which is free and available for Java SE 8 and newer Java versions like Java SE 11.
This is Karakun's OpenWebStart based on Red Hat's IcedTea-Web, now beyond version 1.0, which you already found.
Continued support is not guaranteed but seems likely. So you might continue on this track.
Or you might deploy via an app store
Oracle's explanation for dropping Java Web Start was, that they want to change the deployment model to applications with bundled runtime:
As client application development continues to shift from the old
“plugin” world to modern deployment, the need for a standalone Java
Runtime Environment (JRE) that is installed centrally, separately from
Java applications has diminished. Using the ‘jlink’ tool introduced
with JDK 9 will make it even easier for application developers to
package and deploy dedicated runtimes rather than relying on a
pre-installed system JRE.
(Source: Faster and Easier Use and Redistribution of Java SE)
Deployment, according to Oracle, would occur via some app store like the iTunes Store:
No doubt this was true, but the OSes have shifted hard and fast away
from this model. The "app store" model is now it. macOS has been
ratcheting this down hard for several years now. MSFT -- even in the
enterprise market -- has signaled this direction as well. For sure we
need to find options to support the legacy, but the future here is limited.
(Source: OpenJDK discussion mailing list)
Note that Java Start Web Start handled the updating of available new versions of applications on the client machines, and so do typical app stores.
Of course you can serve a version of your app with bundled runtime on your web site, but then you usually have to implement some mechanism to handle updates of your application on the machines of your users yourself.
What to choose?
It is true that the separate JRE installation has disadvantages, e.g. I changed my JRE recently and suddenly the IDE for Java did not work anymore. :-)
Moving deployment from a web site you control to an app store controled by the OS vendor or mighty players like Valve, has its own challenges. E.g. access restrictions, fees, release delays because of the review process, or they might not like your app for some reason and will not publish it.
Then adoption: Personally I have seen private use of app stores mostly on mobile devices and macs, but no use in companies yet. This might be a factor in your decision which road to pursue.
I've missed the Java on browser too. Because of curiosity I just developed an "JVM-Server", which precompiles the Java-Classes to native JavaScript and serves them to a WebBrowser.
Look here is a Hello World example application which is running on Browser:
https://github.com/neo-expert/jsjvm_helloworld
There is also a Library which implements WebGL bindings. In the above Example is a WebGL demo included, where a 3D cube will be rendered. The code is written in pure Java.
Is it a swing app? Will have to map that to a web (html) app to make it work on a browser nowadays.
You cannot run any of those programs from a browser directly.
Java used to java applets and java web start - where the browser helped you install a java app on local system but user had to seperately have installed JRE (Java run time) to run it locally.
Now all we have are web apps. basically apps that might have a a session, login, authenticaiton and authorition but in the end the app outputs HTML, Javascript, images and text data (JSON. XML etc) that is rendered on the web page.
Look at J2EE. I'm a java fan. but it takes longer to develop, but i think it runs better. Especially with a good framework like Spring Boot (it includes MVC see https://dzone.com/articles/7-best-java-frameworks-for-2016)
But learning curve is there. Buy a book or do a course online like udemy or similar.youtube has free videos. but not sure of the order/ quality.
If you choose php - many free and cheap servers like x10hosting to start with and learning curve is less too. Good framework - packages like drupal and wordpress.
On the browser HTML, Javacript run. There are frameworks for this too. Like gogole's angular https://angular.io/ this too needs a book/seperate study. Old days we used to use simple Javascript ...
For mobiles - sometimes can get away with using a URL OR there are frameworks that wrap a web page in an 'app' for android, iphone etc OR make a native app - but then will have different code bases.
I know someone who used a game engine to make a mostly single code base (some classes are specific to each platform like android, iphone) but used to render business graphs and a few interaction use cases (about 40). He used https://libgdx.badlogicgames.com/
As your research already revealed, Java is not a relevant web frontend technology anymore. Prefer Javascript and CSS for browser frontends, instead. Feed the frontend code with data served by Java backend services. The Java Servlet Specification is still the base for server-side Java. Many frameworks (like Spring or Jersey, to name a few) are build on top of it. Either chose one of these frameworks, or - for really simple use-cases - build an application only with plain servlets. Any servlet needs to be deployed in a servlet container (e.g. Apache Tomcat).
Your Java code needs probably some refactoring in order to provide an API for the web. As you are asking for near-realtime communication, you should have a look at the WebSockets standard which is designed for bidirectional and fast client-server-communication on the Internet and supported by all modern browsers (nice intro explaining the difference to WebRTC and arguing why WebSockets are often the better choice). To plot your data in a browser with Javascript and SVG, have a look on the D3.js library. A quick search brings you to demos like this one: D3 Real Time Chart. Also, there are other libraries that are built on top of D3, for example plotly.js.
Summary:
Java is fine for web backend services.
Your code needs refactoring to serve a backend API, preferably WebSockets. (introduction on how to start in Java at https://www.baeldung.com/java-websockets)
Get familiar with a Javascript browser plot library, such as D3.js.

How to run existing JAVA Web start application in java 10 or later java 11

My application is developed in java Swings which is 20 years old. For this huge application we are migrating the same on JAVA 10 now and will migrate the same on java 11 or upcoming versions. This application is working fine with java Webstart and as per the java 11 features, java Web Start application will not be supported in java 11 and other coming versions.
Please let me know the best way to run my application on java 10 with out webstart.
There is OpenWebStart start project. It says:
we decided to create OpenWebStart, an open source reimplementation of
the Java Web Start technology. Our replacement will provide the most
commonly used features of Java Web Start and the JNLP standard, so
that your customers can continue using applications based on Java Web
Start and JNLP without any change.
At the moment the project is alpha phase. Download is available. Beta should be available by the end of the year:
Our goal is to have beta tests and a release candidate ready in
Q3/2019
One solution might be the WebStart replacement that Karakun is currently working on: https://dev.karakun.com/webstart/
Currently it is not clear when and how this will come since it is based on a kind of crowd-founding but since everyone can get involved (even with low cost) this is a very good possibility.
Since this is a duplicate of Applet/JNLP on Java 11 migration I just copied my answer
Use Getdown which is a system for deploying Java applications to end-user computers, as well as keeping those applications up to date.
It was designed as a replacement for Java Web Start due to limitations in Java Web Start's.
You can read more on https://github.com/threerings/getdown
You will have to find an alternative technology to JWS/JNLP to run your system, as JWS/JNLP will no longer be available.
I don't have a clear cut alternative, the few companies still using JWS tend to be working to develop their own replacements for internal use.
I know this may not be what you want to hear (that there is no out of the box replacement available) but that's the way it is. Project I'm working on is in a similar conundrum, we also have several JWS components that will need to be reworked in the near future.

Lazarus Pascal on Android - performance

Although a long-time developer, I've never seriously used an Android device - let alone programming one. So I'm new to this platform.
I'm looking at Lazarus for Android and found this link that has the following lines:
LCL-CustomDrawn-Android utilizes a minimal Java application which
communicates with our Pascal library and sends all events to it and
also obeys commands from it.
This raises a bunch of question for me.
In other words, is Lazarus running on the Android like a Windows app running on Wine (for Linux)?
If Java has to get in the way, wouldn't it be faster to directly run Java code without creating Lazarus/Pascal code?
Thanks!
In other words, is Lazarus running on the Android like a Windows app
running on Wine (for Linux)?
No. While there is a light preference for Java, native is quite common on Android, and they all need to connect to OS services via a Java skeletal application.
If Java has to get in the way, wouldn't it be faster to directly
run Java code without creating Lazarus/Pascal code?
No. The code that runs is native, only GUI events trigger some minimal java overhead.
The ARM CPUs on phones can execute Java bytecode natively, it's built into their instruction set. So it doesn't need to run through an interpreter like on Windows or Linux. Java doesn't provide such a speed penalty there as everywhere else. That's not true of x86 Android but ARMs were built partly to run Java. https://en.m.wikipedia.org/wiki/Qualcomm_Snapdragon
Is Lazarus running on the Android like a Windows app running on Wine (for Linux)?
Actually, it sounds more like a Java (Swing) application running in Windows. Swing is known for drawing its own controls, rather than using the controls provided by the host operating system (OS). The only connection between Swing and the host OS (Windows, etc) is the window chrome around the application and how the host OS controls this window chrome.
If Java has to get in the way, wouldn't it be faster to directly run Java code without creating Lazarus/Pascal code?
It would be faster, as Android is natively based on Java. In fact, if you can write Android apps in Java, I recommend you to pick that as your first choice. Start here to learn the basics.
I believe the purpose of this Lazarus/Pascal library is to help run Pascal apps on Android, or otherwise help Pascal programmers write apps for Android. It may also help write apps where any limitations of Java would require the use of Pascal.
To take the analogy further, C++ and C# apps generally run faster on Windows as the OS is natively based on these languages. However, many applications are still written in Java using Swing interface for various advantages such as programmer familiarity or cross-platform availability of the app.

Is there a legitimate, automated, method for deploying Java applications on iOS4?

I'm wondering if there is a standard method for deploying applications originally written in Java, to iOS4 devices.
I assume that the application in original format cannot be deployed - is there perhaps an emulation layer that I can use, or a stable compiler that compiles Java to ObjectiveC?
Option 1:
Use one of several cross compilers, compiling Java to ObjectiveC:
http://www.xmlvm.org/overview/
http://www.flexycore.com/ispectrum-overview.html
Option 2:
Package custom JVM with java application, with restrictions that meet the latest agreement (including no byte-code download capability and no JIT compilation). No JVM specifically designed for the iPhone is currently (Oct 2010) available, though the IKVM might run on top of Monotouch, and Oracle may build a version of the Java SE for the iPhone eventually.
Option 3:
Cross compile Java to one of the existing interpreters that are already accepted on the iPhone (eg, cross compile Java to C# and run the app on monotouch)
With the new current iOS SDK agreement and App store rules, it may be possible for you to embed a Java applet with your own JVM interpreter and runtime engine (but no byte-code download capability and no JIT compilation allowed).
Another seldom mentioned possibility for deploying any non media or graphic intensive networked app, such as many typical Java applets, is to run a customized RDP or VNC viewer on the iPhone and and view a Java app that is being hosted and run remotely.
Mechanically translating some of your code will likely work pending finding a cross compiler / translator. Trying to run a Java based GUI on iPhone is just plain stupid in my opinion. So the smart thing would be to port the GUI by hand.
The problem of course is if the app is mostly GUI you might as well write the whole thing over. Likewise if the app uses APIs that there is not a simple translation for you again might as well rewrite the entire app.
In a nut shell I think Steve J. Was right here, the route you are comtemplating just leads to poor user experiences. It actually makes me wonder why you would even think that a Java based app would be successful on iPhone.

Seeking advice on moving Qt 4 and Java applications between desktops on KDE 3

We've got a (perhaps?) unusual situation where we have a lot of applications built on Qt 4 and some applications built in Java (Swing) but we're using KDE 3. We're on Red Hat Enterprise Linux 5 and since there's no official version of KDE 4 for it, upgrading to KDE 4 is not a possible option.
One of the things on our project our customers require is the ability to have certain applications open up on different desktops. After sifting through the KDE 3 API, it seems that the main way to do this using the KWin::setOnDesktop function.
Unfortunately, using that function requires linking with KDE's libraries (libkdecore) and that you can include the KDE 3 header files, which include a bunch of Qt 3 stuff. Hence, we can't actually have any of the Qt 4 applications talk directly to KDE.
The problem for Java applications is that getting the X11 window id is a huge pain since it requires going through JNI calls. (There's a handy StackOverflow page about Java and X11 interaction here.)
Does anyone have any advice about how to move windows between desktops in this situation? Thanks for any ideas.
KDE4 also has a setOnDesktop method that will talk with KDE3's KWin window manager (or any other sane window manager). It's in KWindowSystem class. You can use that in your applications.
The point is that setOnDesktop method will use underlying X11 protocol to do the job. It doesn't matter that the application is written with one technology, and the window manager in another.

Categories