2

I have Ubuntu Linux system with Sun JDE 9.0.1 and I need to convert some of Fx's CSS files to binary form from console. But when I execute the command:

javapackager  -createbss -outdir . -srcdir .

I got an error:

Error: jfxrt.jar needs to be on classpath for -createbss and for -createJar without -nocss2bin

My JDK is properly installed. I have all necessary modules (including FX). Any ideas how I can avoid a stupid bug and I make the packager to do it's job? If I run javapackager from "/usr/lib/jvm/java-9-oracle/jmods" directory it completes without error. So right now I am using an ugly fix, search the modules directory, make it current, run packager from there. But that's damn ugly. javapackager doesn't accept any other parameters but outdir, srcdir and srcfiles so I can't force loading or looking path for the jfx module. But may there is some trick with environment variables or something that can make the fix less ugly?

P.S. Running from jmod directory or removing "-srcdir" from the parameters eliminates the error, but the packager doesn't generate any output files (even if I specify input files with "-srcfiles"). Seems as javapackager is completely broken in createbss mode. Does anyone use it with Java 9?

Sap
  • 728
  • 5
  • 18
  • Have you checked your environment settings ? – Marged Dec 11 '17 at 15:11
  • The fact that running from a specific path works implies this path is not that of your default Java installation. You could try using `update-alternatives` to make sure this is the default Java: https://askubuntu.com/questions/121654/how-to-set-default-java-version – Itai Dec 11 '17 at 15:15
  • My environment is Ok. I have an only Java installation (Oracle's JDK 9.0.1). All compilers and java programs (including JavaFX) works perfectly. When I specify an absolute path to javapackager it changes nothing. – Sap Dec 11 '17 at 15:25
  • Duplicate of https://stackoverflow.com/questions/47733618/creating-bss-files-from-css-in-javafx-9 ? – Naman Dec 11 '17 at 19:07
  • https://bugs.openjdk.java.net/browse/JDK-8193353 is tracking the issue. – Alan Bateman Dec 14 '17 at 11:48

1 Answers1

0

I've checked the sources - javapackager from JDK 9.0.1 is totally broken! Use executable file from Java 8. I filled out a bug report to Oracle and all of a sudden they were very surprised (nobody noticed that one of the basic function ot a core tool is broken yet?!).

TEMPORARY SOLUTION: Use the javapackaged tool from JDK 1.8. All you need is the executable itself and you can put at any place. I put it right into my project tree (under "tools" directory) and call from a building script. WARNING! Use this replaced executable for "createbss" ONLY! Use the regular one for all other things!

Sap
  • 728
  • 5
  • 18
  • The bss file is only an optimization of the css file, you could also just skip the bss creation and take (what is presumably) a pretty small performance hit, though I guess, in general, the workaround to use JDK 8 for the BSS creation is a better outcome if you can tolerate the annoyance ;-) – jewelsea Dec 14 '17 at 00:04
  • If the CSS if pretty big and used in every form then I can notice visible performance improvement. Which is very small though. – Sap Dec 15 '17 at 14:48