I'll do the following: Install the JDK, install Tomcat, install MySQL, install eclipse, write Java programs to access MySQL, install the Java Web Rapid development platform WebBuilder. Record the main process.
1 Installing the JDK
Download the latest jdk1.8.0_25; install, all the way next. Upon completion, as
2 Installing Tomcat
Download Tomcat 6.0.32 and unzip it. If you downloaded the installation version, perform the installation.
3 JDK and Tomcat environment variable configuration
Right-click My Computer, Properties-Advanced system settings-environment variables;
New system variable name: java_home, variable value: D:\Java\jdk1.8.0_25
Open the Path variable and add the variable value:%java_home%\bin;%java_home%\jre\bin
New variable name: CLASSPATH, Variable value:.; %java_home%\lib\dt.jar;
%java_home%\lib\tools.jar
Represents the current path,%java_home% is referring to the previously specified java_home;
Java_home indicates the JDK installation path, which includes folders such as LIB,BIN,JRE,
This variable is required to run tomcat,eclipse and so on.
Path allows the system to identify Java commands under any path.
Classpath is the Java load class or lib path, only the class is in Classpath and the Java command is recognized.
Close the System Properties window after completion, open cmd, enter java-version, the following prompts indicate that the JDK is installed;
Tomcat environment variable configuration:
New variable name: catalina_base, variable value: D:\apache-tomcat-6.0.32
New variable name: catalina_home, variable value: D:\apache-tomcat-6.0.32
Open path, add variable value:%catalina_home%\lib;%catalina_home%\bin
The Environment Variable Configuration window is shown below, and the values of each environment variable are separated by semicolons;
Under Tomcat's Bin directory, double-click Startup.bat to start Tomcat, and run up with a command-line window;
Open the browser, enter http://localhost:8080 carriage return in the address bar, and if you see a JSP page with a kitten on it, your JDK and Tomcat have been successfully built.
4 Installing MySQL
After downloading, double-click Mysql-essential-5.0.87-win32.msi to install. After the installation process finishes, finish, enter the Configuration wizard.
The default port is 3306 on the next interface;
Check the Include Bin Directory in Windows PATH at the following interface to facilitate later operation;
Enter the root password;
Next, complete the installation configuration.
Open the MySQL command line Client from the Start menu, enter the password entered during installation, enter the show databases command to display all databases, use test, create a
Table person; Insert three rows of data; for later testing;
5 Installing Eclipse
Download Eclipse-jee-luna-sr2-win32.zip, unzip can. Start Eclipse, set the working path, and then set it to D:\Users\Administrator\workspace.
6 Writing a Java test program to access MySQL
Create a new project in Eclipse, project type choose Java Project, enter the project name Testmysql. In the Package Explorer, right-click the SRC node under Testmysql, New-class, in
Enter the class name MYSQL1 in the New Java class, and type the following code;
Right-click Mysql1.java,run As-java Application, if there is no JDBC driver for MySQL, the following error will occur:
Java.lang.ClassNotFoundException:com.mysql.jdbc.Driver
Download Mysql-connector-java-5.0.4-bin.jar; Right-click Mysql1.java,build path-configure build Path in Java Build Libraries options for the Path Properties dialog box
Card, Add External JARs, select the downloaded Mysql-connector-java-5.0.4-bin.jar, OK.
Run again, there are two errors; first, the ResultSet column number in Java starts with 1; the correct statement is as follows;
System.out.println (rs.getstring (1) + "\ T" +rs.getstring (2) + "\ T" +rs.getstring (3));
The second one, the Chinese character output is a question mark, the modified code is as follows, the correct output from the database to the results;
7 writing JSP pages to access MySQL
Copy Mysql-connector-java-5.0.4-bin.jar to the Lib directory of Tomcat, note that Mysql-connector-java-5.0.4-bin.jar if it is copied to Tomcat's lib directory after Tomcat boot, it needs to be Start Tomcat.
Manually edit the text file, enter the following code, named Testmysql.jsp, put into Tomcat's Webapps\root directory, enter http://localhost:8080/testmysql.jsp in the browser, and display as follows:
Code download for 6 and 7:
Http://pan.baidu.com/s/1c0vp3TQ
8 Installing Java WebBuilder
First enter the WebBuilder homepage;
http://www.putdb.com/
Registered. There is an online use function on the homepage, but only the IDE interface can be seen after entry, the actual cannot be used; Download WebBuilder.
An installation
Unzip the downloaded installation package webbuilder.zip, and copy the WB directory to TOMCAT6/WEBAPPS/WB, as follows;
Create the Meta-inf directory under the TOMCAT6/WEBAPPS/WB directory (note the Web-inf and Meta-inf directories), And in the Meta-inf directory to create the context.xml file, context.xml file content as follows:
<?xml version= "1.0" encoding= "UTF-8"?
<! DOCTYPE context>
<context reloadable= "true" crosscontext= "true";
<watchedresource>web-inf/web.xml</watchedresource>
<resource
name= "Jdbc/wb_mysql"
auth= "Container" type= "Javax.sql.DataSource"
Driverclassname= "Com.mysql.jdbc.Driver"
url= "jdbc:mysql:// 127.0.0.1:3306;databasename=test "
username=" root "password=" 123 "
maxactive=" maxidle= "maxwait="-1 "/>
</context>
Database name, password, etc., modified according to the actual situation. Different databases, SQL Server, Oracle, etc., the above file content slightly different, access to relevant information.
The MySQL JDBC driver jar package has been copied to the Tomcat6/lib directory in step 6th, and if necessary reboot Tomcat;
Open the browser and access [HTTP://IP:PORT/WB] (such as HTTP://LOCALHOST:8080/WB), and then use the Installation Wizard to complete the installation of the WebBuilder, for the installation after the successful;
Note: In Jndi, the name line in Context.xml, such as Jdbc/wb_mysql input as Jdbc/mysql, will be faulted: "Name ODBC is not bound in this Context";
A wb.xml appears under Tomcat's Conf\catalina\localhost folder during installation, with the same content as the previous context.xml, and the "No suitable driver" prompt appears, Try renaming wb.xml to Wb_mysql.xml to see if it's resolved.
Schematic Java Development Tutorials