How-to setup Java for Phone Development
From UrbanWiki
Contents |
[edit] J2ME Programming
Specifically using Carbide.j for Symbian v9.1 with S60 3rd Ed phones.
[edit] Installing the Toolchain
Unfortunately Carbide.j and the MIDP SDKs only work on Windows. The previous statement is potentially false.
- Install the Sun 1.4 JRE/JDK of your choice
- Carbide.j doesn't seem to work with IBM's jvm
- Install Eclipse (verison 3.1)
- Eclipse doesn't work, as of writing, with other versions than 3.1
- Install the 3rd Ed MIDP SDK
- Note: Javadocs are in Start > All programs > S60 Developer Tools > 3rd Edition SDK > MIDP > SDK Help
- Install Carbide.j
[edit] Creating a MIDlet
[edit] Create a new Project
- File > New > Project
- Java > MIDP Project (Nokia SDK Plug-in)
- Give the project an interesting name
- Make sure 'S60 3rd Ed. SDK for MIDP' is the selected SDK
- Uncheck 'Start with designer tool'
[edit] Write Code
- You should know what to do here
- Lots of examples and documentation on the nokia forum site
[edit] Creating an Application Package
- Make sure the project you want is selected in the Package Explorer View
- Tools > Carbide.j > New Application Package...
- Or alternately click on the blue brick wall looking icon
- If this is the first time creating the package for this project or you want to create the package from scratch, select 'Create JAR and JAD for the first time'. Otherwise selecs 'Recreate based on existing package:'
- Click on 'Attributes' and modify the attributes to your liking.
- Even though the version is listed as '0.0.1', (at least) 3rd Ed. phones use the format: '0.01'
- If you've created or removed any classes/MIDlets since the last time you created the package you need to update the MIDlets and Classes tabs
- If you're using any methods that have security restrictions make sure to add the proper permissions in the Permissions tab
- Enumerating permissions your MIDlet doesn't need will also cause errors
- Click 'Generate...' and follow the prompts
[edit] Testing the Application Package in the Emulator
- Make sure the project you want is selected in the Package Explorer View
- Tools > Carbide.j > Start Emulators...
- Or alternately click on the icon with the phone and a play symbol in front of a white window
- Select only the 'S60Emulator <default>' option
- Click 'Emulate'
WARNING: This step is misleading. It doesn't work it most cases (for unknown reasons). It will cause a ZipException. Try instead to use the Run as command and setup the emulator that way.
[edit] Deploying the Application Package
- Make sure the project you want is selected in the Package Explorer View
- Or alternately click on the icon with the phone in front of the blue bricks
- Tools > Carbide.j > Deployment...
- Turn on Bluetooth on the computer and the phone
- Or use the USB cable
- Select the phone from the list
- Click 'Deploy'
- Follow the prompts on the phone

