Java Development Environment (1)

Source: Internet
Author: User

Java Development Environment (1)

In the previous blog, the edited Java source file and compiled bytecode file are stored in the E: \ Java \ develop \ jdk1.8.0 _ 25 \ bin directory,

If the edited Java source file and bytecode file are useless or you want to delete it, it is easy to delete other running program files in the bin directory. And

If you want to create many Java source files or develop Java programs, there will be many Java source files and bytecode files in the bin directory.

We will not write the source file in the bin directory. We need to edit the source file in another folder.

We save the edited Java source file in the E: \ Java \ JavaSE \ Code directory and use DOS to compile and run the file.

Error:

How can we compile the Java source using javac in the current folder, as in the E: \ Java \ develop \ jdk1.8.0 _ 25 \ bin directory?

File and use java to run bytecode files?

We all know that the notepad command can be used in DOS to open notepad. Let's take a look at whether it can be used in any drive letter or any directory.

Open notepad:

After the above test, we can open notepad under any directory in the computer. The Java source file we want to compile also needs to be like this

You can compile Java source files and run Java programs in any directory or specified directory. We can use javac to simulate the method of opening notepad.

. This requires environment variable configuration.

First, let's look at the path environment variable.

(1) Why should we configure the path environment variable? Let's take a look at the role of the path environment variable.

The program execution requires the use of external commands javac, but the javac command can only be written in the bin directory under the JDK installation directory.

Enter the bin directory. During program development, the source code cannot be written to the JDK installation directory. Therefore, you need to save the source program to a specified directory at any location (

The javac command must be run in any directory. Also, the program ending with .exe can be typed in any drive letter.

Open. Next let's take a look at the configuration method.

(2) path environment variable configuration method 1

Configure the path environment variable and configure the bin directory under the JDK installation directory where the javac command is located to the path variable.

Command to run in 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 under the JDK installation directory. Mine is: E: \ Java \ develop \ jdk1.8.0 _ 25 \ bin.

B) Right-click the desktop computer and choose Properties> advanced system settings

C) Select advanced in the System Properties dialog box and find the environment variable.

D) In the environment variable dialog box, find the Path environment variable in the system variable and click Edit.

E) paste E: \ Java \ develop \ jdk1.8.0 _ 25 \ bin to the frontend side of the Path environment variable (we recommend that you set the frontend side) and click OK.

F) Restart DOS and use javac to compile the Java source file and java to run the bytecode file again.

An additional topic: Use DOS to Open QQ

We have already mentioned the pathenvironment variable we configured. The variable can start the program running .exe, so let's configure it as follows:

First, find the directory where the Program running qq.exe is located: D: \ Program Files \ Tencent \ QQ \ Bin;

Find the path environment variable and paste it at the end.

Restart DOS. We use the QQ external command to open the QQ program.

In the following blog, I will continue to build a Java development environment, optimize the configuration of the path environment, and configure the classpath environment variables.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.