I have been preparing to learn something about Linux and have never put it into practice. I have been preparing to install it this weekend. I have been doing Android development for nearly half a year, and I want to learn something about the framework and source code...
Before the installation, Baidu Google also read a lot of information on the Internet many times. To sum up, it is still unclear for entry-level people like me. In combination with the information on the Internet, I want to improve it here. I hope it will be helpful to people later, so I can also learn it.
First, install ubuntu. the Ubuntu official website is http://www.ubuntu.org.cn/download/with a chain download. the Ubuntu website is installed on win7's, And the Ubuntu website is 11.04. The downloaded file is a. isofile format. With Virtual optical drive, wubi.exe can be installed, just as simple as installing an ordinary application. The Ubuntu official website also provides detailed installation tutorials. We recommend that you install it in a blank partition during installation. You can use the system disk to manage it. If you do not understand it, leave a message for me. If necessary, I will improve it.
After the installation, there are prompts to update some things, such as language packs, because after the installation, it is a Chinese character, and the update will not be too much affected. Of course, if you have time, update the system first. It is not too late to install the system after everything is OK. It will not affect the system...
------------------------- Install JDK -------------------------
The next step is to install JDK. Please note that, because the system comes with openjdk, some prompts will be prompted when you enter the Java-version command in the terminal. Do not worry about this, there is no impact. We need to manually configure our own JDK. Okay, let's talk about this.
First to begin
After that, copy jdk-7-linux-i586.tar.gz to the/home/AND/Java/directory. For Beginners, you may not be able to understand the meaning of each command by using commands, and use graphical methods here. Right-click and choose archive manager to open the file. Then you can see all the content in the file. We need to decompress it,
Click "decompress" on the toolbar to decompress it to the current directory. The JDK directory is/home/AND/Java/jdk1.7.0, which is already decompressed, configure the environment variables.
Enter sudo gedit/etc/environment in the terminal and press Enter. A password is required, and a file is opened. Enter the following three lines in the file:
Export java_home =/home/AND/Java/jdk1.7.0
Export jre_home =/home/AND/Java/jdk1.7.0/JRE
Export classpath =.: $ classpath: $ java_home/lib: $ java_home/JRE/lib
Note that in the last row, the classpath is followed by a.: (I forgot to write a hello World, which can be compiled but cannot be run)
Similarly, modify the second file and enter sudo gedit/etc/profile in the terminal and press Enter.
Add the following four lines to this file:
Export java_home =/home/AND/Java/jdk1.7.0
Export jre_home =/home/AND/Java/jdk1.7.0/JRE
Export classpath =.: $ classpath: $ java_home/lib: $ java_home/JRE/lib
Export Path = $ java_home/bin: $ java_home/JRE/bin: $ path: $ home/bin
Export Path =/usr/local/Android-SDK-Linux/tools:/usr/local/Android-SDK-Linux/platform-tools: $ path
This step is OK. log out of the user and enter Java-version in the terminal,
If you see this, it indicates that the installation is successful. Don't worry. First, write an example to test it:
Create the file hello. Java in the/home/AND/directory. open the file and enter the following content:
public class Hello{ public static void main(String args[]){ System.out.println("hello wrold"); }}
Save and enter javac hello in the terminal. java (Note: The hello is created under the/home/AND/directory. java file. Otherwise, you must first go to the corresponding directory to run this command. You can first try the LS command in the terminal to list all files in the current directory)
If no prompt is displayed, the compilation is successful, and nihao is executed. Enter Java hello
If Hello world is output, the configuration is complete,
------------------------- Install eclipse -------------------------
Due to a problem with the Five-stroke input method, the time was delayed and the following will continue...
Http://www.eclipse.org/downloads/, select Linux 32bit (of course, if the system is 64-bit, download 64-bit)
The decompression method is the same as the JDK installation method above. The decompression path is/home/AND/Java/Eclipse/eclipse,
Double-click eclipse to start the eclipse program.
At this time, even if eclipse is installed, you can create a new project in it, such as the previous Hello World
------------------------- Install the android SDK -------------------------
Official http://developer.android.com/sdk/index.html
Select android-sdk_r12-linux_x86.tgz
After the download is complete, double-click it to open it. The decompression method is the same as the previous JDK decompression method.
The decompressed path is/home/AND/Java/Android/android-sdk-linux_x86
In this case, the SDK is equivalent to a software manager. If you want to develop Android, you must have at least one Android version. In this case, it is empty. then configure the ADT plug-in eclipse.
------------------------- Install ADT -------------------------- in eclipse ------------------------
The official website provides two installation methods, refer (I had been here for a long time. During the installation, I was always prompted about the lack of things and so on. The next day I was able to install it again, which is inexplicable, hope that the installation is successful at one time !)
Open eclipse ---> help ---> install new software
Click Add next to the input box after work.
Enter ADT plugin after name (you can name it as needed)
Enter: https://dl-ssl.google.com/android/eclipse/ after location
Click OK. As prompted, install eclipse step by step. You will be prompted to restart eclipse and Select Restart now. (The configuration method is the same as that in Windows) then the configuration is OK.
Then, click the android plug-in icon in eclipse (the premise is to configure the android SDK directory first), and then download the required Android version through the graphical interface, and then it's the same as on windows... After configuration, run it. I wish you all the best.
Leave me a message if you have any questions.
//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// ///////////////////
Step 1: Download jdk-7-linux-i586.tar.gz
[Plain]
View plaincopy
- Http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz wget-C
(Note: If the download fails, we recommend that you use thunder to download it and copy it to the Linux system .)
Step 2: unzip and install
[Plain]
View plaincopy
- Sudo tar zxvf./jdk-7-linux-i586.tar.gz-C/usr/lib/JVM
- CD/usr/lib/JVM
- Sudo MV jdk1.7.0/Java-7-sun
Step 3: Modify Environment Variables
[Plain]
View plaincopy
- Vim ~ /. Bashrc
Add:[Plain]
View plaincopy
- Export java_home =/usr/lib/JVM/Java-7-sun
- Export jre_home =$ {java_home}/JRE
- Export classpath =. :$ {java_home}/lib :$ {jre_home}/lib
- Export path =$ {java_home}/bin: $ path
Save and exit. Enter the following command to make it take effect immediately.
[Plain]
View plaincopy
- Source ~ /. Bashrc
Step 4: configure the default JDK version
Ubuntu may have a default JDK, such as openjdk. To set the JDK we installed as the default JDK version, perform the following work.
Run the Code:[Plain]
View plaincopy
- Sudo Update-alternatives -- install/usr/bin/Java/usr/lib/JVM/Java-7-sun/bin/Java 300
- Sudo Update-alternatives -- install/usr/bin/javac/usr/lib/JVM/Java-7-sun/bin/javac 300
- Sudo Update-alternatives -- install/usr/bin/Jar/usr/lib/JVM/Java-7-sun/bin/jar 300
- Sudo Update-alternatives -- install/usr/bin/javah/usr/lib/JVM/Java-7-sun/bin/javah 300
- Sudo Update-alternatives -- install/usr/bin/javap/usr/lib/JVM/Java-7-sun/bin/javap 300
Run the Code:[Plain]
View plaincopy
- Sudo Update-alternatives -- config Java
JDK versions are listed as follows:[Plain]
View plaincopy
- Snowdream @ snowdream :~ $ Sudo Update-alternatives -- config Java
- Three candidate items can be used to replace Java (/usr/bin/Java ).
- Select the path priority status
- ------------------------------------------------------------
- * 0/usr/lib/JVM/java-6-openjdk/JRE/bin/Java 1061 automatic mode
- 1/usr/lib/JVM/java-6-openjdk/JRE/bin/Java 1061 manual mode
- 2/usr/lib/JVM/Java-6-sun/JRE/bin/Java 63 manual mode
- 3/usr/lib/JVM/Java-7-sun/bin/Java 300 manual mode
- To maintain the current value [*], press the Enter key or enter the selected number: 3
- Update-Alternatives:/usr/lib/JVM/Java-7-sun/bin/Java is used to provide/usr/bin/Java (Java) in manual mode.
Step 5: Test
[Plain]
View plaincopy
- Snowdream @ snowdream :~ $ Java-version
- Java version "1.7.0"
- Java (TM) se Runtime Environment (build 1.7.0-b147)
- Java hotspot (TM) server VM (build 21.0-b17, mixed mode)
Reference link:
1. Install JDK configuration eclipse and tomcat under Ubuntu 10.10 [reprint + correction] http://www.cnblogs.com/evasnowind/archive/2011/01/05/1926059.html
2, ubuntu jdk installation process (for reference only) http://forum.ubuntu.org.cn/viewtopic.php? T = 183803
3, Java learning JDK installation http://www.cnblogs.com/shaoguobao/archive/2011/07/16/2108015.html
Note:
When you open eclipse with a JVM error, it is generally eclipse. ini error, see: http://wiki.eclipse.org/Eclipse.ini