vrijdag 17 september 2010

How to set the path for Java Development Kit 6 (JDK 1.6) in Windows 7

Assuming that you already installed the JDK on your Windows 7 OS, you still need to configure the PATH variable in Windows settings.

Why use the PATH variable?
Once a programs location (folder) is added to the PATH variable, it becomes accessible from any other location. Normally you need to open an application by typing an absolute or relative path. With a global path variable, referring to the containing folder is not needed anymore.
Also take a look at wikipedia.

The JDK executables that you need for running, compiling and other things, are located in the installation directory. Often this is something like C:\Program Files\Java\jdk1.6.0_21\bin.


Add the path of the JDK to the PATH variable


  1. Right click “My Computer” icon
  2. Choose “Advanced system settings” from the left menu
  3. Click “Environment Variables..." at the bottom
  4. In the "System variables" list, select the "Path" line and "Edit..." this line.
  5. Type the path to your JDK's "bin" directory (C:\Program Files\Java\jdk1.6.0_21\bin) in front of the other entries and separate it by a ";".
  6. Click OK several times to exit the windows.
Now, the JDK is added to the Path variable and accessible from anywhere.

PATH errors
Errors that are shown when you did not add the directory correctly:
  • 'javac' is not recognized as an internal or external command, operable program or batch file.
  • 'java' is not recognized as an internal or external command, operable program or batch file.


What is in your PATH variable by default?
In my Windows 7 OS I see the following by default:
  • %SystemRoot%\system32;
  • %SystemRoot%;
  • %SystemRoot%\System32\Wbem;
  • %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
After adding the JDK Path it looks like this:

  • C:\Program Files\Java\jdk1.6.0_21\bin;
  • %SystemRoot%\system32;
  • %SystemRoot%;
  • %SystemRoot%\System32\Wbem;
  • %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

How to install/configure Eclipse for J2ME development for the Nokia S40 series? (windows)

If you want to develop for Nokia S40 you should install the following

* Java Development Kit (6) - required to develop Java applications
* Eclipse Java (Helios) - need this to code, compile, debug and others
* Nokia s40 SDK (v.6) (login required) - used to emulate Nokia platform
* Mobile Tools for Java - Eclipse extension for Mobile development (integrates with nokia SDK)

Installation:
  1. open the downloaded jdk and click through the installation
  2. include the JDK in the PATH variable: see my 'set windows path' article
  3. install Eclipse by simply extracting the archive
  4. install Nokia SDK
  5. configure Eclipse settings for SDK (see documentation1 and documentation2)
  6. install Mobile Tools for Java (MTJ) via the Eclipse software installer with link: http://download.eclipse.org/dsdp/mtj/updates/1.1.0/stable/
  7. add device to Eclipse: go to preferences\java ME\Device management, manual install and search for the folder in which the Nokia SDK was installed (...\devices\S40_6th_Edition_SDK\bin\). Eclipse searches for a device specification.
  8. Now, in Eclipse you can create a new MIDlet Project with a Java ME Midlet file.
Feel free to add comments, tips or improvements.