The Web development environment constructs Eclipse-java EE Chapter
"Original content, reproduced note name source"
1. Download and install 1.1 download JDK
Download the latest version of Java se:http://www.oracle.com/technetwork/java/javase/downloads/index.html on the official Java website
Now the computer is basically 64-bit, so all references to download resources, if there are 64-bit, it is recommended to download the 64-bit version.
1.2 Downloads Java EE Latest version: http://www.oracle.com/technetwork/java/javaee/downloads/index.html1.3 Install JDK:
Perform the downloaded JDK installation package installation. After the installation is complete, you can check the installed JDK version by entering the following command at the command line.
Java-version
If the installation is OK, the following results are displayed:
Note: The new JDK installer typically automatically sets environment variables, and if CMD execution fails above, set the environment variables manually:
Environment variable Setting method:
Open My Computer---> Properties panel, select Advanced System settings.
Select environment variables,
In the system variable this block is set:
To create a new system variable:
Variable name: "Java_home"
Variable value: "C:\Program files\java\jdk1.7.0_51"
Special Note: My JDK is installed in this location C:\Program files\java\jdk1.7.0_51 so just fill this out, where your own JDK is installed, just fill it out!
Locate the path selection editor in the system variable:
At the end add "\;%java_home%\bin;"
Special note: In the last add, do not put the default delete Oh! If deleted, your part of the program will not be able to run Oh!
1.4 Downloads Eclipse
Open http://www.eclipse.org/downloads/eclipse-packages/, download Eclipse IDE for Java EE developers (now generally all download 64-bit)
Once the download is complete, unzip the Eclipse EE package to any location (it is recommended to put all of Java's things into one root directory, such as mine:)
In fact, you can also not download Eclipse, and use the Java official web that NetBeans IDE, NetBeans provides simplified Chinese version. ^_^
1.5 Installing Java EE
Unzip the downloaded Java EE and run the \glassfish4\bin\pkg.bat, enter Y and then wait to complete the installation when prompted to install input <y/n>.
1.6 Installing Tomcat
Go to the official website (http://tomcat.apache.org/) and download the latest version of Tomcat 9 directly.
After the download is complete, unzip the package into the Java installation directory in Tomcat.
2. Configure and start using 2.1 to run Eclipse Java EE.
2.2 Setting up Tomcat
In Eclipse, click the menu bar window->preferences, click Server/runtime environments:
Click the "ADD" button to create a new server. We've installed Tomcat 9.0 before, so choose it here too.
Click "Next" to proceed to the next step.
Enter the Tomcat installation directory in the text box under Tomcat installation directory and click "Finish" to complete the configuration.
2.3 Setting the default character set
In Eclipse, the current operating system's character set will be used by default, typically GBK. However, when we develop Web applications, we typically use UTF-8. So you need to set the default character sets.
In Eclipse, click on the menu bar window->preferences, click General/workspace:
Select Other:utf-8 in the Text file encoding area. This way we will use the UTF-8 character encoding by default when we create a new project.
2.4 Setting the Build Path
When developing a Web application, Tomcat is needed, and we want to add Tomcat/lib to the compilation path. Otherwise, you will get the following error when creating the JSP:
The superclass "Javax.servlet.http.HttpServlet" is not found on the Java Build Path
In Eclipse, click the menu bar window->preferences, click Java/build path/classpath Variables:
Click "New" to create a new variable named "Tomcat Server", set path to the Lib directory in the installation location of Tomcat (as shown) and click on the "OK" button.
Next, add the User Libraries. Click Java/build path/user Libraries:
Click on the "New ..." button to create a new user Libraries named Tomcat Server. Then click on the "Add External JARs ..." button to select all the jars that we installed and use under Tomcal/lib (Ctrl + A) and OK. When done, as shown.
Click "OK" to complete the setup.
2.5 Hello World
Each time the development environment, write a "Hello World" and successfully displayed, the mood will naturally become comfortable.
In Eclipse Java EE, right-click in the blank area of Project Explorer on the left, and then tap new->dynamic Web Project:
Click "Finish" to finish.
Then right-click on the WebContent, and in the context menu, tap "new->jsp File" to create a new index.jsp page.
Double hit Open index.jsp, prompt error, this is exactly what we said earlier, also configured the Build Path. So now we're going to use the set Build path/user Libraries.
On the project manager's HELLOWORKD project root, right click on "Properties". Then, in the Project Properties dialog box that pops up, click "Java Build Path" and switch to the Libraries tab.
Click on the "Add Library ..." button:
Double click on "User Library", in the pop-up Add Library dialog box, select "Tomcat Server" and click "Finish" button.
Then switch to the Order and Export tab and select Tomcat Server. Complete the setup.
As you can see, the errors in the code are gone.
At this point, our Eclipse Java EE chapter is over.
The Web development environment constructs Eclipse-java EE Chapter