Editplus environment variable configuration

Source: Internet
Author: User
Editplus environment variable configuration

For example, how to configure environment variables and How to Run Servlet? There are too many such problems. Now I want to write a beginner entry, so that it can be helpful for beginners!
First, download the tool:
I suggest using editplus + JDK for beginners. I think it is easier to use editplus + JDK for beginners, such as JB, eclipse, and jcreator, but it does not know how to configure environment variables for beginners,
Thus it is difficult to reach the point of knowing and knowing why.
You can download it at the following address:
Editplus (the latest version is v2.11): http://count.skycn.com/softdown.php? Id = 3641 & url = http://sc-http.skycn.net/down/epp211a_cn.exe (you need to follow the registration code to find it yourself, a lot of online)
JDK (the latest version is java2sdk3164_2): http://count.skycn.com/softdown.php? Id = 3116 & url = http://sc-http.skycn.net/down/j2sdk-1_4_2-windows-i586.exe (this is for Windows)
Then install JDK. I installed it under the c: \ JDK directory:
Then there is the classpath problem:
Just as the operating system uses path to search for executable programs, the Java Runtime Environment will traverse classpath to find classes. Even a simple program such as helloworld will traverse the JVM.
Classpath defines every path until the corresponding file is found.
I believe that if your system is not 2 K or XP, you should set the path as follows:
My computer-> properties-> advanced-> Environment Variables
Append the following path to the environment variable: C: \ JDK \ bin;.; C: \ JDK \ Lib.
You can also configure c: \ JDK \ bin;.; C: \ JDK \ Lib \ DT. jar; C: \ JDK \ Lib \ tools. jar.
★Remember: In the environment variables, remember not to be less. It indicates the current path. If there are fewer errors, you will say it!
DT. jar is a class library about the runtime environment, and tools. jar is a class library about some tools.
If c: \ JDK \ bin is not configured, "javac" is not an internal or external command, or a program or batch file that can be run ." This error occurs.
Then we should write the program:
The first is (helloworld. Java). Open editplus and create a new Java file. Enter the following information to keep it case-insensitive:
Public class helloworld {
Public static void main (string [] ARGs ){
Syste
M. Out. println ("Hello, world! ");}
}
Then save the file (CTRL + S) to helloworld. java. Remember to distinguish the case sensitivity. helloworld. Java is not helloworld. Java or other
Run the following command: Start-> Run-> cmd
Switch the directory to the current directory in the console:
Javac helloworld. Java
Java helloworld
You will see the output Hello, world on the console! (Not coming out? I have eaten my computer :))
Javac is a compilation command that compiles helloworld. Java into helloworld. Class.
Java is the command to explain. JVM will explain and execute helloworld. Class.
At this time:
1. If exception occurs in thread "Main" Java. Lang. noclassdeffounderror: helloworld
That is, you didn't add that. (DOT) to the environment variable)
2. If exception in thread "Main" Java. Lang. nosuchmethoderror: Main appears
Or helloworld. Java: 1: Public class helloworld must be defined in a file called
"Helloworld. Java ".
That is, you did not write this helloworld case-insensitive, or you did not save it as helloworld. Java
This name must be the same as the public class name.
Let's talk about the problem of environment variables. Next, let's talk about how to compile and run the environment variables in editplus, and choose tools> parameter settings> Configure user tools.
1. Add a tool (add an Application)
Menu text: compile Java program
Program: C: \ JDK \ bin \ javac.exe
Parameter: File Name
Initial Directory: file directory
2. Add a tool (add an Application)
Menu text: run Java program
Program: C: \ JDK \ bin \ java.exe
Parameter: File Name (excluding the extension)
Initial Directory: file directory
You can add a tool group name as needed, such as debug Java program.
Then, in the drop-down menu of tools, you will see the compile Java program and run Java program options. Then you can use Ctrl + 1 to compile and CTRL + 2 to run the program.

1.

Classpath:.; % java_home % \ Lib \ DT. jar; % java_home % \ Lib \ tools. jar;
Java_home: D: \ Java \ jre1.6.0 _ 02
Path: % SystemRoot % \ system32; % SystemRoot % \ system32 \ WBEM; % java_home % \ bin

Add: java_home error. It should be D: \ Java \ jdk1.6.0 _ 02
This should be the JDK directory. Instead of the JRE directory, you can try it again. Also, after modifying the environment variable, you must close the command prompt (DOS box) and re-open it to make the modified environment variable take effect.

JDK tools for developing Java programs
Myeclipse is an IDE, that is, an integrated development environment. Simply put, it is a tool that can automatically generate code, rather than a compilation tool.
After myeclipse is installed, it is very convenient to compile Java programs. However, if JDK is not installed, the Java programs you write cannot be compiled or executed.

First, you need to download a JDK. Now the JDK version is later than 6.0. You can download it from the sun homepage or Baidu. Install JDK and set the environment variables after installation.
The specific steps are as follows: "My Computer" -- "property" -- "advanced" -- "environment variable"
Create a new variable "java_home" in the system variables. The value is your JDK installation directory, for example, "d: \ Java \ jdk1.6.0 _ 04"
Create a new variable classpath with the value:.; % java_home % \ Lib \ DT. jar; % java_home % \ Lib \ tools. jar;
Then, append a segment of; % java_home % \ bin in the value of the system's original environment variable "path;
In this way, you can

2.

In Windows, Java mainly uses three environment variables: java_home, classpath, and path.
Java_home points to the JDK installation path, such as c: \ jdk_1.4.2. In this path, you should be able to find the bin, Lib, and other directories. It is worth mentioning that you can select any disk directory for the JDK installation path, but it is recommended that you have a lower directory level. If you have a deep directory, such as C: \ xxxxxx \ XXXXX \ XXXX \ XXX ......
Setting method:
Java_home = c: \ jdk_1.4.2
The path environment variable exists in Windows. You only need to modify it to point it to the JDK bin directory, in this way, you do not need to enter a large string of paths when compiling and executing programs in the console. The setting method is to keep the original path content and add % java_home % \ bin to it (Note: if you do not know about DOS batch processing, you may not understand the meaning of the content caused by %. In fact, the environment variable java_home set in the previous step is referenced here. You can write it as c: \ jdk_1.4.2; you can open a console window and enter echo % java_home % to check your settings ):
Path = % java_home % \ bin; % PATH %
Similarly, % PATH % references the previously set path environment variable. You just copy the previous value.
I put the classpath environment variables at the end, because you may encounter inexplicable and strange problems later. More than 80% may be caused by incorrect classpath settings, so be careful.
Classpath =.; % java_home % \ Lib \ tools. Jar
The first thing to note is the front "..;". If you cannot see it clearly, I will read it for you-a semicolon. This tells JDK to first find the class file in the current directory when searching for the Class-why? This is caused by the Linux security mechanism. Linux users understand it very well, windows users are hard to understand (because the default search order in Windows is to search the current directory first, then the system directory, and then the PATH environment variable ), so if you like Linux, you may want to study Linux.
Why is the specific file tools. Jar specified after classpath? Not specified? Obviously, no. I can do that again! :) This is determined by the import mechanism and jar mechanism of the Java language. You can check the information to solve this problem.
The specific setting method is as follows: Right-click Win2k \ XP and choose my computer> Properties> advanced> environment variables to modify the values in the system variables box below.
The Win9x user modifies the autoexec. BAT file and adds it to the end:
Set java_home = c: \ jdk_1.4.2
Set Path = % java_home % \ bin; % PATH %
Set classpath =.; % java_home % \ Lib \ tools. Jar
You can.

3.

To configure environment variables, follow these steps:
Step 1:
Create java_home
Variable input: C: \ Program Files \ Java \ jdk1.6.0
Step 2:
Create classpath
Variable input:
.; % Java_home % \ Lib \ DT. jar; % java_home % \ Lib \ tools. Jar
Remember that there must be no less than one point.
Step 3:
Edit path
Add the following to the original path:
; % Java_home % \ bin
It must be edited!
Specific operations:
Right-click my computer -- properties -- Advanced -- Environment Variables
Set the variable and enter it.
Note:
Test method: Enter javac In the doc window. If many prompts are displayed, the configuration is successful.

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.