JAVA_HOME: JDK installation directory
PATH: the JDK bin directory; Jre bin directory
The CLASSPATH:; %JAVA_HOME%\lib; The % JAVA_HOME % \ lib \ dt. Jar; % JAVA_HOME % \ lib \ tools. Jar;
(note that dot)
2. No JRE
Execute the following command to generate the jre
In the JDK directory: \ bin \ jlink exe - module - path jmods - add - modules Java. Desktop - the output jre
(can't perform with an administrator)
Generated after the jre don't forget to enter the environment variable, add in the path of jre bin directory
3. Offline installation
3.1 installation
Offline installation is one of the most simple installation, direct copy the Java installation directory, and then set the environment variable can
From your previous installed directly in the Java directory, also can copy others, look at his/her needs, the Internet has also provide offline directory package, according to their own needs to choose
Pay attention to set up environment variables
3.2 jar file association
Find a jar file, select the right & gt; Open the way & gt; Select other applications & gt; More applications & gt; Drop down to the bottom to choose select other applications on this computer
Selection box will pop up directory at this moment, the bin directory under the JDK directory, double click on the select javaw. Exe, attention! Not Java. Exe, nor javac. Exe
Double-click the choice after all the jar files are by default associated
3.3 double-click on the jar file is invalid
Associated with a jar file and found double-click still can't call out, suddenly flashed a form, then nothing happen
Other BBS and online tend to use recommended command: "Java jar file name -" or "javaw - jar file name" to solve the
But take temporary solution not effect a permanent cure, and every time want to use the command invocation, very troublesome
The solution:
This problem causes should be the problem of registry keys, offline installation is the lazy way, after all, all will be a little small problems, but the method is better than more difficult
Solution:
Enter the following registry
HKEY_CLASSES_ROOT \ Applications \ javaw exe, shell, the open and the command
Click the command, the right of the default key value is set to:
"% JAVA_HOME % \ bin \ javaw exe" - jar "% 1" % *
(adds a - jar, pay attention to the end of any % *)
Double-click on the jar file can be directly open at this moment, rather than a sudden flash form or use the command every time to call
CodePudding user response:
To configure the system environment variables,CodePudding user response:
If possible, try not to operate the registry,Environment variable configured, which can solve the problem of 99%,
CodePudding user response:
The software I have automatic configuration environment, I came to upload, you can have a try, free, https://download.csdn.net/download/wildcata/12379875CodePudding user response:
Download the official JDK installed with jre related packages, official JDK installation general win10 system can automatically help you to configure the environment variables, no, you can manually configure it, the path of the JDK and jre environment variables, and finally, execute the jar file command line must enter Java - jar XXX. Jar,