In the process of compiling spice found a lot of things are under Linux, so under the Unbuntu to configure an Android environment, first of all, the first configuration of the Java environment.
Tools/Ingredients:
Method/Step:
- First we need to download the JDK, open Orcle's official website to download jdkhttp://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html , I am under the latest version of jdk-8u25-linux-x64.tar.gz
- Then in the personal home folder to create a new folder, I named Java, my user name whj, so the full directory is/home/whj/java (official web also has a RPM format, where I download the GZ format, RPM is a package directly packaged), and then the jdk-8u25-linux-x64.tar.gz copied to the/home/whj/java/directory, for the newly-started friends, the command may not be able to understand the meaning of the instructions, in this graphic way to do. The right mouse button-> Use the Archive Manager to open, then you can see everything inside, we need to extract it out,:
- Directly Click Extract to extract all the files, it will be extracted to the current directory, at this time the JDK directory is /home/whj/java/jdk1.8.0_25.
- The following directly to configure the environment variables, here are two configuration methods, one is to enter sudo gedit/etc/environment carriage return in the terminal, will ask for a password, and then open a file, here I do not know where there is a problem, the first time to open the text, The second time you open a blank, after entering the prompt file does not exist.
- The first way to fail is to try the second method:
$sudo gedit ~/.BASHRC
Add the following code:
Export java_home=/home/whj/java/jdk1.8.0_25
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH
To see if the configuration was successful: Java-version
Have the following information configured successfully! (This may need to be restarted once and can be restarted again before looking at the results)
- After the installation is successful, we can test it with an example: Create a new file in the/home/whj/directory Hello.java, open, enter the following
public class hello{public static void Main (String args[]) { System.out.println ("Hello Wrold");
- After saving in the terminal input Javac Hello.java (note, is the/home/whj/directory under the new Hello.java file, otherwise, run this command need to go to the corresponding directory, you can first try the LS command in the terminal, you can list the current directory of all files)
- If the output is Hello World, it means the configuration is ready,
- Here the configuration is completely successful. The JDK environment has been built.
Setting the environment variables for Java in Unbuntu