r/JavaFX • • Oct 26 '26

I made this! Notepadfx - Prosemirror based javafx WYSIWYG markdown editor

Post image

There are 100s of markdown editor, but very few of them support WYSIWYG

But very very very few of them are written in a non-browser based stack. Most of them will be like electron apps which will eat a lot of ram for simplest tasks - and i really dislike ram eating apps.

So I have made this in javafx, and distributed as a executable for windows, it is just a 600KB exe, which downloads the jar and installs the jdk if needed.

It also generates AOT (ahead of time) image of the app upon first run, so from second run, the app will be more fast.

Ram consumption is low, 100MB you can expect. When idle it can drop even to 15MB.

It also provides vertical tabs as a default. I like vertical tabs, I am not even given option for horizontal tabs.

I just made it, I haven't even tested it much. All credit goes to claude to make it (I basically refactored one of my old editors which used ckeditor and an embedded webview ... it wasn't nice ... honestly).

Project link : https://github.com/prosefx/notepadfx/

Here is the release link - https://github.com/prosefx/notepadfx/releases/

If you are on windows, please prefer the exe version, it is just 600KB, it is self installing, auto-updating, auto-generates and uses AOT image, all the best Garbage collection and jvm flags included in the exe.

If you wish to make such exes for java please see - https://github.com/jarrunner/jr (BTW Jr.exe is written in java! From Java -> C -> Exe using teavm !!! )

27 Upvotes

28 comments sorted by

5

u/emberko Oct 26 '26 edited Oct 26 '26

Looking at the sources, it's a 99.9% vibe-coded product. I doubt you even review half of the code written by Claude. I guess this subreddit needs another flair "Claude made this!".

2

u/Guilty_Village_958 Oct 26 '26 edited Oct 26 '26

ya true. - claude made this I had also plainly said so "All credit goes to claude to make it" ; anyhow i tried many existing editors, they are simply not addressing the need. It is true I did not review any of the code. Infact I even mentioned that "I just made it (with claude) and haven't test it much". But I am curious why you mention this? BTW did u notice the packaging with jr tool?

I read one of your comment made 16 days ago : ( https://www.reddit.com/r/java/comments/1x279d2/comment/pf0p4ft/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button ) :

User: Here is my small app written in Rust/PyQt/Gtk. It's just a simple format converter with a couple of buttons. It uses 30 mb RAM. I tried using Java, but it uses 100-150 mb RAM. I feel it's too much for this task. Can I reduce it?

Java dev: <Very long speech about GC trade-offs, followed by a lecture about the right ways to measure memory footprint, ended by a dozen of obscure JVM keys recommendations>.

User: goes away.

Java devs: Huh? But Java is so coooool. Why is that?

User: My app is just a single binary of 10 mb size. It's very easy to distribute, so I decided to write several small utils I can share with my friends and colleagues.

Java dev: You can use jlink to create a custom image. It's about 60 mb, but it's nothing nowadays, buy yourself a larger SSD or something. And just tell your friends to run it from yourapp/bin/. Or you can give them a JAR, it's very small and convenient. What do you mean they don't have Java installed? Just tell them to download it. What do you mean which vendor? Just tell them any vendor. What do you mean which version? The version you compiled it with, dumbass. What do you mean they have to reinstall Java if you compile it with a newer version? Of course they do! It's just 200 mb, and I already told you disk space is cheap and matters nothing, so stop bothering me with these questions.

User: goes away.

Java devs: Huh? But Java is so coooool. Why is that?

User: My app starts in 0.5 sec, which is kinda important for a small utility. Can I keep this time in Java?

Java dev: (stroking his beard) Well, if you ask me, startup time is only important in microservices. You can absolutely wait a couple of seconds more, but if you insist, you can enable CDS cache, it makes your app start 10% faster. So, it's 1.8 sec instead of 2 sec. Cool, isn't it? What do you mean not really? Then compile your own AOT cache, you ungrateful bastard. It adds 50 mb to your dist size, but I already told you the disk space is cheap.

User: goes away.

Java devs: Huh? But Java is so coooool. Why is that?

I agree. that is why I tried making jarrunner/jr tool ... you might add one more iteration between the user and java-dev ... mentioning jr ... and the ultimate conclusion of the story remains the same ... but it's just that there are java fan boys like me. JR is made in java --teavm--> C --> exe ; mostly tested on windows, a bit on mac, just compiled on linux never seriously tested.

1

u/No-Security-7518 Oct 26 '26

dude! why have DMs disabled?

1

u/Guilty_Village_958 Oct 26 '26

who?

1

u/No-Security-7518 Oct 26 '26

You. Wanted to DM you but you have messages disabled.

1

u/Guilty_Village_958 Oct 26 '26

I don't know how to use reddit, it must be a default setting ... so anyhow i sent you a message

4

u/OddEstimate1627 Oct 26 '26

Honestly, for a local standalone tool without a catastrophic failure mode, IMO that's fine. In a weird way, LLMs have made it cheaper to fix issues in production than to review every line of an app. This is especially true for UIs.

A lot of AI code is useless slop, but occasionally there are some legitimately cool projects. I unfortunately don't have a good answer for how to sift through the noise though.

2

u/No-Security-7518 Oct 26 '26

very cool - How is the AOT image created? using Graalvm?

3

u/Guilty_Village_958 Oct 26 '26

standard jdk25 AOT, waiting for jdk28 will add AOT code cache also

3

u/OddEstimate1627 Oct 26 '26

Given that you use a lot of agents, I'd also try AOT with Oracle GraalVM (25.4). Agents should be able to figure out the configuration and metadata by themselves after pointing them at the reachability-annotations recipes and StaticFX documentation.

That'll give you a single executable that starts up significantly faster than even jdk28 AOT, without all the headache of downloading JVMs. It would also give you an easy way to embed a CLI tool for working with markdown files.

2

u/Guilty_Village_958 Oct 27 '26

u/OddEstimate1627
I tried it with my claude-code. The numbers, and what they mean for jr, are below (the following is written with claude-code with human-me loop :) )

Setup

Oracle GraalVM 25.0.4, StaticFX (us.hebi.graalvm:jfx-static-feature 1.1.1 + jfx-static-libs 26.0.2-1), reachability-annotations 1.0.0-RC5, Windows 11. The app's own metadata was small: one u/Reachable (resources = ...), plus FFM downcalls and AWT JNI taken from one tracing-agent run.

Measured (same file, warm, process start to window shown)

  • native -Os: 0.33 s; native -O2: 0.34-0.38 s
  • JDK 28 EA, AOT cache with code, full tiered: 1.27 s
  • JDK 25, AOT cache: 1.44-1.6 s
  • no AOT: 2.3-3.6 s
  • second launch handing a file to the already running app: native ~0.19 s, jr exe ~0.37 s
  • RAM: about the same (native ~130-150 MB active, JVM ~145-180 MB); both trim to single-digit MB at idle
  • size: native 45 MB at -Os (73 MB at -O2) + ~4 MB of AWT DLLs; jr 600 KB exe + 18 MB jar + a JDK fetched once
  • build: native 2.5-5 min and ~5 GB RAM per OS; the jar builds in seconds
  • llvm-mingw (clang as cl, lld) can replace MSVC's compiler and linker, but still needs MSVC's CRT and SDK libraries; the output was within 4 KB at the same speed

Where this leaves jr

Native wins the cold start by about 4x. A cold start happens once per session, though, and release speed matters more for an app that changes daily: with jr an update is a jar on a GitHub release, and several can ship in a day. Native fits a stable or LTS channel, and tools where every run is a cold start (a CLI).

Three things worth exploring in jarrunner:

  1. Install and self-update for GraalVM native exes, so a native build gets the same install / update flow that jr apps get from jr-apputils. I am working on that on an experimental basis as it looks interesting and promising for other use case (not notepadfx per se).
  2. A training recipe shipped inside the jar, from which the AOT cache is generated on the user's machine. Shipping the cache itself is the wrong trade: it can be larger than the JRE installer, and it is tied to the exact JDK build, CPU features and GC. A recipe is small and portable (say a json describing configurations, and wildcard list of classes to load etc), and a cache generated locally from it matches that machine. There is already a jarrunner.aot library I will be extending it to make it better ... so far I have been lazy to optimize but while testing got reminded and will work on this.
  3. JDK 28's AOT code cache only pays off with a training run that really exercises the app (methods that run and get compiled) and without -XX:TieredStopAtLevel=1. That makes point 2 more valuable than it is on JDK 25, where loading the right classes is most of the gain.

Comments, criticism, corrections and counter opinion is welcome.

1

u/OddEstimate1627 Oct 27 '26

It looks like Claude somehow got the idea that it needs to natively compile every build/test? It can still develop on the JVM with a quick -Ob test before an actual release, which takes a few minutes on Github CI runners.

IMO the "release speed matters more for an app that changes daily" is not valid, but it's good that you tried and got it working.

The AWT DLLs are placed there by Native Image, but they are not actually needed at runtime. You should be able to get a single-executable result with everything else being included statically (unless you're using Web or MediaPlayer).

1

u/Guilty_Village_958 Oct 27 '26

u/OddEstimate1627 I tried this honestly and I am not satisfied with graalvm. I tried because i was tempted, jr is amazing for me, it might not and need not be for everyone. thanks for pushing me to try. But honestly i feel suffocated to imagine having to go back to the constrains and difficulty of pre jr.exe world. My use case and logic might not make sense to others. But i have been using native compilers since the days of Excelsior Jet (20 years ago approx I think i got the license) and I even had a free license for open source from them. Jr has been my best experience so far. no doubt.

2

u/OddEstimate1627 Oct 28 '26

No worries. It's fine for people to have different constraints and opinions. Our users are often in offline environments and locked-down corporate networks, so downloading a Java runtime on first launch is a non-starter. I'm pretty much limited to single executables or MSIX packages generated by Conveyor.

I'm glad you got it working, but I'm not going to argue if you pick something else.

1

u/Guilty_Village_958 Oct 27 '26

hm ... this jr.exe thing is something which is for free, it is very convinient and the app is fast to launch in 200ms to less than a second; therefore my motivation for graalvm drastically reduced. Initially i was planning to use graalvm once the app is stable (not for this alone, but as a general principle). And I tried reachability-annotations etc and it was all over a head of repeat build process of several minutes. AOT for me turned out to be ... something which comes for free out of the box and fast. Regarding download of jdk etc, it is a one thing thing for end user, after that the distribution size is very small compared to a graalvm exe. But the way you have written it, I am wondering if I should again go back and try graalvm. One side i feel the curiosity and greed to try again ... one side it feels the gains will be minimal ... the launch is already in milliseconds. RAM consumption is also low. Thank you I think i will try.

1

u/No-Security-7518 Oct 27 '26

I've had a pretty negative experience with that. reachability-annotations doesn't work with all libraries (even some which they listed in a table of compatible libraries). Not to mention, I need to have frequent updates to the program. Can't have the build process that recreate the whole native program every time.

2

u/OddEstimate1627 Oct 27 '26

where do reachability-annotations mention compatible libraries? It's recreating the matching JSON metadata at build time, so changes to FXML and other parts are picked up automatically. That process takes a few seconds.

Active development still happens on the JVM 99% of the time. If the metadata is handled, full native builds are only needed before releases.

2

u/No-Security-7518 Oct 27 '26

on Graalvm's page. This was almost a year ago so I don't remember 100% of the details but the build failed because of MySQL and some other library. And like I said, native compilation as nice as it is, meant I can't have incremental updates. So I personally can't go that route.

1

u/OddEstimate1627 Oct 27 '26

I've used native image with JavaFX for several years and have spent quite a bit of time trying to make the experience more seamless.

The reachability annotations, StaticFX, and MobileFX (not yet released support for Android and iOS) didn't exist a year ago. It should have become a lot easier to deploy applications, in case you ever decide to try again.

Reachability annotations is a completely separate project from GraalVM's metadata repository.

2

u/No-Security-7518 Oct 27 '26

is MobileFX Android programming with javafx? And I agree; a lot can change in a year. I appreciate you immensely for bringing them up. 🤝🤝

3

u/OddEstimate1627 Oct 27 '26

Yes, both Android and iOS. I built a lot of skins that look like native Compose/UIKit skins w/ native animations that get selected via android.css/ios.css and `-fx-skin`.

Most of the skins are agent-generated though, and it takes a lot of time to manually review the full API surface. That's why I haven't released it yet.

2

u/Guilty_Village_958 Oct 27 '26

for this kind of specific application ... mobile apps graalvm does makes sense, similar to how gluon started first

1

u/No-Security-7518 Oct 27 '26

this is very cool - but it related to Gluon? I remember way back they had a commercial license that's not very indie-dev-friendly, if you know what I mean. We generally can't pay for a framework and the like, we already contribute to open-source repos left and right. We can only pay for APIs and so on. I wish you all the success in the world.

→ More replies

2

u/Guilty_Village_958 Oct 27 '26

Same here thanks for sharing ... will keep an eye ... much appreciated, i have followed u on github and youtube.

2

u/No-Security-7518 Oct 26 '26

Very very cool!

1

u/DouDouandFriends Oct 27 '26

why not use jpackage

1

u/Guilty_Village_958 Oct 27 '26 edited Oct 27 '26

This is 600KB exe which is both the installer, updater and the application launcher. From day 1 jpackage did not make sense for me. Graalvm makes more sense. Jr.exe makes several times more sense. Also it is very fast to build, it takes absolutely no time, to repackage to test etc. JPackage would end up copying 100s of exes, also I wonder how one does jdk25 AOT with jpackage. Not that it is not possible, I wonder how it should be done. In jr.exe everything is out of the box. AOT is created automatically on first run, and used from second run onwards. If it goes bad, for some reason it is flagged for recreation in the next run. JR.exe 's share the same JDK/JRE (as long as the targeted min/max version range is same), every jpackage goes along with it's own jre and floods. JR.exe is deceptively like a native program, non technical people might never realize it is java, which needs a 50MB jvm etc. That is a one-time installation after that updates feel super snappy. It is like updating yt-dlp .... the exe swaps itself in update, while the program is still running. And in the next run the old exe is deleted. I wonder why I would even want to use jpackage. Also there is literally no installation in jr.exe , it is just a copy paste or download double clink run.
Honestly if people are happy with jpackage good for them, but if i would be left with no choice but jpackage, i would feel bad and disappointed. In such situation Graalvm looks better. And jr.exe is a middle path I feel, and over months of using it, I am happily settled with it as the first and only choice. The auto update logic has become the part of the build distribution process. It is simple (whole jar is redownloaded on version update) with sha256 (for download integrity check) and sha256/crc32 (for check before launching) are used to make sure no tampering, I wonder if I can do these small small things with jpackage easily. And I also wonder how I could do autoupdate of the jpackage exe. Having one unique exe per distribution allows me to treat that exe as a trusted app. I have some apps which have some security implications, if you see https://github.com/leasegate/bwgate for example you would know (there is also sshgate, gitgate, cdpgate etc.). BwGate for example gives access to my full bitwarden to anybody who asks (using a cli), i can approve a running claude instance for example, for say 15mins, and a certain set of credentials, the next invocations would be allowed with no questions asked to the same process or it's children. So the cli bwcli.exe is a jr.exe app ... if i allow it, i know it is my app, not something tampered. If somebody tampers the jar it will not work, it will break, if someone tampers the exe, the hashes will change it is again detectable. So these small features are not gamechangers, but they all come for free. And I was able to make them very easily. If I had to go with any other tool, I would be scratching my head for quiet sometime. Right now my entire workflow is very happily settled in this. JR.exe makes identifying the process in taskmanager so easy, otherwise it is like which java process is my app ... I have to think. I am easily able to kill the process if needed, monitor it's ram usage easily etc. And if I forgot telling jr.exe is written in java. It is made using java + teavm -> C -> exe. So it is again a java territory of customization, java using windows/mac native but written in a C-ish java. Maybe if I made it with C (which I did for the first few versions) it would be around 250-300KB ... but it is 600KB ... I can live with it. C is scary for me compared to Java, java feels safer and more familiar.