Event though relative paths may work in Java, I personally would recommend against using them. The mean reason being that the 'relative' path to a file changes depending on the working directory of Java. If you start the application from 'c: mp' then the relative path would be different then when you start it from 'c: est'. Even if the application is located in 'c:myApp'.
But if you want to use it first figure out where your applications was started from (called the working directory) by executing the code below:
System.out.println(Paths.get("").toAbsolutePath().toString());
After this change your relative path according to the difference between the working directory and the file you want.
As a side note I noticed the file is stored in the classpath. So you may want to look into the ClassLoader to acces the file rather then using the file system. You can do that (in case the code is executed in a test) by the following code:
MyClass.class.getClassLoader().getResourceAsStream("/com/pro/mockfiles/My-DOC-FILE.doc");
This code is more robust as it will work no matter where the application is started from.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…