compile jar file command
jar cvf example.jar *
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>
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]
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]
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