Linux (iv) _ creation of javaee development environment, linux _ javaee
I. VMware tools
Use VMware tools to share files between hosts and VMS.
RememberRestartYou can copy and paste files between the local machine and the virtual machine.
2. Build a java environment:
Generally, openjdk is pre-installed in linux. uninstall it first.
1. Download The dk-8u5-linux-x64.tar.gz file. The tar.gz format is only a compressed package. Therefore, you only need to decompress the package to the corresponding path.
2. Open and edit the profile file as root
Vi/etc/profile
3. Set Environment Variables
JAVA_HOME =/home/xiangkejin/software/jdk1.8.0 _ 05
JRE_HOME = $ JAVA_HOME/jre
PATH = $ JAVA_HOME/bin: $ JRE_HOME/bin: $ PATH
CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar: $ JRE_HOME/lib: $ CLASSPATH
Export JAVA_HOME JRE_HOME PATH CLASSPATH
4. Make the environment variable take effect immediately. Enter the command: source/etc/profile
5. Check whether the installation is successful.
Enter the command: java # Check the jdk bin Environment
Enter javac # To check the jdk classpath environment.
References
But now there areProblem:
Each time you enter the system, you must enter source/etc/profile.
Solution:
In ~ /. Add the source/etc/profile statement to the bashrc file.
Note that the modification in the. bashrc file is only valid for the current account, and/etc/profile is valid for all accounts.
3. Install eclipse
Directly copy eclipse-java-luna-sr2-linux-gtk-x86_64.tar.gz to/home/xiangkejin/software,
Decompress the package (character operation: Installation command of the tar.gz file:Tar-zxvfFile Name .tar.gz)
Open the terminal Console
After entering the eclipse File
./Eclipse
However, an error is reported during running:
A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. no Java virtual machine was found after searching the following locations:/home/wrm/Desktop/eclipse/jre/bin/java in your current PATH is not found in jre, the solution is to enter the/home/xiangkejin/software/eclipse directory and create
Soft connection, Connect to jre,
Ln-s/usr/local/software/jdk1.8.0 _ 05/jre
Supplement: What is soft connection?
Soft links in linux are similar to shortcuts in windows.
Ln-s a BIn "a" is the source file, and "B" is the link file name. Its function is to access the "B" directory, but the link actually enters the "a" directory.
For example, when we enter/home/xiangkejin/software/eclipse/jre, it actually enters/usr/local/software/jdk1.8.0 _ 05/jre.
There was no jre in eclipse. Now the shortcut icon is added and you can click to access jdk/jre.
4. Install myeclipse: Same as above
5. install tomcat
Decompress apache-tomcat-8.0.39.tar.gz to specify the file
In sh/tomcat/bin/startup. sh
In this case, we can use http: // ip: 8080 for access in windows. If the home page of Tomcat is displayed, no operation is required,
If it cannot be displayed, open the firewall's port 8080 in Linux.
CentOS 7.0 uses firewall as the firewall by default. Here, it is changed to iptables firewall.
1. Disable firewall:
Systemctl stop firewalld. service # stop firewall
Systemctl disable firewalld. service # disable firewall startup
2. Install iptables Firewall
Yum install iptables-services # Installation
Vi/etc/sysconfig/iptables # edit the firewall configuration file
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
* Filter
: Input accept [0: 0]
: Forward accept [0: 0]
: Output accept [0: 0]
-A input-m state -- state ESTABLISHED, RELATED-j ACCEPT
-A input-p icmp-j ACCEPT
-A input-I lo-j ACCEPT
-A input-m state -- state NEW-m tcp-p tcp -- dport 22-j ACCEPT
-A input-m state -- state NEW-m tcp-p tcp -- dport 80-j ACCEPT
-A input-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT
-A input-j REJECT -- reject-with icmp-host-prohibited
-A forward-j REJECT -- reject-with icmp-host-prohibited
COMMIT
: Wq! # Save and exit
Systemctl restart iptables. service # restart the firewall to make the configuration take effect.
Systemctl enable iptables. service # Set firewall startup
In this way, you can enter http: // ip: 8080 for access in windows.
Vi. Test
Use myeclipse for development below:
Configuration:
1. Configure the tomcat server first.
2. Configure jdk
3. Write a jsp page and publish it.
4. Access