I'm trying to call method from .jar
But when I want to declare array of params for getDeclaredMethod I've got an error "cannot find symbol" on
Class[] params = new Class[]{ String };
^
Whole method
public void CallCloseWindow(String title){
//export dll
InputStream in = staticapi.class.getResourceAsStream("CloseWindow.dll");
File fileOut = new File(System.getProperty("C:\\Java\\CloseWindow.dll"));
OutputStream out = new FileOutputStream(fileOut);
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
in.close();
out.close();
//call from jar class
Class[] params = new Class[]{ String };
Object[] parms = new Object[] { new String(title) };
URL url=new URL("jar:file:/callapi.jar/");
URLClassLoader ucl = new URLClassLoader(new URL[] { url });
Class obj = Class.forName("callapi.callapi", true, ucl);
Method m = obj.getDeclaredMethod("CloseWindow",params);
Object instance = obj.newInstance();
Object result = m.invoke(instance,parms);
}
What's the problem?String.TYPE doesn't work either