Developing Series 40 apps on Linux
This article explains how to use the Nokia SDK 2.0 for Java and Nokia Asha SDK 1.0 under Linux with WINE.
Note: This is an entry in the Asha Touch Competition 2012Q3
It is fully possible to develop Java ME and Nokia Asha Web Apps on Linux. The Web Apps development environment is available as a native applications for Linux (.deb package for Ubuntu/Debian) and does not require anything extra. Java ME apps can be developed in NetBeans or Eclipse and tested using the Oracle/Sun Java ME device emulators available in the Jave ME SDK. The emulator is also available integrated with your NetBeans installation.
Unfortunately the Nokia Series 40 SDK are not available as native Linux applications so integration with the NetBeans IDE is not possible. But, thanks to Wine, that lets you run Windows software under Linux, it is possible to still run the Nokia device emulation environments on Linux. Obviously this is only possible on 32-bit i386 Linux environments.
To start with you need to install a bit of software on your system first. Install, in order:
First you need to have Wine installed on your Linux system. How that is done depends on your distribution, but for example under Ubuntu or Debian, this should do the trick:
apt-get install wine1.4
Check the Wine download page for instructions and packages for other distributions.
Optionally, if you prefer to build wine from sources yourself, you can download the sources and do the autoconf/make dance:
tar zxvf wine-1.4.1.tar.bz2 cd wine-1.4.1 ./configure --prefix=/opt/wine-1.4 make && make install
The SDK need a Java environment to run. It needs to be the Windows version, download from here. The pre Asha 1.0 SDK run with JRE 6, Asha SDK needs JRE 7.
The new Asha SDK needs JRE 7, but you must install an older version, JRE 7 u17, as the emulator refuses to start if any later is installed. [Download from Oracle or use google to find jre-7u17-windows-i586.exe.
Download the 32-bit Java SE 6 Update 33 JRE off-line installer for Windows, jre-6u33-windows-i586.exe.
Now drop to a terminal (or depending on your distribution, double-click the .exe and wine should start it automatically) and cd to the location where you saved the jre installer. Then run it with wine:
Click through the normal installation wizard and the JRE should now be installed on your wine system.
Nokia Java SDKs
Now you can install the Nokia Java SDKs, available for download here. I had problems with the on-line installers, downloads got stuck, so I recommend using the larger off-line versions.
I've installed and tested versions 1.1, 2.0 and the Asha SDK 1.0 successfully.
Start the SDK installers the same way as you did the the JRE and click trough the install wizard again.
And depending on your Linux environment, you should have the emulator icons on your desktop.
Now you should be able to start the emulator(s) as any other program.
The Nokia SDK 2.0 comes with a device emulator and an IDE (Eclipse). The IDE will run under Wine, but unfortunately the Wine implementation of reg.exe does not support the QUERY parameter, which prevents it from seeing the installed SDKs and device emulators and because of that refuses to create a MIDlet project without a device emulator configured. The solution is to use native NetBeans IDE. While it can't use the Windows based device emulators directly, you can either use the scripts from Developing Nokia Asha apps on Linux or the Open... option in the file menu so we are able to start the Java ME .jar files ourselves. (And also Open url... you can use that option to test Web apps on the device native browser!)
To make easier to find the built .jar files from the emulators I made a symlink from the wine environment to my NetBeans installation, like this:
user@dummy:~$ cd .wine/drive_c/ user@dummy:~/.wine/drive_c$ ln -s /home/user/NetBeansProjects
As the SDKs won't integrate with the native NetBeans, you need to add any extra .jar files (for example the Maps API or other Nokia SDK specific libraries) yourself to your project from the Project Properties -> Libraries & Resources tab.
Testing Java apps
Now you should have everything you need. You can test the emulators by creating a Hello World app in NetBeans and then opening the .jar from the emulator.
Series 40 Web apps
As mentioned in the introduction, the Web Apps development environment is available as a native Linux applications. Everything should work fine under Linux using it and you can follow directly any documentation available.
Testing your web apps can be done directly in the IDE, using local or cloud based preview. These are not perfect emulations of the Nokia Browser on the real devices, but as far as I know, the device emulators that come with the Java ME SDKs have the real native browsers installed. It is possible to test Web Apps under the device emulators, copy&paste the URL given by the Web Tools when deploying and use the Open url... option in the emulators.
Now you should be able to develop and test Java ME apps under Linux with the Nokia Series 40 device emulators! Enjoy.