Archive

Archive for August, 2011

Install the Java SDK (JDK) for Android and Eclipse

August 24th, 2011 No comments

These instructions apply to someone using Windows 7.  However, the Java SDK is available for other operating system platforms, such as Linux, and OS X

Important: At the time of this article (april 2013) all references from the official Google Android development website state that the supported Java version for Android development is still Java 6 SDK.

However, Oracle has since 2012 made it clear that public updates to the Java 6 SDK will be discontinued to the public as the product reaches its End of Life.

excerpt.google.android.jdk6.requirement.april.2013

The Android Developers website in April 2013. There is still a requirement to use JDK 6 even though the product is considered to be at an ‘End of Life’ stage by Oracle

 

Therefore this blog now only advises to setup Java 7 SDK.  If you plan to keep using Java 6 SDK for Android development, make sure that you understand that you might require paid support from Oracle.

The Java 7 SDK is available from this location.

http://www.oracle.com/technetwork/java/javase/downloads/index.html

What we need for Android development is a Java SDK without any enterprise features, so the Standard Edition would be enough.

  • Scroll towards the middle of the screen and locate the JDK 7 SE section (search within the page for ‘Java SE 7′)

jdk.7.for.windows7.download

 

  •  Choose the download link under JDK

This will take you to the license agreement and download page. You need to accept the license agreement and then choose your appropriate Windows version.

jdk.7.confirm.agreement.windows7

Make sure that you understand if you are working with a 32 or 64-bit version.  If you are using a 64-bit operating system version (usually from higher end, more modern laptops and desktops), you may feel tempted to develop using 64-bit versions of everything.

However, the end result will always be an Android ARM application (32-bit) and this will be our main focus.  We will stick to 32-bit in this blog as 32-bit is still the most common type of CPU for development.

What is the Java JRE and is it enough for Android development?

The Java JRE is not meant for Android development. Java JRE is considered an end user runtime environment that will interpret Java executables.  Java executables (also known as Java bytecode) are the equivalent of .exe files in Windows that can only be executed but not modified or inspected.

The Java SDK is mandatory as we need all its underlying abilities to make Eclipse and the Android SDK work as a development platform.

Installation

  •  Make sure that your Windows account has administrative privileges on your PC.

Find out your user name. From the DOS command line, run:

Set user

And check whether your user ID belongs to the local administrators of the PC. From the DOS command line, run:

Net localgroup Administators

When starting the Java SDK installation, it is a good idea to make a note of the Java root directory (The install to directory)

Any Java applications are dependent on this folder being set in one of your Windows environment settings, so it is good to learn where your SDK is located at all times. It would normally be at:

C:\program files\java\jdk<JDK version>_<revision>

  • Install all JDK components in full, the only exception is the option called ‘source code’ which is not relevant to Java development.

jdk7.windows.install_to_directory

Also, the ‘Public JRE’ option will install the Java Runtime Environment (JRE) that corresponds to your JDK version and revision.

At the end of your installation, you should see a window like the following:

jdk7.windows.success

The message should read ‘Java SE Development Kit <version> update <update number> Successfully Installed

  • Confirm that the two most important components (the JRE and JDK)  have been installed. From the ‘Uninstall a program’ dialog box in Windows, check that the following two entries exist:

Java (TM) <version> Update <revision>

This is the JRE

Java (TM) SE Development kit <version> Update <revision>

This is the SDK.

javajrejsdk.successfully.installed

  • Reboot your PC. It is not a bad idea to reboot your Windows PC after setup of the JDK/JRE

Congratulations!

You have just set up the foundation for Java and Android development and you are on your way to making a difference in mobile applications.

Next step is to install Eclipse

Categories: Android core tools Tags: