Answers for "how to run jar file in java"

0

java load jar at runtime

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);
Posted by: Guest on February-08-2021
0

how to run module jar file in java

javac -d out --module-source-path src/main/java --module com.jenkov.mymodule
Posted by: Guest on December-13-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language