getResource puts a leading / before the disk name using java 1.7 windows 7
getresource, java
Solution
Use:
String pngpath = getClass().getResource("/resources/image.png").getFile();
File file = new File(pngpath);
System.out.println(file.getAbsolutePath());
Problem
The following gives a leading slash before the disk name. How can I avoid that? ``` String pngpath = getClass().getResource("/resources/image.png").getPath(); System.out.println("pngpath = "+pngpath); ``` Gives: ``` pngpath = /C:/Users/jgrimsdale/Documents/NetBeansProjects/HelloCV/build/classes/resources/image.png ```