Say my classpath is set to C:/long/obscure/path/name
, and within name
are two directories, foo
and bar
. I want to pass the location of foo
and bar
from a .properties file without including the whole path name.
My idea was to try referencing the class path with
fooPath = /foo
or
barPath = %CLASSPATH%/bar
but these do not work.
Is it possible to refer to the classpath within the properties file without explicitly defining it therein?
If you have c:/long/obscure/path/name in the classpath, you only have to refer to /foo
If you want the full classpath:
Get the classpath from the system:
String classPath = prop.getProperty("java.class.path", null);
joint the two strings
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.