Dynamically loading class problem
I have a test class
public class test
{
public String getMsg(String msg)
{
return msg;
}
}
and i have a Test123 class
import java.lang.reflect.Method;
public class Test123
{
public String getMsg(String msg)
{
Object test;
Object param[]=new Object[1];
param[0]=msg;
String a="";
String path="/usr/testfolder/test";
try
{
test = Class.forName(path).newInstance() ;
Method aMethod = test.getClass().getMethod("getMsg", new Class[]{a.getClass()});
a = aMethod.invoke(test, param).toString();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
return a;
}
public static void main(String[] args)
{
System.out.println(new Test123().getMsg("hello"));
}
}
When the path="test", it is working,
but when i set the path="/usr/testfolder/test", it is not working.
Can anyone help me out of this?
thanks.

