Java.io.IOException: rsrc: application / application.bss invalid binary CSS version: 5. The expected version is less than or equal to 3

I have created an example application using javafx. Due to certain limitations on my network, I cannot install fxpackaging tools such as e (fx) clips, etc.

I created a jar using eclipse (version 4.5.1) the application works fine when I execute a jar file using the command below in cmd

java -jar myjarfile.jar 

Problem 1: (resolved)

I noticed this exception on the command line

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

I created bss files using the command below (runs at the root level of the project)

 javafxpackager -createbss -srcfiles application.css -outdir . 

Then I copied the output bss file to the desired location (the program excludes the resource located in a specific folder).

Problem 2: (not allowed)

The original exception was allowed, and I could see that the fonts displayed as expected. But in the background, I could see below exceptions

java.io.IOException: rsrc: application / application.bss invalid binary CSS version: 5. The expected version is less than or equal to 3

Question:

How to fix this "incorrect binary CSS version" error (displayed on the command line)? Please note: I do not see problems with the application that works in the foreground.

For testing purposes, I used one liner style code in application.css file

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

→ the jar file created using eclipse (JDK 1.7) and windows work on JRE 1.7.0_91

css file : one liner as above

css file

bss file bss file

Package structure

package

+5
source share
2 answers

As Jose Pereda stated, bss is version 5 in Java 8. Based on the JavaFX 8 CSS Reference Guide for the shortcut, 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 the PATH variable corresponding to Java 8.

If the problem persists:

If it does not work even after the update, we will try to compile it a little differently to find out what will happen. According to this post , you do not need a .css file after compiling a .bss file.

Create a Test folder somewhere easily accessible. We will use this to see how files compiled separately will affect the exception, as the Java update did nothing at this point.

First, try to run the program with the necessary files. If your Main.java file Main.java not rely on other java files in your project, copy this file to the Test folder that we recently created. If not, copy only the necessary parts that use css (for example, the scene and label that calls the css file ) and paste this into the new Main.java in the new Test folder.

Continuing forward, you need to open the command window in the test folder. You can do this by pressing SHIFT + RIGHT CLICK in the Test folder in Windows Explorer and clicking Open command window here

After that, compile Main.java by entering it in the command window that opens:

 javac Main.java 

Then copy appication.css , but rename it to Main.css for testing purposes. Then run this on the command line window (you did not have the -outfile argument, it does not matter, but this is a small security measure):

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

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

 java Main 

Please leave a comment if this help is for you and what part of this answer you really used to fix the problem, if this answer really helped you, thanks!

+2
source

Based on the comments of Jose Pereda, Abob78, I did an experiment. I realized that the question is not observed if I use JRE 1.8

  • Command line 1: indicated by JRE 1.7.0_91 -> above noted exception
  • Failed to execute command line 2: JRE 1.8.0_40 indicated -> exception .

Both work simultaneously and use the same JAR file.

+2
source

Source: https://habr.com/ru/post/1243483/


All Articles