how to run jar from command line
#Run jar from cmd
java -jar <jar-file-name>.jar
#Run spring boot app
mvn spring-boot:run
how to run jar from command line
#Run jar from cmd
java -jar <jar-file-name>.jar
#Run spring boot app
mvn spring-boot:run
java execute jar from main
java -cp MyJar.jar com.packagename.MainClass [somearg1] [somearg2] [etc]
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);
how to run module jar file in java
javac -d out --module-source-path src/main/java --module com.jenkov.mymodule
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us