Ubuntu Linux 8.04 system JAVA environment configuration method

  

1, first install JDK


java6 Enter apt-get install sun-java6-jre sun-java6-jdk at the command line to choose whether to install Jre


java5 Enter apt-get install sun-java5-jre at the command line sun-java5-jdk


Multiple jdk can be installed at the same time, and you can change the current at any time. Default jdk


Enter sudo update-alternatives --config javac at the command line to change the current default jdk


sun-java5-doc and sun-java6-doc are Jdk documentation installer, but does not include jdk documentation.


Before installing the jdk document, you must download the jdk file from the sun website. The document you downloaded can be any language, including Chinese. For example, if you install jdk5, you should store the downloaded file in /tmp/jdk-1_5_0-doc.zip before installation. For example, if you install jdk6, you should install it. Save the downloaded file to /tmp/jdk-6-doc.zip. Of course, you can also do this before the installation, because the installation process will prompt you to do so, please pay attention to the terminal window prompts.


Write environment variable gedit /etc/environment

Add JAVA_HOME=/usr/lib/jvm/java-6-sun in the editor

< BR>classpath does not have to be configured, the wrong classpath will cause many problems. Jvm will know the classpath that comes with it. For the custom classpath, you can specify it by running the compile time with the -classpath parameter. As for environment variables, it is not too late to specify when you need to write a program.


To make the configuration take effect, you must enter it at the command line. /etc/environment


If you need Also modify the priority order adjustment of the system virtual machine: sudo gedit /etc/jvm


jdk installation is complete, enter java -version in the terminal to see if the installation is successful (or directly enter java)


2, install


Download the green from the tomcat official website, after downloading, run the startup.sh in the bin directory


in the browser Enter http://localhost:8080 to see if tomcat is started


To close tomcat, just run shutdown.sh in the bin directory.


If you need tomcat boot, you can refer to it. Here's how:


Modify the /etc/rc.local file gedit /etc/rc.local Add


JAVA_HOME=/usr/lib/jvm/java-6- Sun

CLASSPATH=.:/usr/lib/jvm/java-6-sun/lib

JRE_HOME=/usr/lib/jvm/java-6-sun/jre

export JRE_HOME

export CLASSPATH

export JAVA_HOME

/home/allenwei/Tomcat/apache-tomcat-6.0. 14/bin/startup.sh //You put the tomcat directory


Modify /etc/profile Enter gedit /etc/profile and add the following line:

JAVA_HOME=/usr/Lib/jvm/java-6-sun

CATALINA_HOME=/home/test/Tomcat/apache-tomcat-6.0.14

export JAVA_HOME CATALINA_HOME


Reboot After the system, tomcat can be started with the boot


3, install mysql


first sudo apt-get install mysql-server mysql-client

< BR>Enter sudo /etc/init.d/mysql start after installation. Start mysql


You need to change the password of root at this time


Check the default password and enter sudo gedit /Etc/mysql/debian.cnf In the [client] section you can see the username and password


Enter mysql -uroot -p login, prompt for the password, enter the password in the debian.cnf file


Change password input GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "The password you want to modify"


The installation of mysql is now complete


You can also install mysql's graphical management tool sudo apt-get mysql-admin mysql-query-brows Er


4, eclipse and netbeans installation is very simple, download the deb package from the official website, install it.

Copyright © Windows knowledge All Rights Reserved