java -cp MyJar.jar com.packagename.MainClass [somearg1] [somearg2] [etc]
URLClassLoader child = new URLClassLoader(
new URL[] {myJar.toURI().toURL()},
this.getClass().getClassLoader()
);
Class classToLoad = Class.forName("com.MyClass", true, child);
Method method = classToLoad.getDeclaredMethod("myMethod");
Object instance = classToLoad.newInstance();
Object result = method.invoke(instance);
Code Example |
---|
Java :: java loop through array |
Java :: arrondi java |
Java :: java variable |
Java :: stringbuilder java setlength |
Java :: 1 elemenet array java |
Java :: java 2d jagged array example |
Java :: Traversing through java map foreach |
Java :: Java empty() Method |
Java :: java store data |
Java :: what is java |
Java :: java record |
Java :: java check prime number |
Java :: mongorepository spring boot custom query |
Java :: change color in recyclerview |
Java :: java how to split a string to array |
Java :: Java Method Create Basic |
Java :: super class tostring java |
Java :: convert string into unicode java |
Java :: java hex to rgb |
Java :: Declaring a Java Method |
Java :: java hashmap |
Java :: java replaceall single character |
Java :: java unicode characters |
Java :: for loop in java |
Java :: writeToFileAsync java |
Java :: random class in java |
Java :: java listfiles filter |
Java :: java inser at index |
Java :: input method manager hide keyboard |
Java :: exchangerate api |