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
Use:
String pngpath = getClass().getResource("/resources/image.png").getFile();
File file = new File(pngpath);
System.out.println(file.getAbsolutePath());