Forum Stats

  • 3,871,977 Users
  • 2,266,360 Discussions
  • 7,911,017 Comments

Discussions

Can't load Stylesheet while runing application on Web Start

870514
870514 Member Posts: 17
edited Jul 27, 2011 5:18AM in JavaFX 2.0 and Later
I've got an error "WARNING: com.sun.javafx.css.StyleManager$2 run Resource "null" not found" while runing application on Web Start.
It works fine while running on local execution. I've already signed jar files. So, It shoud not have any problem with java security.

I kept css in the jar fie. The code below is used for loading css file.
String stylesheetName = "/theme/default.css";
scene.getStylesheets().add(stylesheetName);
There was a guy who had the same problem with me but there was still no solution for this problem yet. 9679940

Does anyone know how to fix it?
Tagged:

Answers

  • 872132
    872132 Member Posts: 17
    edited Jul 27, 2011 3:51AM
    Hello User,

    Your path is wrong. It can't be good if your css file is inside your jar. (This is not a javaFx problem)

    If you pacaked your application like that:
    myapp.jar
    -----theme
    ---------default.css

    You should try something like this:
    scene.getStylesheets().add(getClass().getClassLoader().getResource("/theme/default.css").toString());
    Niculaiu

    Edited by: San Nicula on Jul 27, 2011 12:50 AM
  • 870514
    870514 Member Posts: 17
    Thanks for you help Nicula, It works.
This discussion has been closed.