Install JDK in fact only need to get two problems, the installation directory and configuration files. If you only want to quickly install the JDK, please skip this section and look at the installation. Analysis articles Analysis of the online installation JDK data in the installation directory basically two kinds of — — /opt and /usr /local. It doesn't matter where these two directories are installed, but in the past Linux people used to install the software in /usr/local. The /opt directory is recommended here. Configuration File Analysis Many people on the Internet mentioned the four configurations of /etc/environment, /etc/profile, /etc/bash.bashrc, and ~/.bashrc. Where should the JDK environment variables be placed? The meaning of each configuration file /etc/environment: Set the environment of the whole system, regardless of the login user /etc/profile: Each user of the system sets the environment information. When the user logs in for the first time, the file is executed and from /etc/Collect the shell settings in the configuration file of the profile.d directory /etc/bash.bashrc: Execute this file for each user running the bash shell. When the bash shell is opened, the file is read. ~/.bashrc: The file contains bash information specific to the bash shell of the logged in user. When logging in and every time a new shell is opened, the file is read. Effective time of each configuration /etc/environment: Restart takes effect /etc/profile: Log in after logging out Effective /etc/bash.bashrc: Take effect after reopening the bash shell ~/.bahsrc: Effective after reopening the bash shell For installing JDK, the JDK environment variable is definitely related to the user, so /etc/environment is not very good. Suitable, and the user may be more than one, so ~/.bahsrc is not suitable. My first thought was to configure the JDK environment variables in /etc/profile. However, this encountered a small problem. After the configuration is completed, log in to the system and log in. For the normal user java environment variable, the java environment variable is not available after sudo su obtains root privileges. As shown below:
Check the information, you can su – root will not take effect until you switch to the root user. As shown below:
If you log in as root at this time, run java -version to see the JDK environment variable is valid. I suspect that sudo su has root privileges, but the root user is not logged in, so the root user does not execute /etc/profile. There is also man su, “-” means "to make the shell a login shell". In addition, if the JDK environment variable is configured in /etc/bash.bashrc, if the java program is not started in the shell, such as eclipse, then the JDK environment variable cannot be read, resulting in failure to run. After the above analysis gives the solution: JDK is also configured in /etc/profile and /etc/bash.bashrc Installation articles First, download the JDK installation file 32-bit system, please download jdk-6u37-linux-i586.bin 64-bit Please download jdk-6u37-linux-x64.bin system. I use 64-bit version here. 2. Copy JDK file to /opt directory # mv jdk-6u37-linux-x64.bin /opt 3. Authorize and execute chmod +x jdk -6u37-linux-x64.bin ./jdk-6u37-linux-x64.bin Fourth, set the environment variable vim /etc/profile vim /etc/bash.bashrc Add the following paragraph at the end of both files #set java Environment export JAVA_HOME=/opt/jdk1.6.0_37 export JRE_HOME=/opt/jdk1.6.0_37/jre export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME /bin:$PATH Five, reopen the terminal, get java –version
Install TOMCAT and JDK under Linux Step 1: Create a new boss user, username: boss, password
The installation environment is Ubuntu13.10 version i386, the nginx server and mysql server have bee
How Linux extends the XFS file system. There is extra space on the disk, so I want to extend the exi
VNC software is provided from other machines connected to the remote interface linux system
Problems that newbies may encounter when adding users and deleting users in Linux
Based on redhat6.4 local yum and ftpyum source configuration
The TIME/TIME+ value of the linux top command is
Ubuntu update kernel switch kernel boot
The implementation method of batch parallel telnet peer port under linux
Linux vi editor command Daquan
/etc/fstab file error, unable to enter Linux system
Linux service NFS and SAMBA services
How to add fonts in Linux system
Linux solves file deletion but disk availability has not changed
Ubuntu under the bower report EACCES: permissiondenied solution
Windows XP System Recovery Console Tutorial
Win10 color title bar setting method illustration tutorial
Demystifying the use of the Ping command
alert! 9 kinds of “inadvertent” leaked your personal information
Upgrade to Windows 7 64-bit computer card?
How to do Sogou input method typing card
How much hard disk space is required to install Windows 7
Win8 application recommendation: enjoy reading sweet