cljfx

https://github.com/cljfx/cljfx
sundbp 2019-04-03T08:18:10.085100Z

Any experience in creating uberjar files on Linux for a Windows target? I'd like to do all my Dev etc in Linux but be able to package for Windows target (incl native libs etc). Anyone tried that?

vlaaad 2019-04-03T08:19:42.086400Z

I did 🙂 cljfx does not specify classifiers when depending on javafx, and correct one is picked for current platform. for other platform you should specify platform-specific classifiers explicitly

vlaaad 2019-04-03T08:20:18.086600Z

like that [org.openjfx/javafx-base "12" :classifier "win"]

vlaaad 2019-04-03T08:21:17.087500Z

also you might want to exclude openjfx dependencies in cljfx so it wont package linux native libs in addition to windows ones

vlaaad 2019-04-03T08:21:39.087800Z

See full list of javafx deps in https://github.com/cljfx/cljfx/blob/master/deps.edn

vlaaad 2019-04-03T08:22:44.089Z

If you don't use web view, you might as well exclude it completely. I didn't try it, but chances are cljfx might still be able to work 🙂

sundbp 2019-04-03T08:36:09.089900Z

Cool. This what I just started. With aliases for linux/win to force the dependencied

sundbp 2019-04-03T08:36:20.090300Z

Sounds like I'm on the right path

sundbp 2019-04-03T09:12:11.090700Z

Sweet, got it working.

👍 1
1
lilactown 2019-04-03T16:12:51.091400Z

i'm pretty stuck on packaging my app for distribution for various OS

lilactown 2019-04-03T16:13:10.091800Z

I tried to use packr but it looks like it doesn't really support JDK 11+

lilactown 2019-04-03T16:13:36.092300Z

I know you mentioned jlink; is it fairly easy to get started? I can't really spend more than a day on this

lilactown 2019-04-03T17:02:07.092800Z

@vlaaad do you AOT all of your app before packaging it?

vlaaad 2019-04-03T17:09:09.092900Z

@lilactown jlink is a tool to slim down jdk to make it packageable, not a packaging tool itself.

vlaaad 2019-04-03T17:09:47.093600Z

I think @sundbp can share his experience since he did the same recently?

lilactown 2019-04-03T17:09:53.093800Z

yeah. I guess I assumed that you were also using some other tools for packaging, and wasn't sure if jlink + <insert packaging tools> would be something I could get working

sundbp 2019-04-03T17:11:12.094800Z

I'm just creating executable uberjars (using capsule), don't package the jre with it

sundbp 2019-04-03T17:11:41.095600Z

Don't need "install" and prefer the simple single jar.

lilactown 2019-04-03T17:12:04.096Z

the problem is that I don't think any of my users have JDK 11 installed

vlaaad 2019-04-03T17:12:33.096100Z

I heard there is an alpha version of jpackager tool distributed by gluon, maybe take a look at it?

lilactown 2019-04-03T17:14:37.096400Z

i'm trying that now

lilactown 2019-04-03T17:15:03.096900Z

I created an uberjar with no AOT, and tried using jpackager

lilactown 2019-04-03T17:15:22.097100Z

I get

Exception: java.lang.Exception: Error: Modules are not allowed in srcfiles: [target/app-fx-ui-0.0.1-SNAPSHOT-standalone.jar].

vlaaad 2019-04-03T17:21:30.097200Z

Ugh, sorry, don't know how to help, I'd just try to google this error...

lilactown 2019-04-03T17:24:32.097400Z

ok 😬 thanks

vlaaad 2019-04-03T17:25:01.097500Z

Can you run this uberjar?

lilactown 2019-04-03T17:25:48.097700Z

yes

vlaaad 2019-04-03T17:25:48.097800Z

Maybe just create a zip with jdk, uberjar and platform-specific executable that runs this jar with this jdk?

vlaaad 2019-04-03T17:25:58.097900Z

That's what we do:)

lilactown 2019-04-03T17:26:07.098100Z

hm yeah i'll try that

lilactown 2019-04-03T17:26:12.098300Z

bbl

lilactown 2019-04-03T22:20:53.099300Z

alright yeah, throwing the jre + the uberjar in a zip is only 80mb. i haven't checked to make sure it runs on someone else's box yet tho

lilactown 2019-04-03T22:21:06.099700Z

how do I add a handler for when the exit button is clicked on a stage?

lilactown 2019-04-03T22:28:37.100Z

ah OK, reading slack history on-close-request

lilactown 2019-04-03T22:29:51.100400Z

I tried this:

:on-close-request (fn [_]
                       (shutdown-agents)
                       (Platform/exit))
 
and I get:
Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: Not on FX application thread; currentThread = JavaFX Application Thread

lilactown 2019-04-03T22:30:15.100900Z

the error message is a bit confusing, but the gist is that I need to ensure it's run on the correct thread. how do?

lilactown 2019-04-03T22:31:47.101100Z

ah, fx/on-fx-thread 🙂

lilactown 2019-04-03T22:32:42.101400Z

hm. same error