Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get classpath entries for executing web application

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

like image 952
sebastian Avatar asked Dec 13 '22 15:12

sebastian


1 Answers

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.

like image 76
vbence Avatar answered Dec 28 '22 12:12

vbence