Home > Back-end > How will run the jar in the environment variable, it can run in any directory
How will run the jar in the environment variable, it can run in any directory
Time:09-19
I wrote a maven project, and then packed into a runnable jar package
I can enter the following command in the CMD, normal operation of the jar
I don't want to enter the absolute path of the jar, now just want to input the Java - jar run. The jar is run the jar package Could you tell me whether need to put the jar path in the environment variable? How to configure?
Ps: 1, I don't want to put the jars in the current user C: \ Users \ jiehang, I am hope can be in any path through the Java - jar run. Run the jar 2, I know you can by creating a bat file, in which the specified after the absolute path to the jar, run the bat file directly, but I don't want to do this, I just want to configure the jars to the environment variables,
Excuse me everybody, how to implement? Please give details, thank you
CodePudding user response:
Put your jar directory PATH this environment variable
CodePudding user response:
Put the jar package address configuration under the classPath?
CodePudding user response:
Directly the jar jrer directory and you put together, and use it every time you direct input. \ jre1.8 x \ bin \ Java jar - XXXX jar
CodePudding user response:
Yes, put the jar package address configuration in the classpath environment variable: Specific operation is as follows: (a little trouble, upload pictures directly said steps)
First open the file explorer: Find the "computer", right click choose "properties"; Then click the "advanced system attribute"; Pop-up window, click on the "environment variables"; And then find "CLASSPATH" in "system variables", click; After a variable's value add jar package path, such as D: \ run jar; Note the front must add a semicolon; The last point directly determine to go,
CodePudding user response:
Can use the Java jar - D environment variable configuration project. The jar to deploy