×
Namespaces

Variants
Actions
(Difference between revisions)

Developing Nokia Asha apps on Linux

From Nokia Developer Wiki
Jump to: navigation, search
achipa (Talk | contribs)
m (Achipa -)
achipa (Talk | contribs)
m (Achipa -)
Line 24: Line 24:
  
 
==Introduction==
 
==Introduction==
It is fully possible to develop [http://www.developer.nokia.com/Develop/Java/Getting_started/Java_ME/ Java ME] and Nokia Asha Web Apps on Linux. The [http://www.developer.nokia.com/Develop/Series_40/Series_40_web_apps/ 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 [http://java.sun.com/javame/sdk/ Jave ME SDK]. The emulator is also available integrated with your NetBeans installation.
+
It is fully possible to develop [http://www.developer.nokia.com/Develop/Java/Getting_started/Java_ME/ Java ME] and Nokia Asha Web Apps on Linux. The [http://www.developer.nokia.com/Develop/Series_40/Series_40_web_apps/ 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 [http://java.sun.com/javame/sdk/ Jave ME SDK]. The emulator can also be integrated with your NetBeans or Eclipse installation.
  
While the Nokia Asha SDK is not available as native Linux applications, we can use the toolchain and emulator via Wine from IDEs like Netbeans or Eclipse running natively on Linux. This is only possible on 32-bit i386 Linux environments.
+
While the Nokia Asha SDK is not available as native Linux applications, we can use the toolchain and emulator via Wine from IDEs like Netbeans or Eclipse running ''natively'' on Linux (thus there is no speed overhead in the IDE itself). This is only possible on 32-bit i386 Linux environments.
  
 
==Installation==
 
==Installation==
Line 34: Line 34:
 
* [http://java.com/en/download/manual.jsp?locale=en The 32bti Java JRE for '''Windows''']
 
* [http://java.com/en/download/manual.jsp?locale=en The 32bti Java JRE for '''Windows''']
 
* [http://www.developer.nokia.com/Develop/Java/Tools/Series_40_platform_SDKs/ Nokia Asha SDK 1.0]
 
* [http://www.developer.nokia.com/Develop/Java/Tools/Series_40_platform_SDKs/ Nokia Asha SDK 1.0]
* NetBeans and/or Eclipse
 
  
 
===Wine===
 
===Wine===
Line 45: Line 44:
 
sudo apt-get install wine
 
sudo apt-get install wine
  
Check the [http://www.winehq.org/download/ Wine download page] for instructions and packages for other distributions or newer version of Wine.
+
Check the [http://www.winehq.org/download/ Wine download page] for instructions and packages for other distributions or newer version of Wine. The approach has been verified on Wine 1.4 and Wine 1.6
  
 
===JRE===
 
===JRE===
 +
 
The new Asha SDK needs a JRE. Remember to install the (32bit) '''Windows''' version of the JRE from [http://java.com/en/download/manual.jsp?locale=en here]. If you're running Ubuntu and have installed wine, just double-click the JRE exe file
 
The new Asha SDK needs a JRE. Remember to install the (32bit) '''Windows''' version of the JRE from [http://java.com/en/download/manual.jsp?locale=en here]. If you're running Ubuntu and have installed wine, just double-click the JRE exe file
  

Revision as of 19:57, 23 July 2013

This article explains how to use the Nokia Asha SDK 1.0 under Linux with WINE.

Article Metadata
Tested withCompatibilityArticle
Created: achipa (21 Jul 2013)
Last edited: achipa (23 Jul 2013)

Contents

Introduction

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 can also be integrated with your NetBeans or Eclipse installation.

While the Nokia Asha SDK is not available as native Linux applications, we can use the toolchain and emulator via Wine from IDEs like Netbeans or Eclipse running natively on Linux (thus there is no speed overhead in the IDE itself). This is only possible on 32-bit i386 Linux environments.

Installation

To start with you need to install a bit of software on your system first. Install, in order:

Wine

First you need to have Wine installed on your Linux system. How that is done depends on your distribution, under ubuntu you can do it via the Ubuntu software center

Install Wine from the Ubuntu software center

If you prefer the console, on deb-based systems just enter from the command line:

sudo apt-get install wine

Check the Wine download page for instructions and packages for other distributions or newer version of Wine. The approach has been verified on Wine 1.4 and Wine 1.6

JRE

The new Asha SDK needs a JRE. Remember to install the (32bit) Windows version of the JRE from here. If you're running Ubuntu and have installed wine, just double-click the JRE exe file

Install JRE from Ubuntu

the terminal equivalent is

wine /path/to/jre-7u25-windows-i586.exe

Nokia Java SDKs

Now you can install the Nokia Java SDKs, available from here. Always use the offline installers. Under Ubuntu, you can double-click the Nokia Asha SDK installer just as you did the JRE.

Install Nokia Asha SDK 1.0 from Ubuntu

On the final page, uncheck launch Nokia IDE for Java - at this stage it will not function. Depending on your Linux environment, you should have the emulator icons on your desktop.

SDK emulator shortcuts

Now you should be able to start the emulator as any other program.

Nokia Asha SDK 1.0 running under Wine

Enabling the SDK for IDE usage

Java defines a way how SDKs and emulators are identified by SDKs. Unfortunately, even though the SDK's property file defines the correct executables, IDEs like netbeans look for hardcoded file names, and fails to find them. Thus, for the IDE to SDK link to work, we need to create symlinks in the SDK directory for the emulator and preverify executables.

File:SDK softlinking.png
Creating the emulator and preverify softlinks

Here's a plaintext version suitable for copy'n'paste

cd ~/.wine/drive_c/Nokia/Devices/Nokia_Asha_SDK_1_0/bin ln -s emulator.exe emulator ln -s preverify.exe preverify

Netbeans

Install the latest netbeans (in case of Ubuntu, the recommendation is to download the Java SE version from the netbeans site as the Ubuntu packages are woefully out of date as per the time of writing of this article). Still, you can install netbeans 7.0.1 from the ubuntu software center

File:Netbeans install.png
Netbeans install from the Ubuntu Software Center

or from the command line

sudo apt-get install netbeans

Note that installing netbeans will also install the JDK if you do don't have it already installed. This is not the same Java what you were installing in the previous step - the first one is a JRE for Windows, required to run the emulator, while a linux native netbeans will require a linux native JDK. After installing the Netbeans, make sure you have the Mobility plugin also installed. You can check this in the Tools->Plugins submenu as per the screens below

File:Netbeans ME install1.png
Open Tools... Plugins
File:Netbeans ME install2.png
Check installed plugins for Java ME
File:Netbeans ME install3.png
Enable Netbeans distribution if Java ME plugin is missing
File:Netbeans ME install4.png
Update repositories
File:Netbeans ME install5.png
Install mobility plugin

The symlinks

The Nokia SDK 2.0 comes with a device emulator and an IDE (Eclipse). The IDE will run under Wine, but unfortunately something 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, it can't use the Windows based device emulators directly, but fortunately the emulators have a Open... option in the file menu so we are able to start the Java ME .jar files ourself. (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.

Conclusion

Now you should be able to develop and test Java ME apps under Linux with the Nokia Series 40 device emulators! Enjoy.

301 page views in the last 30 days.