title: Translating Windows absolute path to Java
body: <p>I have a file named dog.jpg that resides in c:\Temp. So its full Windows path is C:\Temp\dog.jpg</p>
  
  <p>Every answer on this site suggests to replace the \ with a /, but none of these statements I tried seems to work:</p>
  
  <pre><code>Image image = new Image("C:\\Temp\\dog.jpg");
  Image image = new Image("C://Temp//dog.jpg");
  Image image = new Image("C:/Temp/dog.jpg");
  </code></pre>
  
  <p>(btw, it does work if I put dog.jpg in the current working directory and use:</p>
  
  <pre><code>Image image = new Image("dog.jpg");
  </code></pre>
  
  <p>)</p>
  
  <p>I am getting the following exception report:</p>
  
  <pre><code>Exception in Application start method
  Exception in thread "main" java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
  Caused by: java.lang.RuntimeException: Exception in Application start method
          at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
          at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
          at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.IllegalArgumentException: Invalid URL: unknown protocol: c
          at javafx.scene.image.Image.validateUrl(Image.java:1121)
          at javafx.scene.image.Image.&lt;init&gt;(Image.java:620)
          at Inclass_week7_session_1_4.start(Inclass_week7_session_1_4.java:21)
          at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
          at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
          at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
          at java.security.AccessController.doPrivileged(Native Method)
          at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
          at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
          at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
          at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
          ... 1 more
  Caused by: java.net.MalformedURLException: unknown protocol: c
          at java.net.URL.&lt;init&gt;(Unknown Source)
          at java.net.URL.&lt;init&gt;(Unknown Source)
          at java.net.URL.&lt;init&gt;(Unknown Source)
          at javafx.scene.image.Image.validateUrl(Image.java:1115)
  
  
  
  
  C:\Java\Tutorial\JavaFX 2&gt;javac -version
  javac 1.8.0_102
  </code></pre>
  
  <p>What am I doing wrong? And how can I get this Windows absolute path to work?</p>
  
  <p>Thanks for your help.</p>