Mobile Java development using the Eclipse IDE can be as easy as 1-2-3. Simply follow some basic setup steps and you’ll be up and running and ready to develop your “killer” mobile game or application in no time at all.
To get started on mobile Java development using Eclipse, three pieces of software is all that you need. The other software are optional and your choice will depend on which mobile phones you would want to test your mobile application.
The first thing you’ll need of course is a copy of Sun’s Java SDK (I’m using Java SDK version 1.6.). You”ll then need a copy of the Eclipse IDE (I used v3.3 in setting up my development environment), a copy of the EclipseME plugin (I used v1.7.7) and the Sun Java Wireless Toolkit (I used v2.5.2.). Below is a list of the websites where you can download the software:
- Sun’s Java SDK at http://java.sun.com download page is here.
- Sun’s Java Wireless Toolkit at http://java.sun.com/products/sjwtoolkit download page is here.
- Eclipse IDE at http://www.eclipse.org download page is here.
- EclipseME at http://www.eclipseme.org download page is here (you don’t have to manually download this one).
Installing the Java SDK is pretty straight forward. You should have no problems installing it. You might wanna look out if you have a previously installed older copy of the Java SDK on your computer that has been setup on your environment because this might cause some problems later.
You can only install the Sun Java wireless toolkit once you have installed the Java SDK. You need to install the wireless toolkit before you install EclipseME because it is the minimum requirement of EclipseME (apart from Eclipse of course ).
Downloading and installing the Eclipse IDE should also be straight forward. One note though, Eclipse has a mobile tools sub-project that you may want to take a look at later but it’s not required in this setup.
After installing the above three software, you can now install EclipseME. Installing and setting it up has several steps and I had original planned on giving you a screen by screen procedure on how to get it installed and setup. But I don’t want to duplicate the nice work done by the EclipseME guys in documenting the whole process of installation so I suggest you just go to this page to read the install procedure.
You’re done. At this point you can already start learning how to develop your own Java midlet or J2ME software. You may want to start by creating a simple program such as “Hello World” on your setup to check it before diving into creating your pet project.
There are optional software that you can install. For instance EclipseME supports ProGuard for “obfuscation”. What is obfuscation you may ask.
Well let me start by telling you a bit about how your source code is compiled. The Java compiler doesn’t turn your source code into native machine code when it compiles it. It actually turns it into bytecode with other information such as file names, class names, method names and all sorts of stuff that when someone tries to decompile it has an easier time trying to understand what your program does.
Reverse engineering your “killer” app might not be something that you want so you need an obfuscator to make it harder for people to reverse engineer your software.
But an obfuscator such as ProGuard serves other purposes as well. In fact if you think about it obfuscation is just a by-product of a more important purpose and that is optimization. Because the process removes certain unneeded data on the compiled Java program, the resulting compiled code has a smaller size. This means that your program will eat up less memory and will load faster.
There are other processes that ProGuard does in order to optimize your code. You can read about them here. A test done shows that using ProGuard can result into a 18% to 90% reduction in the size of the compiled Java bytecode. So even though you don’t need to obfuscate your code, you might still want to use ProGuard to optimize it.
The other set of optional software involves the type of mobile phones that you want your mobile software to run on. Mobile phone manufacturers have available SDK’s for the cell phones that they manufacture. Below are some of the developer sites of the mobile phone manufacturers where you can download such software (registration is required before you can download them).
Also some mobile phone manufacturers have additional services that you can avail of if you are a developer. Some, like Motorola for instance have a handset loaner program (depending on your location) that allows you to borrow different handset models to test your software. Others like Sony Ericsson has a virtual laboratory where you can remotely test your software on different mobile phone models.
One last word, you may want to also download a software called Tastephone. Tastephone allows you to test a Java-enabled mobile phone’s performance, MIDP & CLDC version, processor speed, RAM size, flash size (RMS), screen capabilities and screen quality, optional APIs provided by JSR (WMA, MMAPI, …). This will give you an idea of the performance of the mobile phone plus what features (JSR’s) are available on the cell phone.
That’s it, this should get you up and running on Java mobile development. If time permits, try to share your experiences by commenting on this post so that others may gain some wisdom on them.