4 Replies Latest reply: Apr 19, 2012 3:17 PM by David Grieve RSS

    Can't find .bss files at runtime

    ytw
      Hello,

      I used Eclipse to create a Runnable Jar from my FX project.
      When I try to run the Runnable Jar, I see the following exception:
      java.net.MalformedURLException: Could not open InputStream for URL 'rsrc:css/myapp.bss'

      I looked inside the jar and saw a myapp.css in the css directory, but no myapp.bss.
      I read from here (http://docs.oracle.com/javafx/2.0/deployment/packaging.htm) that says conversion from .css to .bss is optional.

      Is there a way to tell my app to just use the .css file and don't look for the .bss file?


      Any help is appreciated.
      Thanks.
        • 1. Re: Can't find .bss files at runtime
          David Grieve
          The problem is the "rsrc" bit of the url that is causing the MalformedURLException.

          The css code first looks for the binary form of your css file before falling back to the ascii. You can, however, set -Dbinary.css=false to stop the code from looking for the binary file. But I don't recommend this and you'll still get the MalformedURLException.
          • 2. Re: Can't find .bss files at runtime
            ytw
            Do you mean even if I have the proper .bss files in there, I will still get the exception?
            How can I get rid of the exception?
            My code that loads the css looks like this: scene.getStylesheets().add(getClass().getResource("/css/myapp.css").toExternalForm());

            Thanks.
            • 3. Re: Can't find .bss files at runtime
              jsmith
              It would appear that Eclipse (or something else) is doing something strange with the classloader and setting it to use some bizarre protocol.

              Perhaps this StackOverflow answer may help you: http://stackoverflow.com/questions/7507156/java-net-malformedurlexception-unknown-protocol-rsrc "java.net.MalformedURLException: unknown protocol: rsrc"
              • 4. Re: Can't find .bss files at runtime
                David Grieve
                John is right. Plug "MalformedURLException rsrc" into your favorite search engine.