DOC

JavaEEdevelopmentenvironmentsetup

By Carolyn West,2014-05-15 18:17
7 views 0
JavaEEdevelopmentenvironmentsetup

Java EE development environment setup:

    1.Installations

    Java SDK 1.6

    Eclipse 3.6 + WTP (MyEclipse 7)

    MySQL (MySQL Cluster and MySQL Workbench)

    To the zipped mysql packet: Unzip the mysql packet to the target location. And then run

    %MYSQL_HOME%\bin\ mysqld.exe to startup the database service.

    To the installation version: run the install packet and start the windows service of mysql.

    Tomcat 7

    2.Configurations

    Configuration for Java SDK:

    Add JAVA_HOME and CLASSPATH into environment variants list of the development machine. The JAVA_HOME is the root path of Java SDK after installing. CLASSPATH should contain the necessary libraries in Java SDK. For example: if the Java SDK was installed in the path of C:\Java, Then the JAVA_HOME should be C:\Java, also JAVA_HOME=”C:\Java”. The CLASSPATH should be “.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar”.

    Configuration for Tomcat Web Server:

    Add environment variants for Tomcat 7 Web Server. After installing Tomcat 7 Web Server, it necessary to add CATALINA_HOME, CATALINA_BASE into the environment variants list. CATALINA_HOME is the same to CATALINA_BASE; they are both the root path of Tomcat installation.

    Prepare configuration for a specific web application in Tomcat:

    Add a context file into the directory of %CATALINA_HOME%\conf\catalina\hostname(e.g. localhost). The context file represents a virtual directory or a single web application. The file name would better be the same to the name of application. The simple content could be set as below (Table 1). The path is the root directory of the application. docBase is the physical directory of the application. Reloadable means if the Tomcat container would monitor the changing of lib directory. The context also can be put into %CATALINA_HOME%\conf\server.xml file. But if you do that, the Tomcat container could not reload and unzip the WAR file automatically when there is something changed. It means that you should reboot the Tomcat to meet the update.

    Table . The sample configuration of context file

    

    

    reloadable="true">

    Prepare the configuration for running mysql server:

    Having installed or unzipped the mysql packet, there are several configuration files in %MYSQL_HOME% directory. Select one according to the memory of your machine and rename it to my.ini. Configuration for the connection pool in tomcat container:

    Modify the context settings in %TOMCAT_HOME%\conf\catalina\hostname (e.g. localhost) directory. Add a sub node under context node, the code below (Table 2) is the sample code:

    Table . Sample code for connection pool setting

    

     auth="Container"

     type="javax.sql.DataSource"

     driverClassName="com.mysql.jdbc.Driver"

     maxIdle="20"

     maxWait="5000"

     user="root"

     password=""

     url="jdbc:mysql://localhost:3306/test"

     maxActive="100"

     removeAbandoned="true"

     removeAbandonedTimeout="60"

     logAbandoned="true">

    Additionally, it is necessary to perform some modification in web.xml. Below (Table 3) is also the sample

    code:

    Table . Sample code for connection pool setting in web.xml

    

     DB Connection

     jdbc/todolilst

     javax.sql.DataSource

     Container

    

Configuration for the remote debug with tomcat:

    Find the catalina.bat file in %CATALINA_HOME%\bin\, and open it using notepad. Add the code below into the file, after a number of comment lines.

    Table . Remote debug parameters for tomcat

    SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE

    -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5888

    The code above will set value to CATALINA_OPTS, so the value should be set before it is used. You can set the address to any other non-conflict port; despite the address is 5888 in this sample code. After doing that,

Report this document

For any questions or suggestions please email
cust-service@docsford.com