Why Sbt can not naturally pick up the JavaFx runtime ?

71 views
Skip to first unread message

Maatary Okouya

unread,
Aug 10, 2014, 3:32:00 PM8/10/14
to simple-b...@googlegroups.com
On Java7 Latest version, Javafx is fully part of the JDK/JRE. Why is it that sbt can't pick it up? Idea does a great jobs and add it to the classpath. So i can run the application without any issue. but i can't say the same for SBT. It does not find it. I saw some fix and plugin here and there. I'm just wondering what underhood is happening? 

Many thanks,

M

Josh Suereth

unread,
Aug 10, 2014, 6:16:38 PM8/10/14
to simple-b...@googlegroups.com
It's a good question.  Can you run `show compile:fullClasspath` and send that?   Additionally, does scalac see it without sbt?


--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-t...@googlegroups.com.
To post to this group, send email to simple-b...@googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.

Maatary Okouya

unread,
Aug 10, 2014, 7:24:06 PM8/10/14
to simple-b...@googlegroups.com
I have the following when i run the command.

List(Attributed(/Users/maatary/Dev/IdeaProjects/JavaFXSpike2/target/scala-2.11/classes), Attributed(/Users/maatary/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.2.jar))

I have a basic javaFx App with no dependency. This does not compile of course. 

Antoine Gourlay

unread,
Aug 10, 2014, 7:48:50 PM8/10/14
to simple-b...@googlegroups.com
> On Java7 Latest version, Javafx is fully part of the JDK/JRE

Sadly that is not the case: in Java 7, javafx is *not* officially part of the JRE, and *not* on the default classpath of `java` or `javac`, so you always have to add it manually. It is just distributed *with* the JRE, as an extra, but that's it. That's probably the thing people complained the most about in javafx 2.x...

And since it is not packaged with *all* versions of java 7 (only above u2), and, even worse, the packaged version changed over time (new non-forward compatible update in u6), the only solution on java 7 is to require your developers to check their version of java, possibly download javafx or update java, and then manually add it to the classpath, one way or another (and for distribution of your app you have to bundle it or use javafxpackager to take care of that).
IntelliJ probably looks into the JDK home you provide and adds it to the classpath, I suppose. That's useful, but dangerous because it makes you believe it is automatically there.

So basically javafx on java 7 is a mess. With java 8 however, it moved to jre/lib/ext [1], so it is on the default classpath of everything, including SBT, and everybody is happy (I use sbt to build a javafx 8 app and it works fine).

I don't have much experience with that, but you could try and locate JDK_HOME, look into "jre/lib/" for the javafx jar, and add it to the classpath or throws an error if missing.

Maatary Okouya

unread,
Aug 10, 2014, 8:19:09 PM8/10/14
to simple-b...@googlegroups.com
Thanks you for your detail explanation. Make all sense now. I guess it is the way they marketed it that is wrong and misleading. 
Reply all
Reply to author
Forward
0 new messages