Fork me on GitHub
Grigory Shepelev09:09:23

@vlaaad I had to add {:aot :all :injections [(javafx.application.Platform/exit)]} to my uberjar properties in project. But now I have another problem. For some reason the process is not terminating after closing the window. I still can see it in my htop...


Javafx runs a non-daemon thread that prevents jvm from terminating


You can set implicit exit to true to make it terminate the vm on closing the last window


This for not make sense for repl, but useful for -main

Grigory Shepelev10:09:37

Tnhx. I will rty right now

Grigory Shepelev10:09:51

It's not helping. Should I add something to :on-close-request of stage ?


Can you share your source so I can have a look?


It's hard to know why implicit exit is not enough

Grigory Shepelev11:09:28

I can share access to the source code in GitLab

Grigory Shepelev11:09:33

I gave an access with <mailto:[email protected]|[email protected]> You should see an invite. All the code in pdf-only-export branch, in gui.clj and app.clj file


Thanks! I'll try to have a look today


I can't see the code though...

Grigory Shepelev12:09:03

Do you mean you can't see code on gitlab? I have guest access Sorry for late reply... For some reason I can't see notifications on phone


Yes, I can open the repo, but I can't see the code


Maybe guest access isn't enough?


Or you can add some permission to guest accounts... I don't know gitlab well enough :)

Grigory Shepelev08:09:27

ok. sorry for a late reply again. I just gave a developer access.


@UKG0SELQY I managed to aot-compile your example so it exits the jvm when the windows is closed, there were a couple things missing:


hit send too early 🙂


1. in the main ns I added this to ns form:

(:import [javafx.application Platform])
2. in the -main fn in main ns I added (Platform/setImplicitExit true) 3. in project.clj, I added this to :uberjar profile:
:jvm-opts ["-Dcljfx.skip-javafx-initialization=true"]
4. I removed ^:skip-aot from project.clj 5. I bumped cljfx version to latest (1.7.9). It is very important for aot because skipping cljfx initialization was added in a later version than what you had specified 🙂


cljfx.skip-javafx-initialization was added in 1.7.0 and you had 1.6.6

Grigory Shepelev11:09:24

I will try right now

Grigory Shepelev11:09:49

Thnx. Now it works as expected on close. I had :jvm-opts outside of :uberjar... May be that's also the problem

Grigory Shepelev11:09:03

Best lib maintainer in my life.


Haha thanks


Become my sponsor on GitHub :P


Or make your employer do that!

Grigory Shepelev12:09:35

I'm unemployed/ I promise that I'll send one-time 20$ from my first salary.


Haha, no pressure :) you are welcome!

Grigory Shepelev14:09:21

I have one more question. It might be out of your competence. When I pack it with uberjar and run on Windows I see the exception: "A java exception has occured". And that's all basically. Nothing more. Is it connected to cljfx?


Try running it from the command line to see the exception


If you want to distribute your app, I would also recommend to look at jpackage


This example app doesn't use leiningen, but the jpackage part of the packaging is independent from the build tool, i.e. it works on uberjar

Grigory Shepelev15:09:01

when i run it on windows cli I have:

"Graphics Device initialization failed for : d3d, sw" Problem
Exception. It seems to be connected to this ( question.

Grigory Shepelev15:09:28

I'm a total newbie in java-related-devops.


how do you run the assembled jar?

Grigory Shepelev15:09:32

java -jar jarname.jar


do you use the -standalone.jar version built by leiningen?

Grigory Shepelev15:09:50

That's the strange. Thing. It feels like it's not standalone.


exactly what I thought


do you assemble the standalone jar on the same OS as the OS you try to run on?


e.g. do you build the windows jar on windows?

Grigory Shepelev15:09:56

I build on ubuntu.


that’s the problem 🙂

Grigory Shepelev15:09:18

Won't that work on Win? I thought that's the goal of java....


even though jar is cross-platform, this cross-platformness is only about the class files


in addition to class files, jars might contain platform-specific libraries


javafx has platform-specific libraries


it also configured it’s maven dependencies in a way that automatically selects the jars for the OS we resolve maven deps for

Grigory Shepelev15:09:43

How can I set that up?

Grigory Shepelev15:09:38

Is that possible


there are 2 ways around: 1. make sure you build jars for different platforms on different platforms. Example hacker news app I posted earlier has example of github actions that do it. Perhaps gitlab has similar infrastructure you can use? 2. force maven to include dependencies for all platforms. this means you will have a really fat jar that has platform-specific libraries for every platform. You do this by specifying ALL javafx classifiers as dependencies

Grigory Shepelev15:09:23

sorry for late reply

Grigory Shepelev16:09:16

So you build them with 3rd services (github can build platform-specific, for windows)?


Yeah, GitHub has mac/windows/linux runners

Grigory Shepelev16:09:09

Cool. I'm a retrograde

Grigory Shepelev16:09:13

I can see that's kinda complicated stuff with a lot of yaml... Are you using CircleCI? Could you please share a piece of that code? So I

Grigory Shepelev16:09:25

have a little representation at least.


That's GitHub Actions, their built-in CI

Grigory Shepelev16:09:54

Do you still have some config-yaml?

Grigory Shepelev17:09:08

Oh.thnx. I didn't knew that's the workflow dir on that


No problem :)