Local Machine Setup
The first thing you need to do is ensure that your machine can talk to your phone. We used Bluetooth for our communications. We also downloaded and installed the Nokia PC Suite so we could use the File Manager tool for transfering files from your local machine to the phone.
Java on the phone
The Java VM on the phone is J9 Personal Profile 1.0 (ppro10) Well, that was the VM on our phone. :-)
Java on your local machine
To make things easier, we set up the demos on our local machine, ensured they were working ok, and then transfered them to the phone. So the first thing we had to do was ensure that we had the right VM set up locally.
- First you need to download the Foundation 1.0/Personal Profile 1.0 VM.
- Add the VM as an Installed JRE (
Window -> Preferences -> Java -> Installed JREs).
- Add the 2 extra libraries as external JARs (
- Add the following default VM arg:
Running a Java application on the phone
- The file-system can be referenced like Windows with
D:drive is the memory card).
- The J9 VM is associated with the
.j9file-type. You create a
.j9file with all the command-line arguments for your application and then when you click on it in the file manager it will run J9.
- The file contains everything that you want on the command line except the reference to the VM executable. e.g.
-cp foo.jar com.Foo
- Note: any arguments after the class name on the commandline are passed to the class as arguments to the application and are not interpreted by the VM. Therefore if you are trying to set system properties, it should be done early in the command-line. e.g.
-Dfoo=bar -cp foo.jar com.Foo
- Use the file manager on the phone to select the
.j9. Opening it will launch the Java application.
Running an Eclipse Application on the phone
Since Eclipse uses an XML parser to read the registry and other files, you will need to get bundles that provides the XML Parser APIs. A good candidate for this are 2 bundles (
org.eclipse.ercp.xmlParserAPIs) which are included as part of the eRCP project. These two bundles are created as framework extensions so you need to tell OSGi about them by setting a system property:
Personal Profile EE
Now when you try and run, you will likely get an exception saying that OSGi couldn't match the required Execution Environment for some of the bundles. They are looking for the Founation 1.0 EE but the current VM doesn't match this. So we need to create a new profile which looks like this:
org.osgi.framework.system.packages = \ javax.microedition.io org.osgi.framework.bootdelegation = \ javax.microedition.io org.osgi.framework.executionenvironment = \ OSGi/Minimum-1.0,\ OSGi/Minimum-1.1,\ CDC-1.0/Foundation-1.0,\ CDC-1.0/PersonalProfile-1.0,\ CDC-1.1/PersonalProfile-1.1 osgi.java.profile.name = CDC-1.0/PersonalProfile-1.0
Next we need to set a system property for the new profile which contains a file URL to the location of the file:
Writing to the Console
C:/logs/j9vm- You must have this directory created or your Java application will hang when it tries to write something to
- When you run your Java application 2 files will be created in this directory, one for
System.errand one for
- The files will be named
- Output will always be to this directory, even if your JAR files are on a different drive.
- j9 -io:host:port
- console telnet
Snippets from a conversation about networking and the phone:
Is it possible to do TCP over bluetooth between the 9300i and a laptop? Conversely, is it easy to setup an adhoc network between the 9300i and the laptop? For demo purposes its much better to not have to tap into some existing wifi net. (access point etc)
Possible, yes. However, I am not aware of anyone who has accomplished this. The adhoc should be much easier to implement. It is done when defining the IAP (Inernet access point)
I think there is an adhoc setting when you add a new internet connection. Then you have to figure out how to create an adhoc network on from the laptop. This would allow for demos without having to tie into an existing network (a good thing when at a conference).
So, IP over bluetooth appears to be possible but it is unclear how you do it. Adhoc seems like a good deal.
We also have a SavaJe phone...haven't done anything cool with it yet though.