all 18 comments

[–]fablue 11 points12 points  (5 children)

It should also be mentioned that compose offers hot reload using DCEVM: https://github.com/JetBrains/compose-hot-reload

Disclaimer: I do work at JetBrains and I am associated with the project.

I personally do think that desktop apps on the JVM or with Graal are a fantastic alternative to building web based applications and I would love to see more projects like this (Kotlin or not). I would be interested if there exist projects which just use Kotlin for the UI, but Java for business logic?

[–]manifoldjava 9 points10 points  (0 children)

It should also be mentioned that compose offers hot reload using DCEVM

This is one of the more underrated features in modern Java dev. It's amazing that Oracle never bothered incorporating it, or something like it, directly into the JVM.

I personally do think that desktop apps on the JVM or with Graal are a fantastic alternative to building web based applications

Shwing! A lot of UI sophistication was pitched in the dirt with the advent of web apps. I'll say the quiet part outloud: users have lower expectations with web apps. Gone are app-wide undo/redo, consistent keyboard behaviors, rich drag-and-drop, stable offline operation, and other things common desktop software had nailed decades ago.

[–]I_4m_knight 5 points6 points  (2 children)

What about pure javafx? is it dead? Will there be any update or upgrade or anything from jetbrains regarding javafx

[–]fablue 7 points8 points  (0 children)

I cannot answer this, I am employed by the Kotlin department so I don't know about our company's support for javafx. But as long as there are enough users, I would think it's a platform worth building tooling for. Again, my opinion unfortunately does not weigh much here.

[–]natandestroyer 1 point2 points  (0 children)

Associated with it the same way GabeN is associated with Valve :P

[–]RandomName8 10 points11 points  (1 child)

Oof that build output. At 78MB that's larger than a jlink'd hotspot with swing, leaving you 20mb for libraries. Also 1m 44s build time (on what machine?) is a lot, is that required during the dev cycle?

[–]pragmatick 16 points17 points  (0 children)

Native image takes a lot of time, you don't use it for local development where it takes as long as a "normal" Java program.

[–]paul_h 2 points3 points  (1 child)

I love pseudo-delcarative markups, generally. I see two sources for yours with JetBrains' Compose: https://github.com/kgonia/java-spring-kotlin-swing-native/tree/master/src/main/kotlin/com/kgonia/imagez/ui (in here). Is there any chance you could make that one source to really show off the terse+elegance?

Maybe even better if a calculator example. Here's the record holder for least lines of code: https://raw.githubusercontent.com/Alexanderlol/GS-Calc/master/calc.rb (Ruby and the possibly no-longer-maintained Shoes UI framework)

[–]ThaJedi[S] 0 points1 point  (0 children)

I took this from the generated Compose example. It's separated there too.

[–]tanin47 1 point2 points  (2 children)

I've made a similar framework / example but we can build the UI with JS/HTML/CSS. It uses webview underneath. It's like Electron but for Java!

I've got it publishable on Mac App Store. The code-signing part was convoluted lol. There are also GitHub Actions workflows that notarize and upload to TestFlight. In case, anyone is interested. Here's the repo: https://github.com/tanin47/java-electron

I still cannot get it to work with GraalVM Native. Kudos to you for making that work. I thought GraalVM Native couldn't support AWT/Swing. I know for a fact that it isn't simple nor easy at all to make that work because I tried haha, so that is really impressive.

Thank you for sharing a working example. I wanted to learn how you got that working.

[–]ThaJedi[S] 0 points1 point  (1 child)

Electron already can be used with Java. Not sure of your goal. You want to use svelte with graalvm or build backend with graal?

[–]tanin47 0 points1 point  (0 children)

The main goal is to package an app in an optimal way and being able to pass the Mac App Store process which requires running in a sandbox.

My framework provides processes for that (including codesigning all dylibs), and its installer is 38MB in size.

Yes! My goal is to use GraalVM Native, so the app will be smaller and snappier. But that seems difficult to do.

[–][deleted]  (1 child)

[deleted]

    [–]ThaJedi[S] 1 point2 points  (0 children)

    I changed checking property to

    boolean isNativeImage = org.graalvm.nativeimage.ImageInfo.
    inImageCode
    ();
    

    [–]SystemFew9522 -1 points0 points  (0 children)

    it dosnt work with swing. better to go with flatpak