Installing Java Card (Windows)
Originally there was going to be a video to show the process of actually installing Java Card along with everything else to get an application running but due to the fact that I couldn’t upload it to youtube (after major editing it was still 40 minutes long), I have decided to put it in a series of blog posts.
The first blog (this one) will be of physically installing Java Card and netbeans onto Windows. (There will probably also be another for Linux – not supported for Mac OS).
The second will be simply running a program to get the 2 bits of software communicating with each other in a program.
Just a note beforehand though, I am using Java Card 2.2.1, though the newest release is 3.0.2. This has a lot more features but couldn’t get it working for the purposes I needed (communicating with a J2ME phone application). I also tried using Java Card 2.2.2, but also due to the requirements I needed for my project I couldn’t use this. So all these posts will be using Java Card 2.2.1, and using newer versions may not work the same.
But onto the real installation:
Step 1: Install Java SDK 1.3
Now you may be asking “Why do I have to use such an old SDK like 1.3?” (Well if you’re not you should be).
This is because Java Card 2.2.1 and Sun’s Wireless Toolkit do not work with any newer version, otherwise they would have been used, since Java SDK 1.3 isn’t even supported anymore. (In fact I think 1.4 isn’t supported anymore, thus really showing its age).
Now you need to go to here to download the old SDK.
Now simply click on “DOWNLOAD” beneath SDK to take you to another page where you can download the file.
Save the file to where ever you want and then you have to do a normal installation EXCEPT when you decide where to save the program, change it to a new folder where there are NO spaces in the entire directory.
So where it is usually saved to somewhere like C:\Program Files\j2sdk1.3\ you want it saved to a directory such as C:\jdk1.3\ or C:\Java\ as you can see here:
If yours has spaces, just go to browse then C:\ and save it there, or (preferably) create a new folder and save it in there, which in this instance is jdk1.3_20 this is for a reason that I will go into detail later.
Step 2: Install Java Card
The Java Card development kit we want (2.2.1) can be found here. You need to to go to the bottom of the page and click on Java Card Development Kit 2.2.1
From here you go to another page, choose Windows from the drop down box and download the .zip file.
Then extract this, again to a directory with no spaces in. And it’s probably best not to have it in the same folder as the Java, but something easy to locate, for example C:\JavaCard221\
In these files you will see a file called bin. This is the file that has all the batch files that Java Card uses.
Now you need to make the variables to be used by Java Card and the wireless toolkit, and you for general ease.
To do this go to Start -> My Computer then as you can see here it will be on the left and click on “View System information” (in Windows XP home for Vista or 7 just type in “system information” or “system properties” without quotes into the start menu search box)
This will then take you to another screen. You need to click on the “advanced” tab at the top
Then in the advanced tab you need to click the “environment variables” button. This will make this screen appear:
Now you need to click the bottom “New” button of the 2 onscreen. Then create an environment variable with name JAVA_HOME (must to be capitals and with an underscore) and variable value C:\Java\jdk1.3 or where ever you installed Java SDK 1.3. Make sure to NOT put a \ at the end. Then click OK. Now you also need to make another variable, named JC_HOME (must be exact again) with variable value of the directory where you extracted the Java Card zip to.
You can check both these are here as they will be in the list of System Variables. Now you need to scroll down this list until you find a variable called Path. Click Edit.
If there is not a ; at the end of the value, then add one. Now you need to leave what is in the value as it is and add to the end of path
%JAVA_HOME%; %JAVA_HOME%\bin; %JC_HOME%; %JC_HOME%\bin;
then click OK. And click OK on the environment variables box, and OK on the system properties box.
To check this has worked, go to start -> run and put in cmd and click OK
This will then open a command prompt window. And check that the path variables are set by typing dir %JAVA_HOME% and hitting enter. It should show something like this:
You can see that it says “Directory of ” and then the folder you set the variable to. If it just appeared with something like “variable not found” or “unknown command” then close the command prompt window and go back to the section about environment variables and make sure they have all been done correctly. It’s also best to do dir %JC_HOME% as well to make sure there are no errors.
NOTE: If you just want to install the Java Card toolkit, you are now done. For all the rest that need to communicate with an emulator carry on to the next step.
Step 3: Installing Sun’s Java Wireless Toolkit
I was using the Java Wireless Toolkit 2.5.2 for CLDC, which can be downloaded from here.
Just scroll down and there’s a link to download it, again choosing Windows from the drop down box and download the file. This can just be installed to a directory with no spaces and there are no variables that have to be created for this. The wireless toolkit has some handy utilities I used though they could just be used directly from netbeans, but either way the wireless toolkit has to be installed. So now onto….
Step 4: Installing netbeans
The version you need for this is Netbeans 6.7.1, and a version that can work with Java ME. This is because the newer versions don’t work with versions of Java Card this old, but the wireless toolkit doesn’t work with newer versions of Java Card, so until the wireless toolkit is updated, you have to use all these old versions of everything else.
But back to the installing netbeans. The link is here. You need to choose a version that supports Java ME
Clearly only 2 versions, Java and All technologies bundles, support Java ME. So download one of these (best to just download All if you think you might need it again for C/C++ or something).
Then do a normal Windows install like any other program, netbeans can even be installed to the ‘Program Files’ folder. Except you can do a customised installation if you don’t want to install things like the enterprise server bundles.
Once all this is installed you may have to go to new project and create a Java ME project to simply initialise J2ME on netbeans. But after this is done go to Tools (at the top) -> Java Platforms and the Java Platform manager will appear and if Sun Java Wireless Toolkit isn’t in the J2ME folder, you need to click on “Add Platform…” at the bottom, then click on “Java ME MIDP Platform emulator” as Platform type
And then it will search for all Java ME platforms. When the directory for the wireless toolkit appears, make sure there is a tick next to it and click next and install.
Now you need to double click Sun Java Wireless toolkit in the left hand column of the Java Platform Manager and go to the Tools & Extensions tab here and click on “Open Preferences”
In Preferences you can choose which phone you want the emulator to look like. Then click Monitor in the left column and make sure “Enable Network Monitor” is checked as shown here:
This will enable you to clearly see communication between the emulators to see for errors or just out of curiousity.
Now go to SATSA (on the left) and make sure slots 0 and 1 are 9025 and 9026 respectively.
And now everything is installed and ready to make a program (Next post) =D