How to get default classpath
Jodd is an open-source java library with lot of reusable components and feature rich utilities.
This requires the library jodd-3.3.2.jar to be in classpath.
The following example shows how to use ClassLoaderUtil.getDefaultClasspath() API.
package com.bethecoder.tutorials.jodd.cls;
import java.io.File;
import jodd.util.ClassLoaderUtil;
public class GetClassPathTest {
/**
* @param args
*/
public static void main ( String [] args ) {
File [] clspaths = ClassLoaderUtil.getDefaultClasspath () ;
for ( File clspath : clspaths ) {
System.out.println ( clspath ) ;
}
}
}
It gives the following output,
C:\Program Files\Java\jdk1.6.0_10\jre\lib\ext\sunjce_provider.jar
C:\Program Files\Java\jdk1.6.0_10\jre\lib\ext\localedata.jar
C:\Program Files\Java\jdk1.6.0_10\jre\lib\ext\dnsns.jar
C:\Program Files\Java\jdk1.6.0_10\jre\lib\ext\sunpkcs11.jar
C:\WORKSPACES\JODD001\bin
C:\Program Files\Java\jdk1.6.0_10\jre\lib\resources.jar;
C:\Program Files\Java\jdk1.6.0_10\jre\lib\rt.jar;
C:\Program Files\Java\jdk1.6.0_10\jre\lib\sunrsasign.jar;
C:\Program Files\Java\jdk1.6.0_10\jre\lib\jsse.jar;
C:\Program Files\Java\jdk1.6.0_10\jre\lib\jce.jar;
C:\Program Files\Java\jdk1.6.0_10\jre\lib\charsets.jar;
C:\Program Files\Java\jdk1.6.0_10\jre\classes
C:\Program Files\Java\jdk1.6.0_10\jre\lib\ext\sunmscapi.jar
C:\WORKSPACES\JODD001\lib\jodd-3.3.2.jar