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.