The following gives a leading slash before the disk name. How can I avoid that?
String pngpath = getClass().getResource("/resources/lena.png").getPath();
System.out.println("pngpath = "+pngpath);
Gives:
pngpath = /C:/Users/jgrimsdale/Documents/NetBeansProjects/HelloCV/build/classes/resources/lena.png
Use:
you can do this using this code.
A constructor of File(uri) or File(string) helps to get file object from system dependent path string or URI object.
It is a solution to using the Java Library.
https://docs.oracle.com/javase/7/docs/api/java/io/File.html#File(java.net.URI)