In the previous blog post, the edited Java source files and compiled bytecode files are saved in the E:\Java\develop\jdk1.8.0_25\bin directory.
If the edited Java source files and bytecode files are useless or want to be deleted, we can easily delete the other running program files in the bin directory. And also
If you want to create a lot of Java source files or we develop Java programs, then there will be a lot of Java source files and bytecode files in the bin directory, because
We will not write the source file in the bin directory, we need to edit the source file under another folder.
We save the edited Java source file in the E:\Java\JavaSE\Code directory, we use DOS to compile and run, then the following will appear
The error:
So how do we do under the current folder like in the E:\Java\develop\jdk1.8.0_25\bin directory, using Javac to compile the Java source
text and using Java to ship What about the line bytecode file?
We all know that in DOS you can use the Notepad command to open Notepad, and let's see if it can be in any drive letter or any directory.
Open Notepad:
After the above test we can open Notepad in any directory on the computer, we want to compile the Java source files also need this, in any
You can compile Java source files and run Java programs under any directory or specified directory. We can use Javac to mimic the way we open Notepad.
order. This requires the configuration of the environment variables.
first, let's look at the PATH environment variable.
(1) Why configure the PATH environment variable? Let's look at the role of the PATH environment variable.
the execution of the program requires the use of external instruction Javac, but the javac instruction is only available in the Bin directory under the JDK installation directory, so the program can only write
into the bin directory. During program development, the source code cannot be written to the JDK's installation directory, so the source program needs to be saved to the specified directory in any location (built
discussion use the English directory), so you need to make the JAVAC directive run in any directory. That is, the program at the end of the. exe can be hit in any disk
Open. Here's how to configure it.
(2) Path environment variable configuration mode 1
by configuring the PATH environment variable, the directory in which the javac instruction resides, the bin directory under the JDK installation directory, is configured under the PATH variable to make the Javac
command to run under any directory. Add the Bin directory under the JDK installation directory to the leftmost and add a semicolon.
Configuration steps:
A) Find the bin directory in the JDK installation directory, mine is: E:\Java\develop\jdk1.8.0_25\bin
b) Right-click on desktop computer-select Properties-Select Advanced system settings
c) in the Open System Properties dialog box, select Advanced, and then locate the environment variable
d) In the Environment Variable dialog box, locate the PATH environment variable in the system variable and click Edit.
e) Paste the E:\Java\develop\jdk1.8.0_25\bin into the front of the PATH environment variable (recommended at the front) and click OK.
f) Restart DOS and use Javac to compile Java source files and Java run bytecode files again.
Additional topic: Using DOS to open QQ
We configured the PATH environment variable function as mentioned earlier, it can start the EXE's running program, then we will configure:
The first is to find the directory where QQ.exe run the program: D:\Program Files\tencent\qq\bin;
Re-locate the PATH environment variable and paste it at the end.
Restart DOS, we use the QQ external command to open the QQ running program
I'll continue to build the Java development environment later in the blog post, as well as optimize the configuration of the path environment and configure the CLASSPATH environment variables.
Javase Getting Started Learning 3: Building a Java Development environment (i)