Linux java and android environment configuration and precautions, linuxandroid
After Linux was installed last time and later configured with the java environment, the android environment appeared several times and failed to enter the system. I either use the shell box to modify the configuration file or reinstall it, linux is also being used in the past few days, and some time has been taken to sum up the loss: (some steps can be achieved through shell. For convenience, I will directly dictate it)
1. Configure jdk:
1. First decompress your jdk to the directory you want to install
2. If you start configuring environment variables:
Environment variables include global variables, user variables, and temporary environment variables. As the name implies, the first is the environment variables that are valid for all linux users; the second is the environment variables that are private to users; and the third is all the variables that are invalid after the current user logs out. Take global variables as an example:
Setp1: Enter the etc folder in the root directory of the system, and open the profile file as an administrator.
Setp2. After opening the file, paste the following environment variables at the end of the file:
export JAVA_HOME= /opt/jdk7export PATH= $PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/binexport CLASSPATH= $CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
# The first line is the jdk installation path.
# Configure the PATH variable in the second line. Linux environment variables are separated by colons, which are different from those in Windows. Because there are more than one environment variable configuration file in Linux, we always need to remember the reference to the environment that may exist in the front, that is, $ PATH. Then, unlike the Windows variable reference, we use USD $ in Linux. If we find that a path variable is often used somewhere, we can use this method to implement reference. A total of two bin paths under jdk and jre are configured here.
# The third is the configuration of the CLASSPATH path, which is also two lib
### Notice ###
When configuring the environment, be sure to pay attention to it. Do not add any space characters on the = sides. In normal times, the habit of habitually adding spaces to the code should be noted, I fell down more than twice on this issue !!!
Step 3. Save the file
Setp4: Set the jdk you have installed as the system's default jdk (if necessary)
sudo update-alternatives --install /usr/bin/java java /opt/jdk7/bin/java 300sudo update-alternatives --install /usr/bin/javac javac /opt/jdk7/bin/javac 300sudo update-alternatives --config java
The configuration has been completed. Now you can log out and log on to the system again to make the configuration take effect. You can use the java-version command to view the current installed jdk version.
2. Configure android studio and eclipse or sdk
The specific environment configuration method has been clearly described in step 1. It also involves extracting and installing the environment, and then configuring the environment... We recommend that you do not install these items in the system directory, because only the root user has the highest permissions by default, although we can modify them through sudo, however, when running programs or installing plug-ins and creating virtual machines, you need to modify or add the content frequently. In this case, errors such as insufficient permissions, installation, or running failures often occur. Here we will directly deploy them in our user directory. When you configure the environment, the path configuration principle is the same as that in Windows. Which configurations do you need ~~~ Note that if you are worried that your path is wrong, you can enter the cd path in the shell box and check whether the path is correct by using dir or ls.
3. After environment Software Configuration
If you discard the hard-to-remember name when using shell to start the software, you can find the executable file in the bin or usr/bin directory and change it to your favorite name as an administrator, then you can use shell to start the software. (If some software automatically generates shortcuts to the desktop, you will lose the reference to the original files after modification ); some software Executable File shell scripts can be dragged to the desktop by yourself if there is no shortcut on the desktop
#### Tips ####
It was a very simple task. There were no problems with many tutorials on the Internet, because some precautions were not described in the White Paper, so I had to make a lot of mistakes like this ~~~~~ Well, I have said so much. If you have any questions, you can leave me a comment. I am very happy to discuss with you various Linux usage issues and make common progress !!!
Ps: I have uploaded a copy of my profile. For more information, see.