JAVA Open Source Practice 1 - Environmental Configuration
Wuder
Deploy under the WINDOW system
The software you need:
The following software is executed under WINDOW
JDK5.0
Download address: http://java.sun.com/j2se/1.5.0/download.jsp
JDK-1_5_0_01-windows-i586-p.exe
JBoss4.01
Download address: http://prdownloads.sourceforge.net/jboss/
JBoss-4.0.1sp11.zip
MySQL4.1
Download address: http://dev.mysql.com/downloads/mysql/4.1.html
Mysql Server 4.1
MySQL JDBC Driver
Download address: http://mirror.etf.bg.ac.yu/mysql/downloads/connector-j/
MySQL-CONNECTOR-JAVA-3.1.7.Zip
Ant1.6.2
Download address: http://ant.apache.org/
Apache-ant-1.6.2-bin.zip
installation steps
First, install JDK1.5;
Second, install JBoss4.01;
Third, install mysql4.1;
Create a new database:
The command is: CREATE DATABASE PPP Character Set UTF8;
Fourth, unwrapping the Ant, put it in a piece of data;
5. Set the environment variable; (My Computer> Properties> Advanced> Environment Variables> System Variables)
New variables:
ANT_HOME = [Ant location path]
Java_home = [JDK5.0 installation path]
Classpath =% java_home% / lib
Modify the variable:
Path add content, use ";" interval. % ANT_HOME% / bin;% java_home% / bin; [mysql installation path] / bin
6. Place mysql-connector-java-3.1.7-bin.jar (MySQL JDBC DRIVER) in [JBoss Installation Path] / Server / Default / Lib.
Seven, modify JBoss-Service.xml.
DEPLOY
attribute>
change into:
Deploy /, File: / E: / DEP / Web /, File: / E: / DEP / EJB /
attribute>
E: / DEP / Web, E / DEP / EJB is to put the deploy file folder, or you can put it in other places, but you have to set in jboss-service.xml.
Eight, find mysql-ds.xml (location: [JBoss Data Clip] / DOCS / Examples / JCA)
Changed to [JBoss Data Sheet] / Server / Default / Depoy
The content is as follows:
Nine, use Ant Build YYWAP project.
START >> RUN >> CMD (Enter)
The current directory is moved to the YYWAP project folder
The results are as follows:
C: / test / yywap> Ant
Buildfile: build.xml
...... [省略]
Build Successful
Total Time: 1 Minute 42 SECONDS
Ten, put the program to the deploy directory (location in yywap / target)
E: / dep / ejb put in Yyejb.jar
E: / Dep / Web Add Yyweb.war
Eleven, start mysql and jboss.
The starter script is in
[MySQL Path] /bin/mysql.exe
[Jboss] /bin/run.bat
JBoss stop command: shutdown -s
test:
Open Internet Explorer, URL is
Http: // localhost: 8080 / wap / faces / admin / co / listall.do
Deploy under the Linux system
The software you need:
The following software is executed under Linux
JDK5.0
Download address: http://java.sun.com/j2se/1.5.0/download.jsp
JDK-1_5_0_01-linux-i586.bin
JBoss4.01
Download address: http://prdownloads.sourceforge.net/jboss/
JBoss-4.0.1sp1.tar.gz
MySQL4.1
Download address: http://dev.mysql.com/downloads/mysql/4.1.html
Mysql-standard-4.1.10-pc-linux-gnu-i686.tar.gz
MySQL JDBC Driver
Download address: http://mirror.etf.bg.ac.yu/mysql/downloads/connector-j/
MySQL-Connector-Java-3.1.7.tar.gz
Ant1.6.2
Download address: http://ant.apache.org/
Apache-Ant-1.6.2-bin.tar.gz
installation steps
Installing the Linux version is RED HAT 9.0, using user root logins.
First, install JDK1.5;
Run this installer, shell> ./[bin file name]
"More" press Enter, if you choose "Yes" or "NO", type Yes, Enter.
JDK installation location: /usr/java/jdk1.5.0_01
Second, install mysql 4.1; (consult the document unzipped directory install_binary)
Tap the right mouse button to open a terminal window. Enter the following command:
Shell> GroupAdd MySQL
Shell> UserAdd -g mysql mysql
Shell> CD / USR / LOCAL [first put mysql.tar.gz file COPY to / usr / local]
Shell> gunzip
[Unzip, generate a folder with the same name with the tar.gz file]
Shell> ln -s full-path-to-mysql-version-os mysql
After decompression, make soft connection with the data clip with the TAR.GZ file as the name of the name]
Shell> cd mysql
Shell> scripts / mysql_install_db --user = mysql
Shell> chown -r root.
Shell> Chown -R MySQL Data
Shell> chgrp -r mysql.
Shell> bin / mysqld_safe --user = mysql & this command is started with MySQL
Shell> CD [MySQL Path] / bin
Shell> mysql
> CREATE DATABASE PPP Character Set Utf8; New Generation Database PPP
prompt:
Shell> PWD is used to get the current directory
Shell> ls View the content in the current directory
Shell> CD .. Return to the previous point of directory
Shell> CD / WWW / WWW Set the current directory to / www / www
Shell> mysqladmin -u root -p password [mysql new password] reset the mysql password, let you enter the old password
Shell> mysqladmin shutdown Turn off MySQL Service
Third, install JBoss4.01
Unzip, place it to a certain directory
Fourth, unwrapping the Ant, put it in a piece of data;
Shell> tar -vxzf [gz file name]
V. Set an environment variable;
ANT_HOME = [Ant location path]
Java_home = [JDK5.0 installation path]
Class_path =% java_home% / lib
Modify the variable:
Path adds content, with ":" interval. % ANT_HOME% / bin;% java_home% / bin: [mysql installation path] / bin
Steps:
1. Open a terminal window.
2. Determine the current directory to / root, use the shell command CD, PWD is done.
3. Type the command gedit .bash_profile
Shell> gedit .bash_profile
4. Modify .bash_profile, specific path, currently installed.
5. Type the command source .bash_profile so that Linux immediately applies this setting.
Shell> Source .bash_profile
6. Type an Echo $ Path [Environment Variable], you can see if it is valid.
Shell> Echo $ PATH
The contents of the changed .bash_profile file is attached below. The corresponding path should be modified.
# .BASH_PROFILE
# Get the aliases and functions
IF [-f ~ / .bashrc]; then
. ~ / .bashrc
Fi
# User specific Environment and Startup Programs STARTUP PROGRAMS
Java_home = / usr / java / jdk1.5.0_01
Ant_home = / home / wubing / ev / apache-Ant-1.6.2
Mysql = / usr / local / mysql
PATH = $ PATH: $ HOME / BIN: $ java_home / bin: $ ANT_HOME / BIN: $ mysql / bin
Classpath =% java_home% / lib / Tools.jar:% java_home% / lib / dt.jarbash_env = $ home / .bashrc
Username = "root"
Export Java_Home Ant_Home MySQL_HOME PATH CLASSPATH UserName Bash_ENV
6. Add mysql driver jar to place mysql-connector-java-3.1.7-bin.jar (MySQL JDBC Driver) in [JBoss Installation Path] / Server / Default / Lib.
7. Set the mysql data source. Find mysql-ds.xml (Location: [JBoss Data Clip] / DOCS / EXAMPLES / JCA)
Changed to [JBoss Data Sheet] / Server / Default / Depoy
The content is as follows:
Eight, use Ant Build YYWAP project.
The current directory is moved to the YYWAP project folder
SEHLL> CD [YYWAP Path]
Shell> ANT Execute Ant
The results are as follows:
Buildfile: build.xml
...... [省略]
Build Successful
Total Time: 1 Minute 42 SECONDS
Nine, put the program to the deploy directory (program location in Yywap / Target)
Yyejb.jar, yyweb.war placed in [JBoss Data Sheet] / Server / Default / Deploy
Ten, start mysql and jboss.
The starter script is in
[Mysql] / bin /
[Jboss] / bin /
Launch MySQL
Sheel> ./mysqld_safe --user = mysql &
Sheel> ./mysqladmin shutdown
JBoss
Launch Sheel> ./run.sh
Stop: sheel> ./shutdown.sh -s
XI, the result
Under normal circumstances, JBoss start should have no error information. Error is generally
MySQL data source setting is incorrect, (for paying password)
MySQL Driver is not placed in the deploy / lib directory.
MySQL has no new PPP database.
Database changes:
Command: shell> mysql
> show databases;
Should see the database PPP
> USE PPP;
> show Tables;
It should be seen to add some tables. These tables are automatically added when these tables are deploy EJB.
test:
Open Mozilla, URL is
Http: // localhost: 8080 / listall.do