I use
URL res = this.getClass().getClassLoader().getResource(dictionaryPath); String path = res.getPath(); String path2 = path.substring(1);
because the output of the getPath () method returns sth as follows:
/C:/Users/......
and i need it
C:/Users....
I really need the address below, because some external library refuses to work with a slash at the beginning or with a file: / at the beginning or something else.
I tried almost all the methods in the URL, for example toString () toExternalPath (), etc. and did the same with the URI, and not one of them returned it as I needed it. (I totally donβt understand why it keeps a slash in the beginning).
It is ok to do this on my machine, just erasing the first char. But a friend tried to run it on linux, and since the addresses are different there, it does not work ...
What should be with such a problem?
Ev0oD source share