Add folder, which contains java sources, to classpath at runtime
Posted
by markovuksanovic
on Stack Overflow
See other posts from Stack Overflow
or by markovuksanovic
Published on 2010-05-03T06:59:44Z
Indexed on
2010/05/03
7:08 UTC
Read the original article
Hit count: 277
Is it possible to add a folder which contains java source code as a classpath element. I have tried a few things and it seems that the classloadr is not picking up java soruce files? One of my attempts is shown below....
File uncompressedSrc = new File("uncompressed" + File.separator + "src" + File.separator);
URL uncompressedSrcURL = null;
try {
uncompressedSrcURL = new URL("file://"
+ uncompressedSrc.getAbsolutePath());
} catch (MalformedURLException e) {
e.printStackTrace();
}
URL elements[] = { uncompressedSrcURL };
new URLClassLoader(elements, ClassLoader.getSystemClassLoader());
© Stack Overflow or respective owner