Preface
Java is one of the most popular languages at present. As a mathematics student, there is also an elective course of Java. Now, I decided to start from scratch, struggle for five months, and advance from Xiaobai to master various Java basics. Intellectual-great white.
This article is the first blog, explaining some related knowledge of java introductory (now learning and selling), and some frequently encountered problems (maybe my food).
1. Install JDK and Eclipse & NetBeans
1.JDK
Not much to say about JDK, give a link- click here and
give another link, https://www.oracle.com/java/technologies/javase-downloads.html-click to open
2. Eclipse download and installation
The editor used here is Eclipse. (I have also used NetBeans and downloaded both, but I feel that NetBeans is not as cool as this one-personal preference)
This is the Eclipse download URL
https://www.eclipse.org/downloads/packages/release/helios /sr2/eclipse-ide-java-ee-developers
select the appropriate operating system, then download it, you can download it directly, but it is slow.
The above chain is the link given by the teacher. I tried the download speed and it was slow. I went to the official website and found a new link. The download speed was more than ten times faster.
2.1 The download URL of the quick link is as follows
https://www.eclipse.org/downloads/
Click here to open the link After
opening the link, click here
and then select the version to download according to your computer system
Click here to download.
This software does not need to be installed, it can be used directly by unzipping it. Click on the exe file in the folder and found that the JDK is missing, but we have already downloaded the JDK. The reason for the error is the configuration of environment variables.
3. NetBeans installation
https://www.apache.org/dyn/closer.cgi/netbeans/netbeans/12.1/Apache-NetBeans-12.1-bin-windows-x64.exe
click here for the
latest NetBeans 12.1, for installation, only used before Eclipse, now install it for use.
Two, configure environment variables
Since the system has already installed the corresponding JDK program when the database was installed before, modify the variable value directly and change it to the newly downloaded JDK.
If it has not been configured, you need to add CLASSPATH and add the bin path under its download directory to path.
See blog:
JDK installation and path configuration
Three, use Eclipse to write a simple Helloworld program
1. First, create a project.
File–> new --> project
2. Second, create a class file
Under the new project, find src, and create a class file in it.
Note that the new version of Eclipse must have a package to create a valid class file. We need to create a package first, otherwise an error will occur.
I didn’t know this at the time and it took a long time to debug this bug (my dish)
3. Write the program
package try_a_package;
public class hello_world_class {
public static void main(String[] args)
{
System.out.println("Hello Wor\nld");
}
}