Setting JSP environment variables for beginners

Source: Internet
Author: User

The following describes how to set JSP environment variables.

First, download the jdk from the Sun website. The current version is ipv5_0_06 (other versions are also supported)

The final download file is jdk-rj5_0_06-windows-i586-p.exe.

Double-click jdk-rj5_0_06-windows-i586-p.exe to start Installation

The default installation path is C: \ Program Files \ Java \ jdk1.5.0 _ 06. You can also change the path, but remember the last path selected, when setting JSP environment variables, we also need to use the suggestion c: \ jdk, which is easy to do. For my personal opinion, haha). After jdk is installed, jre will be installed, installed together.

After the installation is complete, we can start to set JSP environment variables. Right-click my computer, select Properties, advanced, environment variables,

Click new in the system variable column. The new system variable dialog box is displayed.

Enter JAVA_HOME in variable name (N ).

Enter the path you selected when installing jdk in variable value (V), as shown in (click to enlarge ):

After confirming, create an environment variable in the system variable column (S ).

Enter CLASSPATH in variable name (N)

Fill in the variable value (V)

.; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jar

Find and select the Path option in the system variable (S) column, click Edit

Add at the end of variable value (V)

; % JAVA_HOME % \ bin;

Confirm and exit. So far, our JSP environment variables have been set.

You can compile a JAVA applet to test the following. Open notepad, enter the following applet, and save it as HelloWorld. java.

 
  1. public class HelloWorld {   
  2.     public static void main(String[] args) {   
  3.         System.out.println(”Hello, World!”);   
  4.     }   
  5. }  

Run cmd, go to the directory where HelloWorld. java is located, and run

 
  1. javac HelloWorld.java   
  2. java HelloWorld  

If you can output Hello, World! The environment variable is successfully set.

If an error occurs, check whether the HelloWorld. java program is entered incorrectly until the environment variable is set successfully.

Here, let me talk about what I did wrong at the beginning. I hope you will pay attention to it.

Errors frequently made by beginners when setting JSP Environment Variables

1. The. class suffix is included in the runtime.

If you try to use the following command:

E: \ java \ src> java HelloWorld. class

The system will mistakenly believe that you are running a class file named class under the HelloWorld package, and will usually include the current directory under the system CLASSPATH) in an attempt to find HelloWorld. class. such a class does not exist, and it cannot exist because the class is a keyword and cannot be used as a class name. The following error message is reported:

Exception in thread "main" java. lang. NoClassDefFoundError: HelloWorld/class

2. Incorrect file name case

For systems like Windows, the Case sensitivity is not concerned during compilation. For example, when compiling HelloWorld. java, you can also use:

E: \ java \ src> javac helloworld. java

It can also be compiled, but the generated class file is still consistent with the source file: HelloWorld. class.

Note the case sensitivity when running, for example, try to run the following command:

E: \ java \ src> java helloworld

An error similar to 1 will be reported:

Exception in thread "main" java. lang. NoClassDefFoundError: helloworld (wrong name: HelloWorld)

3. The file name must be the same as the class name! It took me half an hour to debug the error ~

4. enter ".;" in the CLASSPATH system variable value. % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jar "(excluding double quotation marks), please note that the leftmost is a point !!!!! Don't miss it !! 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 ), are you satisfied with your friends?

  1. Introduction to several open-source JSP development frameworks
  2. Introduction to JSP development framework FastJSP
  3. Comparison between JSP development framework and Servlet-based Tapestry
  4. Learning the basic concepts of JSP: Nine implicit objects
  5. JSP data paging instance: MySQL Paging

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.