Expert Android Studio. Dundar Onur

Чтение книги онлайн.

Читать онлайн книгу Expert Android Studio - Dundar Onur страница 4

Expert Android Studio - Dundar Onur

Скачать книгу

style="font-size:15px;">      After the installation finishes, you need to set the Windows 10 environment paths for Java to configure the system environment. You need to set a path for the JAVA_HOME system variable.

      WARNING

      In earlier versions of Windows, the steps for setting the environment path might be a little different.

      1. Right-click the Start menu icon and click File Explorer. In the window that opens, right-click This PC and select Properties to open the System window.

      2. From the options at the left of the System window, select Advanced system settings. This will open the dialog box shown in Figure 1.4 with the Advanced tab enabled.

      3. Click the Environment Variables… button shown in Figure 1.4.

      4. From the Environment Variables window that opens, click the New button and set the Java path with your installation directory. As shown in Figure 1.5, the path is C: \Program Files\Java\jdk1.7.0_79 for our 64 bit installation. If you installed the x86 version, your path would be different, such as C: \Program Files (x86)\Java\jdk1.7.0_79.

Figure 1.4 Java path setup for Windows 10

Figure 1.5 Java Environment Variables setup for Windows 10 64-bit

      Installing Java for MacOS X

      Java used to be a part of Mac OS X and was shipped by Apple. This changed several years ago. Apple also decided to remove Java from Mac OS so JDK, which is provided by Oracle, needs to be installed separately.

      1. Start by downloading the jdk-7u79-macosx-x64.dmg file from the page shown in Figure 1.1.

      2. Launch the dmg file to display the window shown in Figure 1.6.

      3. Double click the JDK 7 Update 79.pkg file link to start the installation.

      4. Select the installation directory you want and complete the installation in the window shown in Figure 1.7.

Figure 1.6 Mac OS X Java installation

Figure 1.7 Java installation Max OS X

      Now JDK is ready to use on Mac OS X. You can check the installed JDK version from System Preferences of Mac OS X or type 'java –version' in the terminal window to see whether Java installed properly.

      Installing Java for Linux

      Two types of installation packages are available for Linux. If you use a distribution with an rpm package manager like Fedora, you can download the rpm package and install Java via rpm. In this section you install JDK with the tar.gz package on Ubuntu 14.04.

      1. Download jdk-7u79-x64.tar.gz from the download page shown in Figure 1.1 and extract it to the directory where you downloaded the tar.gz file using the following command:

      user@ubuntu$ tar xzvf jdk-7uXX-x64.tar.gz

      That command will extract JDK into the jdk1.7.0_79 folder where you ran the command.

      2. Move that folder to /usr/local/java with the following command:

      user@ubuntu$ mv jdk1.7.0_79 /usr/local/java

      3. Edit the /etc/profile file to set Java paths for your session. You can copy and paste the following lines to the end of the /etc/profile file.

      ##Java Path

      JAVA_HOME=/usr/local/java/jdk1.7.0_79

      JRE_HOME=$JAVA_HOME/jre

      PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

      export JAVA_HOM

      Eexport JRE_HOM

      Eexport PATH

      4. Install Java binaries for system-wide use with the following commands:

      • Install the Java binary:

      user@ubuntu$ sudo update-alternatives

      – install "/usr/bin/java" "java""/usr/local/java/jdk1.7.0_79/bin/java" 1

      • Install the Java Compiler binary javac:

      user@ubuntu$ sudo update-alternatives

      – install "/usr/bin/javac" "javac""/usr/local/java/jdk1.7.0_79/bin/javac" 1

      • Install the Java Web Start binary javaws:

      user@ubuntu$ sudo update-alternatives

      – install "/usr/bin/javaws" "javaws""/usr/local/java/jdk1.7.0_79/bin/javaws" 1

      5. Set Oracle Java as the default Java for your system with the following commands:

      user@ubuntu$ sudo update-alternatives – set java

      /usr/local/java/jdk1.7.0_79/bin/javauser@ubuntu$ sudo update-alternatives – set javac

      /usr/local/java/jdk1.7.0_79/bin/javacuser@ubuntu$ sudo update-alternatives – set javaws

      /usr/local/java/jdk1.7.0_79/bin/javaws

      When you are done with the previous instructions, JDK and JRE will be ready to use when you restart Ubuntu. You can test whether Java installed correctly with version control. The command and output for that will look like this:

      user@ubuntu~$ java – version

      java version "1.7.0_79"

      Java(TM) SE Runtime Environment (build 1.7.0_79-b15)

      Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

INSTALLING ANDROID STUDIO

      Android Studio installation, like Java installation, differs by operating system. The following sections provide installation instructions for Windows, Mac OS X, and Linux platforms.

      The direct link for the installation binaries is https://developer.android.com/sdk/index.html.

The download link that's available when you go to this site will be correct for the operating system you are running, as shown in Figure 1.8.

Figure 1.8 Android Studio download page

      NOTE

Скачать книгу