J2SE configuration problems-; expected error summary, j2seexpected

Source: Internet
Author: User

J2SE configuration problems-; expected error summary, j2seexpected

The J2se installation process is very simple. Just like installing the software, double-click it and then click Next until the end. In this process, you must remember the installation path of the software to facilitate subsequent search.


Step 1: Create a New. TXT text file and save it as a HelloWorld. java file. Write code in the file:

Public Class HelloWorld{         Publicstatic void main(String [] args){         System.out.println(“HelloWorld”);}}
Note: In this code, you must see what each letter is. I was writing the code in the video, and I found a problem. I don't know if someone else found it. That is, the l in the println is regarded as an I (I) in upper case ), as a result, after the path is successfully configured, an error is reported: ";" expected. This error is also one of the three major errors of java. It is a very typical one. I have encountered and learned this long ago.

Step 2: Understand the respective roles of java and javac. Javac + ***. the java file is compiled, and java + *** is the java file compiled by j. You must use the javac + file path during compilation, for example:


If the path is not configured, the error javac is not an internal or external command. Next, we need to configure the path to clarify what is written in the path, so let's compare it with an example:


During this operation, I wrote the javac path + HelloWorld. java file, and finally compiled successfully. However, it is impossible for us to write the javac path every time we call javac, which is too troublesome. Therefore, we need to set the javac path in the environment variables, when the system calls javac, the environment variable automatically goes to this path to find the existence of javac and then runs.

After understanding this, it is easy to configure the environment variables: Right-click my computer and choose "properties"> "Advanced Settings"> "System Properties"> "environment variables"> "system variables"> "path"> "edit, add the path where javac is located. This is the path to be remembered during installation.


In this way, the path is configured. However, this is only a compilation process and a running process. Therefore, you need to configure the classpath path. After the java file is compiled, you need to use the java + file path to run it, the file path is also involved here. Similarly, we cannot write the path every time during the call, so we need to configure classpath, which adds the path of the compiled class file, same as above:


In this case, you can run the following code:


This process is neither difficult nor especially difficult. The key is to carefully and boldly try it out. I used configuration most of the time yesterday. I watched the configuration video countless times, which gave me a thorough understanding of the configuration principle. Finally, with the help of Kun Ge, finally, I was changed to l, and the end was reached.

I was given a break-down when I was a beginner in java, but at last I came over, and through this process, I experienced various stages of irritability, anxiety, and tightness, it's also an exercise for yourself. You have a right attitude and you have never been unable to cope with it.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.