i need to read CLASSPATH
entries for current web application. In CLASSPATH
i have many files with this same name. I would like to check on which position they appear in classpath. For example: path:\file.txt;path2:\file.txt...
.
Thank you for your help.
Kind regards Sebastian
Try these:
// get the compact classpath value
String path = System.getProperty("java.class.path");
// the character : on windows and ; on unixes
String separator = System.getProperty("path.separator");
// the character \ on windows and / on unixes
String fileSep = System.getProperty("file.separator");
You need the separator
and fileSep
because :
and \
are highly system-dependant.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With