Answers for "how to run .jar files"

1

how to run java program with external jar files in command prompt

javac -cp "<File-Path>.jar;." <filename>.java
java -cp "<File-Path>.jar;." <filename>
Posted by: Guest on March-04-2021
0

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
Posted by: Guest on May-27-2021
-3

run jar file

java -jar yourFile.jar
Posted by: Guest on August-16-2020
0

java execute jar from main

java -cp MyJar.jar com.packagename.MainClass [somearg1] [somearg2] [etc]
Posted by: Guest on April-02-2020
0

run jar file with different jre

First, go to the location of the java installation file. By default, this is:
C:\Program Files\Java\...
Open the folder of the java version you want and go to the bin folder.
Copy the directory your at then go to your command line. 
Syntax: (%PATH% is path you copied):
"%PATH%/java.exe" [javaArgs] [filePath] [yourCodeArgs]
Posted by: Guest on March-20-2021
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

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language