title: Source not found importing CSS to JavaFX
body: <p>I'm working on a project where I'd like to use an external CSS file with JavaFX to style the VBox and panes and such. </p>
  
  <p>I've used the line below to try to add the style sheet to the respective scene:</p>
  
  <pre><code>scene.getStylesheets().add(getClass().getResource("/style.css").toExternalForm());
  </code></pre>
  
  <p>This gave me null pointers, I read some other posts on this issue and found that this is often due to the stylesheet not being in the class path that it is trying to be accessed from. Here is a screenshot that allows you to see that this is not the case:</p>
  
  <p><a href="https://i.stack.imgur.com/PpNmW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PpNmW.png" alt=""></a></p>
  
  <p>You'll notice there is Styles.css and style.css, I tried both for different troubleshooting purposes</p>
  
  <p>I also found suggestions from people saying that if it is in the class path, that it should be accessed as such:</p>
  
  <pre><code>scene.getStylesheets().add("style.css");
  </code></pre>
  
  <p>However doing so is giving me</p>
  
  <pre><code>Nov 04, 2018 9:24:10 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
  WARNING: Resource "Styles.css" not found.
  </code></pre>
  
  <p>I'm open to any suggestions, I'm working in IntelliJ using maven.</p>
  
  <p><strong>EDIT: Here is the pom file for further investigation -</strong> </p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;com.almasb&lt;/groupId&gt;
  &lt;artifactId&gt;CashMachine&lt;/artifactId&gt;
  &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;source.version&gt;1.8&lt;/source.version&gt;
  
      &lt;!-- plugins --&gt;
      &lt;maven.compiler.version&gt;3.3&lt;/maven.compiler.version&gt;
      &lt;maven.shade.version&gt;2.4.2&lt;/maven.shade.version&gt;
  
      &lt;!-- dependencies --&gt;
  &lt;/properties&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;${maven.compiler.version}&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;${source.version}&lt;/source&gt;
                  &lt;target&gt;${source.version}&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
              &lt;version&gt;${maven.shade.version}&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;shade&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;transformers&gt;
                              &lt;transformer
                                      implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"&gt;
                                  &lt;mainClass&gt;com.almasb.atm.CashMachineApp&lt;/mainClass&gt;
                              &lt;/transformer&gt;
                          &lt;/transformers&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>