Hi,
I am setting the classpath thru the code. It is setting the classpath but the class for which classpath is ser is not accessible.
could u please look into the code :
import java.io.*;
import java.net.*;
import java.util.*;
public class Testing1{
public static void main(
String args[]){
Class className = null;
String sClassName = "f:\\TestingToolPackage";
try{
Properties strPrev = System.getProperties(); strPrev.setProperty("java.class.path",sClassName);
System.out.println(strPrev.getProperty("java.class.path").toString());
URL[] urls = new URL[1];
urls[0] = new URL
( "file://f:/TestingToolPackage" );
ClassLoader cl = new URLClassLoader( urls );
className = cl.loadClass
( "TestingTool.TestPrograms.Triangle" );
if(className == null){
System.out.println(" Things did not work");
}else{
System.out.println(" It worked "+className);
java.lang.reflect.Method methods[] = className.getDeclaredMethods();
for(int i=0; i < methods.length; i++)
System.out.println("in gui "+methods[i].getName());
}
}catch(Exception e){
System.out.println("While trying to get an instance of the class "+e);
e.printStackTrace();
}
}
}