The Java development environment constructs three parts:
1, JDK download, installation and configuration
2, mysql download, installation and configuration
3. Application Server (App Server) download, installation, and configuration
First, JDK download, installation, and configuration:
JDK is the core of the entire Java, including Java Runtime Envir, a bunch of Java Tools, and Java-based class libraries (RT.jar).
Step 1: Download
JDK's common version J2SE (Java2 SDK Standard Edition) can be downloaded from the Sun's Java website to: http://java.sun.com/j2se/downloads.html, we recommend to download the latest version. The current latest version is: J2SE 5.0 JDK.
Step 2: Installation
Download the JDK is an executable installer and perform it. Installation is completed in the installation directory there will be JDK
1.5.0
And jre1.5.0 two folders.
Step 3: Set environment variables
Open "My Computer -> Properties -> Advanced -> Environment Variables -> System Variable", set the following three variables:
Java_home =
1.5.0
Classpath =.
PATH =
E: / Program Files / Java / JDK
1.5.0
/ bin
Note: The value of the ClassPath variable is "." (Excluding quotation marks).
The ClassLoad of the Java virtual machine searches the Class file according to the path set by the classpath. Please note that ClassLoader does not search in the current directory, users who are used to Windows may be unexpected, and Linux users are very clear. For convenience, we set the classpath "." The current directory is included.
Step 4: Environmental Test
1. Edit:
Edit the following with any text editor: HelloWorld.java file
Public class helloworld {
Public static void main (String [] args) {
System.out.println ("Hello World!");
}
}
2, compile:
Open the console and switch to the directory where the file is located, type:
Javac HelloWorld.java
If compiled, there is no display on the screen. Otherwise, there will be an error message on the screen.
3, run:
Enter: Java HelloWorld
Screen output: Hello World! Description runs successfully! JDK environment has been successful!
Second, MySQL download, installation and configuration
Step 1: Download
MySQL is a very good open source database management system you can get from its official website: http: //dev.mysql.com/downloads/index.html page has a variety of downloads, I suggest you download the latest version (but Don't download the beta version). The installation and non-installation (ZIP packages) on the website are available, and we use the installation version as an example.
Step 2: Installation
The installation version provides an executable, double-click to complete the installation.
Step 3: Test
Under the bin directory (my E: / Program Files / MySQL / MySQL Server 4.1 / bin) found winmysqladmin.exe, double-click to run, and make the first registration. After setting, run "cmd", change the directory to the bin directory, run mysql -u root -p, enter your password (default empty) into MySQL. Enter Show Databases; if you see: --------
| Database |
--------
| mysql |
| Test |
--------
2 rows in set (0.02 sec)
So congratulations, MySQL has been installed successfully.
Third, the application server (App Server) download, installation, and configuration
App Server is a platform running Java Enterprise Components that forms the main operating environment of the application. The current mainstream App Server is the WebLogic Server and IBM's WebSphere and free JBOSS. Tomcat is not a real app server, it is just a web container that can support running ServerT / JSP, but Tomcat has expanded some of the App Server features. Tomcat is very widely used in small and medium-sized Java web applications, which is the preferred App Server Getting Started with Java. Let's take Tomcat, JBoss as an example to describe its installation configuration.
Tomcat
Step 1: Download
Tomcat is a subproject under the Apache organization Jakarta project, its download address is: http://jakarta.apache.org/site/binIndex.cgi page has various versions of downloads, etc. It is recommended that you download the latest version. The installation and non-installation are available on the website, you can download it according to the situation. We use the installation version as an example.
Step 2: Installation
The installation version provides an executable, double-click to complete the installation.
Step 3: Set environment variables
Open "My Computer-> Properties -> Advanced -> Environment Variables -> System Variables", Set Environment Variables: Catalina_Home = E: / Program Files / Apache Software Foundation / Tomcat 5.5 (Your Tomcat Installation Directory, I am I am Take an example)
Fourth: Test Tomcat
After Tomcat starts, the 8080 port is used by default, so you can use your browser to access http: // localhost: 8080 to test whether Tomcat is started normally. If you see the picture as shown below, congratulations, the installation is successful!
Note: If you are careful, you may find that the input of my browser address bar is:
Http: // localhost: 9090, yes, I change Tomcat's default port to 9090 (of course, I want to give it to it, you said!), 8080 port I left JBoss. Locate Server.xml under the Tomcat installation directory, in which you can set the port and work (virtual) directory.
Find the following configuration file port = "8080", that is, where you set the port:
Unpackwars = "true" autodeploy = "true" Xmlvalidation = "false" xmlnamespaceaWare = "false"> ...... Host> If I want to set my virtual directory / myjsp, point to F: / Soft / JSP, add the following configuration in host>: Reloadable = "true" crossText = "true"> Context> Step 5: Test the JSP MYSQL database joint 1, download MySQL's JDBC drive: In http://www.mysql.com/products/connector/J/Page You can find the downloadable version of the available version, currently: mysql-connectionctor-java- 3.0.16 -ga-bin.jar; 2, copy him to Tomcat's CommON / lib directory; 3, whether the test is connected to normal; save the following code into Test.jsp to Tomcat WebApps / root directory: <% @ Page ContentType = "text / html; charset = GB2312"%> <% @ Page Import = "java.sql. *"%> <% Class.forname ("org.gjt.mm.mysql.driver"). NewInstance (); String Url = "JDBC: mysql: // localhost / mysql? User = root & password = Your mysql root user password & useunicode = true & characterencoding = 8859_1"; Connection conn = drivermanager.getConnection (URL); Statement Stmt = Conn.createStatement (ResultSet.Type_Scroll_Sensitive, ResultSet.concur_Updata); String SQL = "SELECT * from User"; ResultSet RS = Stmt.executeQuery (SQL); while (rs.next ()) {%> Your first field content is: <% = rs.getstring (1)%> Your second field content is: <% = rs.getstring (2)%> <%}%> <% out.print ("Database Success, Congratulations");%> <% rs.close (); Stmt.close (); CONN.CLOSE (); %> body> html> 4, if you are running, you will see "Success, congratulations, congratulations", congratulations, test success! JBoss Step 1: Download JBoss is a free J2EE server, which makes J2EE from the noble hall to the ordinary people's home, listed several versions of the download address in http://www.jboss.org/downloads/index#s, recommend you to download the latest version. Step 2: Installation, configuration, start Unfaze the compressed files you downloaded to the appropriate location of the machine (but must pay attention to the record without space, as I started at E: / Program Files / JBoss 4.0.0 In the event of an error), the batch command in the bin directory (Windows is run.bat Linux is run.sh) to start JBoss. The following information indicates that the JBoss server is successful (very clearly, since the time of the starting JBoss and the configuration of the target machine, the value given is different): 11: 29: 39,944 Info [Server] JBoss (MX Microkernel) [ 4.0.0 (build: cvstag = jboss_4_0_0 date = 200409200418)] Started in 1M : 18s: 941ms Information when my machine starts: The JBoss default port is 8080, entered in the browser: http: // localhost: 8080 will appear as follows: Step 3: Test jboss and mysql connection Copy the MYJSP.WAR folder in JBoss's Server / Default / Deploy, copy the test.jsp file that test Tomcat and MySQL to myjsp.war, enter: in the browser: Http: // localhost: 8080 / myjsp / test.jsp If you are running, you can see "Successful, congratulations, congratulations", congratulations, the test is successful! At this point, the Java development environment is successful, starting your Java tour! ! !