3

I have a created a sample application using javafx. Due to certain restrictions in my network, I cannot install fxpackaging tools such at e(fx)clipse etc.

I have created jar using eclipse(version 4.5.1) application works perfectly when I execute jar file using below command in cmd

java -jar myjarfile.jar

Problem 1 :(resolved)

I have observed this exception in 'command prompt'

java.net.MalformedURLException: Coult not open InputStream for URL 
'rsrc:application/application.bss'

I have created bss files using below command(executed at project root level)

javafxpackager -createbss -srcfiles application.css -outdir .

Then copied the output bss file to proper location(program excepts resource located a specific folder).

Problem 2: (not resolved)

Initial exception has been resolved & I could see the fonts are displayed as expected. But in the background I could see below exception

java.io.IOException: rsrc:application/application.bss wrong binary CSS version: 5. Expected version less than or equal to3

Question:

How to fix this 'wrong binary CSS version' exception(displayed in command prompt)? Please note, I don't see any issues with application,which is running in foreground.

For testing purpose I have used a one liner styling code in my application.css file

.label{-fx-text-fill: black;}

→ jar file created using eclipse (JDK 1.7) & windows is running on JRE 1.7.0_91

css file : one liner as mentioned above

css file

bss file bss file

package structure

package

11
  • Could you post your JDK versions: the one used to create the project, and the bss file, and the one you are running your project with (java -version)? Mar 14, 2016 at 17:05
  • @JoséPereda, Jar file created using eclipse (having jdk 1.7) and application.bss created using windows JRE version 1.7.0_91
    – Raju
    Mar 14, 2016 at 23:55
  • Can we see the bss file that is causing this exception?
    – Abob
    Mar 15, 2016 at 0:05
  • @Abob78, I have attached images to my question. For testing purpose, I have put only a label in my *.css file.
    – Raju
    Mar 15, 2016 at 0:11
  • Do you have a JDK8 installed? Make sure you are not using it. Mar 15, 2016 at 0:26

2 Answers 2

2
+50

As José Pereda stated, bss is version 5 on Java 8. Based on the JavaFX 8 CSS Reference Guide for label, the syntax is correct. However, this is for Java 8, while you are currently using Java 7. If you have Java 8, configure eclipse and set the build path to use it and set your PATH variable accordingly to Java 8.

If the problem persists:

If it's not working even after the update, we'll try to compile it slightly differently to see what happens. According to this post, you don't need the .css file once you have compiled the .bss file.

Create a Test folder somewhere easily accessible. We'll be using this to see how the files being compiled separately will effect the exception since updating Java has done nothing at this point.

First, try to run the program with the essential files. If your Main.java file doesn't rely on the other java files in your project, then copy that file in to the test folder we recently created. If not, copy only the necessary parts that use the css (such as the scene and label that calls the css file), and paste that into a new Main.java in the new test folder.

Continuing forward you're going to have to open a command window in your test folder. You can do this by pressing SHIFT + RIGHT CLICK in the test folder on Windows Explorer and click Open command window here

After this, compile Main.java by typing this in the newly opened commnd prompt window:

javac Main.java

Next, copy appication.css but rename it to Main.css, for testing purposes. Then, run this in the command prompt window (You didn't have the -outfile arguement; this shouldn't matter, but it's a slight safety measure):

javafxpackager -createbss -srcfiles Main.css -outdir . -outfile Main

Now you should see that you have Main.css. Now, with the same command window you can easily run the file and see what happens.

java Main

Please leave a comment if this help you and which part of this answer you actually used to fix the problem if this answer did help you, thanks!

4
  • I would like to fix my issue before finishing the formalities of this question ;) I have installed JDK 1.7.0_76, unfortunately it is not generating any bss file. It is not even showing any error. I will try with JDK 1.7.0_79 & let you know my finding.
    – Raju
    Mar 16, 2016 at 1:03
  • test with jdk 1.7.0_95 , javafxpackager is not throwing any error & not creating any files at all :(
    – Raju
    Mar 19, 2016 at 17:06
  • packager is not working it seems. screenshot reference
    – Raju
    Mar 19, 2016 at 17:13
  • Looks like there is a bug with javafxpackager, but the rootcause was found, hence I am awarding bounty. Thanks @Abob78
    – Raju
    Mar 19, 2016 at 17:25
0

Based on the comments from José Pereda, Abob78 I did an experiment. I have figured it out that, the issue is not observed if I am using JRE 1.8

  1. Command prompt 1 : pointed JRE 1.7.0_91 → above exception observed
  2. Command prompt 2 : pointed JRE 1.8.0_40 → exception not observed.

Both running at same time & using same JAR file.

8
  • 2
    Bss level 5 is from JDK8, so that's why you don't get the issue running JDK8. The question remains: where do you run the javafxpackager from? Mar 15, 2016 at 0:56
  • @JoséPereda, that's a good catch. I think, that's the root cause of the issue. Though JRE is pointing to 1.7 directory, when I run where javafxpackager.exe it is pointing to JDK 1.8 directory.
    – Raju
    Mar 15, 2016 at 1:09
  • Make sure you run it from the JDK7 distribution, and check again, if it works I'll write a proper answer Mar 15, 2016 at 1:12
  • @JoséPereda, I have these java versions available in my system jdk1.6.0_31,jdk1.6.0_39,jdk1.7.0_25,jdk1.8.0_40,jdk1.8.0_51,jre7. Unfortunately, javafxpackager.exe is available in jdk1.8(2 directories) only. This utility should work in JRE1.7 and above. Is this possible ?
    – Raju
    Mar 15, 2016 at 1:16
  • JDK 1.7.0_65 to the latest 1.7.0_79 all have javafxpackager. You may need to upgrade your JDK7 version. Mar 15, 2016 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.