Live data from Hacker News

Using Java 9 Modularization to Ship Zero-Dependency Native Apps

steveperkins.com

1–10 of 117 posts

Re: Using Java 9 Modularization to Ship Zero-Dependency Native Apps

#2
Even so, Java is now at a place where you can ship self-contained, zero-dependency applications that are comparable in size to other compiled languages (and superior to web-hybrid options like Electron).

For cross-platform desktop GUI apps, I would argue that JavaFX combined with Java 9 modularization is hands-down the best choice available today.

Electron is succeeding in the desktop GUI space because it tears down the barriers to desktop app development. While the author's article is excellent, when it comes to Electron, he (like most engineers) is still missing the point: the choice between Electron and its alternatives doesn't pivot on file size.

Re: Using Java 9 Modularization to Ship Zero-Dependency Native Apps

#3
While Electron's popularity was a boon to the desktop app scene, I keep on dreaming that JavaFX applications made with Kotlin, jlink, Gluon's scene builder (or maybe even something better) will gain enough popularity to attract a healthy open source community for cross platform desktop apps.

It feels like the tools are almost where they need to be and finally coming together!

Re: Using Java 9 Modularization to Ship Zero-Dependency Native Apps

#4
I want to use JavaFX to develop cross-platform apps but I feel JVM uses too much memory even for little things.

It's been a while since I've used Java to program, has the memory situation changed? or are there any other solutions for lowering the JVM memory usage?

Re: Using Java 9 Modularization to Ship Zero-Dependency Native Apps

#6

I want to use JavaFX to develop cross-platform apps but I feel JVM uses too much memory even for little things. It's been a while since I've used Java to program, has the memory situation changed? or are there any other solutions for lowering the JVM memory usage?

Java will use as much memory as you give it. Higher heap size is better for performance up to around 32GB. For most Java apps you can limit heap to 256M or less with little consequence.

AFAIK Java uses less ram than Python and JavaScript, only common languages that beat it are Golang and C/C++

Re: Using Java 9 Modularization to Ship Zero-Dependency Native Apps

#7
post #5

> A “Hello World” CLI written in Go compiles to around 2 MB. Nitpick but hello-world in Go : package main func main(){ print("Hello World") } is < 1MB on most computers (900KB on windows). No need to import the "fmt" package.

You can get under 200KB in Java easily by using proguard or similar to strip unused code from your dependencies.

Re: Using Java 9 Modularization to Ship Zero-Dependency Native Apps

#8

I want to use JavaFX to develop cross-platform apps but I feel JVM uses too much memory even for little things. It's been a while since I've used Java to program, has the memory situation changed? or are there any other solutions for lowering the JVM memory usage?

I used Swing Java applications on a computer with 512 MB RAM. Sure, Java eats more than C++, but it should be pretty in line with JavaScript which is a very popular choice nowadays.

Re: Using Java 9 Modularization to Ship Zero-Dependency Native Apps

#9
post #5

> A “Hello World” CLI written in Go compiles to around 2 MB. Nitpick but hello-world in Go : package main func main(){ print("Hello World") } is < 1MB on most computers (900KB on windows). No need to import the "fmt" package.

You can get under 200KB in Java easily by using proguard or similar to strip unused code from your dependencies.

Sure, but I didn't apply any specific code optimization or third party tool here.

Re: Using Java 9 Modularization to Ship Zero-Dependency Native Apps

#10

I want to use JavaFX to develop cross-platform apps but I feel JVM uses too much memory even for little things. It's been a while since I've used Java to program, has the memory situation changed? or are there any other solutions for lowering the JVM memory usage?

Java will use as much memory as you give it. Higher heap size is better for performance up to around 32GB. For most Java apps you can limit heap to 256M or less with little consequence. AFAIK Java uses less ram than Python and JavaScript, only common languages that beat it are Golang and C/C++

And memory used will be hopefully quite lower with value types, coming sometime in the future:

http://www.jesperdj.com/2015/10/04/project-valhalla-value-ty...

Post reply on HN