Setting JAVA_HOME Environment Variable

This section provides a tutorial example on how to set up JAVA_HOME environment variable to run development tools to build and test Android apps.

After installing JDK, you need to make sure the JAVA_HOME environment variable is set to the new JDK folder. This is needed to run development tools to build and test Android apps. Here is how you set and verify the JAVA_HOME environment variable.

1. Go to "Control Panel\System and Security\System" and click "Advanced system settings" on the left. You see the System Properties dialog box displayed with the "Advanced" tab opened.

2. Click the "Environment Variables" button. You see the Environment Variables dialog box displayed.

3. Enter or modify the JAVA_HOME entry to be "\Program Files\Java\jdk1.8.0_45\". Then click OK to close dialog boxes.

4. Start command line window and try the following commands:

C:\herong>set JAVA_HOME

C:\herong>"%JAVA_HOME%\bin\java" -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) Client VM (build 25.45-b02, mixed mode)

If you get similar output, you know your JAVA_HOME environment variable is correct.

Table of Contents

 About This Book

Installing JDK 1.8 on Windows System

 Downloading and Installing JDK 1.8

 Writing My First Java Program

Setting JAVA_HOME Environment Variable

 Installation of Android SDK R24 and Emulator

 Installing Apache Ant 1.9 on Windows System

 Developing First Android Application - HelloAndroid

 Android Application Package (APK) Files

 Android Debug Bridge (adb) Tool

 Android File Systems

 AboutAndroid - Application to Retrieve System Information

 android.app.Activity Class and Activity Lifecycle

 View Objects and Layout Resource Files

 Using "adb logcat" Command for Debugging

 Build Process and Package File Content

 Building Your Own Web Browser

 Android Command Line Shell

 Samsung Galaxy Tab 3 Mini Tablet

 USB Debugging Applications on Samsung Tablet

 Android Tablet - LG-V905R

 USB Debugging Applications on LG-V905R Tablet

 Android Phone - LG-P925g

 USB Debugging Applications on LG-P925g Phone

 Archived Tutorials

 References

 Full Version in PDF/EPUB