Step 1: Install Debian packages (I always use Debian packages where possible).
sudo apt-get install openjdk-6-jdk
This installs the full Java 6 development kit,
Download and install netbeans from here
Now you will need to install the NetBeans Mobility plugin, which provides support for J2ME development, and the Sun Wireless Toolkit (WTK), which provides the actual libraries to compile against.
Step 2: Install the NetBeans Mobility plugin.
If you choose File -> New Project, you will find no way to create a J2ME project! You need to install the Mobility plugin.
Close that, and choose Tools -> Plugins. Under Available Plugins, select Mobility (Category: Java ME). Install that. Now under File -> New Project, you will find Java ME. Choose to create a Mobile Application.
Step 3: Install the Sun Wireless Toolkit.
Having chosen Mobile Application, you will be presented with a dialogue with a red error at the bottom: “No J2ME compatible platform is installed in the IDE. You need to have at least one J2ME compatible platform installed in the IDE.” So you’re still missing the actual library files required to compile J2ME apps.
So after much searching, I found what I think is the correct download (but there are lots of similar ones with different versions): Sun Java Wireless Toolkit 2.5.1 for CLDC. You should pick the Linux version, and download it (it’s called sun_java_wireless_toolkit-2_5_1-linux.bin).
Download it to your desktop, then run:
chmod +x sun_java_wireless_toolkit-2_5_1-linux.bin
./sun_java_wireless_toolkit-2_5_1-linux.bin
If it says
“No suitable Java interpreter was detected”
. Type “0″ to “Specify a path to a Java interpreter directory.”
If you installed openjdk-6-jdk like I said above, it should be installed in /usr/lib/jvm/java-6-openjdk/bin/.
You might have many Java bin directories installed. To find one, type ‘which jar’. This might give you a symlink (such as /usr/bin/jar). Use ‘stat /usr/bin/jar’ to follow the symlinks until you find the real location, such as the one above.
You are asked to enter a directory to install WTK. Just pick somewhere out of the way, probably in your home directory unless you want to share it with other users.
Step 4: Add the WTK platform to NetBeans.
Now that WTK is installed, we can fix the above issue in NetBeans.
In the New Mobile Application dialogue (heading should be Install Platform), click Install SDK/Platform/Emulator. (You can access this from the Tools -> Java Platforms menu also).
Click the Add Platform button, choose Java ME MIDP Platform Emulator, and then you will be asked to “choose a directory to search for platforms”. Choose the directory where you installed WTK. It should have a special icon. Now it should do some detection magic, and install a platform with a checked checkbox in the Add Java Platform window.
Click Next a few times, and you will see the Java Platform Manager screen with a J2ME folder, and the “Sun Java(TM) Wireless Toolkit 2.5.1 for CLDC” under it.
Now you can complete the wizard to create a mobile application with MIDP! It even has a checkbox to create a little “Hello World” app. Now to get the damn thing running …
Links
- How do I install Java?
http://java.sun.com/products/sjwtoolkit/download-2_5_1.html
http://blog.sudobits.com/2011/04/30/how-to-install-netbeans-ide-on-ubuntu-11-04/
- http://blog.sudobits.com/2011/04/30/how-to-install-netbeans-ide-on-ubuntu-11-04/
source