u/jeffreportmill
-
17points
-
15points
Java SlideShow app (self.java)
jeffreportmill
jeffreportmill
I’m a big fan of TeaVM and I think more posts like yours would make a big difference. In my work I really wanted something like Swing 2.0 that would let me develop and run on desktop but with a deployment option in the browser. Here are some of my older samples:
jeffreportmill
Wow - what a great write up! I was late to the game (thankfully) in 2001 with a Swing page layout app, but for 20+ years I felt like I was always jumping through one hoop or another (InstallAnywhere, WebStart, code signing, ugh!). I don’t have much demand anymore, but for the last 10 years I’ve still been obsessed with running in the browser with CheerpJ and TeaVM.
TeaVM: https://reportmill.com/snaptea/RM16/rm16.html
CheerpJ: https://reportmill.com/rm15/app/index.html
A funny thing in the early days was that I would demo my Java reporting app at trade shows and people would often say, “too bad your designer can’t run in Java”. They just wouldn’t accept that it was already 100% Java, and I never quite understood why until your blog. :-)
jeffreportmill
You should include a section about CheerpJ. The only thing better than a good installer like jpackage is not having to install the app at all and just click on a link in the browser. If you post the jar to the ToDo app on a website and add a simple 10 line html, you can launch it in the browser.
jeffreportmill
You should post a link to this running in CheerpJ in the browser. You just need to put the jar file and a small html launcher file on a website.
I got it running in my SnapCode in the browser, but I need to add support to handle Resources outside of the /src directory. In the meantime it works with jbang:
prompt> jbang --java 25 snapcode@reportmill snapcloud:/com/reportmill/jeff/RescuED
jeffreportmill
I'm a little late to the thread, but here's a link showing the SwingTree Calculator UI generation running in the browser:
jeffreportmill
It seems recently that there have been fewer posts to this group. Can you provide some links to recent offending posts?
jeffreportmill
I just wrote the Java IDE SnapCode - the really cool technology there is CheerpJ, a WASM+JS port of OpenJDK: https://cheerpj.com
jeffreportmill
Very cool! Here is a link to it running in the browser:
https://reportmill.com/SnapCode/app/#open:https://reportmill.com/tryjava/JTunelScope.java
jeffreportmill
What is the app?
I use SnapKit (https://github.com/reportmill/SnapKit), which I based on Swing, but with modern features borrowed from JavaFX. And most importantly, it runs well in the browser.
jeffreportmill
What do you like most about jGrasp?
jeffreportmill
SnapCode runs will in the browser on the iPad and iOS in general, though you really need the keyboard.
SnapCode: https://reportmill.com/SnapCode
jeffreportmill
That has been my pet project for a few years:
SnapKit: https://github.com/reportmill/SnapKit
SnapCode: https://reportmill.com/SnapCode
jeffreportmill
I’m a huge fan of running Java in the browser with CheerpJ and TeaVM. It’s the only real way to restore the “Write once run anywhere“ promise. I wish there was more community interest to help push these tools into the mainstream. Here is my favorite project:
SnapCode: https://reportmill.com/SnapCode
jeffreportmill
CheerpJ has great JNI support - I was able to easily write an abstraction for OpenGL to let me use WebGL in the browser and JOGL on the desktop. I think internally they have done work to support JavaFX, but may lack the commercial demand to make it a priority. It would probably just take one motivated customer to make this a reality. WebFX is also another possibility.
jeffreportmill
There are still many cases where it’s useful to have an app that runs on both desktop and browser. CheerpJ is kind of like Electron for JS, but coming from the other direction - and it makes for a much better desktop app.
jeffreportmill
I agree. I think more community engagement could solidify/accelerate things. Even better, if Oracle, JetBrains or one of the other platform vendors took a real interest.
jeffreportmill
I’m a huge fan - CheerpJ lets me develop for the desktop and deploy everywhere. My favorite project is a Java IDE for education on desktop and browser:
SnapCode: https://reportmill.com/SnapCode
jeffreportmill
They recorded all sessions - I think they plan to release them all in the coming months. So far I think it's only been the keynotes and a few others.
jeffreportmill
I know the feeling and hope it continues to go well!
Also, maybe you should add a "Run this demo with jbang" section to your color picker demo. It's a great way to get people to kick the tires without having to git-clone. I've done a few myself (e.g. "jbang snapcode@reportmill").
jeffreportmill
This looks pretty exciting. I think this approach may be Java's best way out of the current UI morass - opening up browser UI development on the desktop by providing a Java bridge to WebAPIs and a browser frame.
I've been working on something related with SnapKit (https://github.com/reportmill/SnapKit), a Java UI library that runs on desktop and in the browser, but it has an adapter to use WebAPIs in the browser and Swing and the desktop. It would be more interesting if it only used WebAPIs since I wouldn't have to code to the least common denominator. I may have to give this a try.
jeffreportmill
Thanks! It is using CheerpJ which lets me launch the desktop version in the browser. The CheerpJ JVM is WASM and it does a JIT of Java runtime and my jar to ASM.js (they will eventually transition that to WASM, but for now JS still has some benefits).
I can also do AOT compile with very small runtime with TeaVM: https://reportmill.com/SlideShow/teavm/
The TeaVM version is older (I enjoy the convenience of CheerpJ using the same jar).
jeffreportmill
The desktop version can be downloaded and installed from the download link (as a JDeploy generated package), and it does have additional capabilities, such as working with local files (and the debugger only currently works on desktop version). Also can be run directly with jbang: `jbang snapcode@reportmill`.
I actually did that a year ago. SnapKit has a "webapi" package that abstracts fundamental Webapi and just needs a small adapter class, and I implemented one for JxBrowser, so I could run serious Java UI apps on the desktop using the Chrome engine instead of Swing. It mostly only needed an eval(javaScriptString) method to work. I should have started with JCEF though - I deleted the JxBrowser code after my evaluation license expired.
SnapKit WebAPI: https://github.com/reportmill/SnapKit/wiki/The-WebAPI-package#webapis-on-the-desktop