java environment variables

After you write a Java program, if you want to write your own code that can be run properly, we need to compile it and run, and configure the Java environment variable is particularly important, this article, let's talk about the Java environment Some methods of configuration variables.

method one:

1. Right-click "My Computer" -> select "Properties" -> select "Advanced System Settings" -> select "Environment Variables." At this time, this will open a window:

Java environment variable configuration (Windows)

 

2. We click on the System Variables "New", will pop up a window like this:

Java environment variable configuration (Windows)

 

3. We enter the variable name: JAVA_HOME, variable values, paste we JDK installation directory. Then click OK

4. Select the "Path", click Edit, on the window that pops up, select New, or double-click in the blank, we enter the% JAVA_HOME% \ bin, and then click Move, move to the first line, because when we carry out a Java program when debugging, the system might interfere Java environment, so we have to run the Java environment into the first row.

Method Two:

1. The first step in a method of operating the same.

2. Select the "Path", click Edit, on the window that pops up, select New, or double-click in the blank, we enter the location of the JDK installation directory bin folder, such as: F: \ Java \ bin, and then click on shift to the first line.

(I am the Path environment variable understand it this way: for booting a computer system to find relevant files or location in the program)

Method three:

Sometimes, we need to use other people's computers to run the Java file, but on someone else's computer, if not configured Java compiler environment, we better not be on someone else's computer, just install things, so this when our third method comes in handy.

1. Prepare a U-disk, mounted on the U-JDK

2. U disk into the computer, win + R open the Run window, enter cmd, open a command prompt

3. Enter "set path =% patn U disk position JDK installation package bin directory%", press Enter

Note: At this point the configuration of the Java environment variables, only valid in the current DOS window.

Qujing website optimization summary: It is recommended to use the first method to configure the Java environment variables, because if we remove the jdk installed, you only need to change the contents of the JAVA_HOME, do not modify the path in the Path again, if the second method , when we change the jdk installation path, you may inadvertently remove other system configurations.

Guess you like

Origin www.cnblogs.com/a5651651616/p/12229945.html