×
Namespaces

Variants
Actions
(Difference between revisions)

Developing Nokia Asha apps on Linux

From Nokia Developer Wiki
Jump to: navigation, search
achipa (Talk | contribs)
(Achipa - - Installation)
achipa (Talk | contribs)
m (Achipa -)
Line 1: Line 1:
[[Category:Nokia Asha]][[Category:Linux]][[Category:Java ME]][[Category:Series 40]][[Category:IDE]][[Category:Tools for Java ME]]
+
[[Category:Nokia Asha]][[Category:Linux]][[Category:Java ME]][[Category:Series 40]][[Category:IDE]][[Category:Tools for Java ME]][[Category:Nokia Asha]][[Category:Linux]][[Category:Tools for Java ME]][[Category:Deployment/Installation on Java ME]][[Category:Series 40]]
 
{{Abstract|This article explains how to use the Nokia Asha SDK 1.0 under Linux with WINE}}
 
{{Abstract|This article explains how to use the Nokia Asha SDK 1.0 under Linux with WINE}}
 
{{ArticleMetaData <!-- v1.2 -->
 
{{ArticleMetaData <!-- v1.2 -->
Line 31: Line 31:
 
The method used here is also applicable to previous versions of the [http://developer.nokia.com/Community/Wiki/index.php?title=Developing_Series_40_apps_on_Linux Series 40 SDKs on Linux], but the integration scripts will need to be adapted for the different paths
 
The method used here is also applicable to previous versions of the [http://developer.nokia.com/Community/Wiki/index.php?title=Developing_Series_40_apps_on_Linux Series 40 SDKs on Linux], but the integration scripts will need to be adapted for the different paths
  
[[Category:Nokia Asha]][[Category:Linux]][[Category:Tools for Java ME]][[Category:Deployment/Installation on Java ME]][[Category:Series 40]]
+
 
 
==Installation==
 
==Installation==
  
Line 88: Line 88:
 
Plaintext clipboard-friendly version:
 
Plaintext clipboard-friendly version:
  
  ~/.wine/drive_c/Nokia/Devices/Nokia_Asha_SDK_1_0/bin/emulator -version
+
  ~/.wine/drive_c/Nokia/Devices/Nokia_Asha_SDK_1_0/bin/emulator -version 2> /dev/null
  ~/.wine/drive_c/Nokia/Devices/Nokia_Asha_SDK_1_0/bin/emulator -Xquery
+
  ~/.wine/drive_c/Nokia/Devices/Nokia_Asha_SDK_1_0/bin/emulator -Xquery 2> /dev/null
  
 
For the technically inclined, here is the explanation why this is required. Even though the SDK's property file defines the correct executables, IDEs like netbeans look for hardcoded file names, and fails to find them (the SDK directory has ''emulator.exe'' instead of ''emulator'', etc). The other problem is that of classpaths. The paths should be separated by a colon on Windows and a semicolon on Linux. The two scripts above thus provide the executables that can get called from the IDEs and do the string transformations so that each side (the native IDE and the SDK within wine) can exchange classpath definitions.
 
For the technically inclined, here is the explanation why this is required. Even though the SDK's property file defines the correct executables, IDEs like netbeans look for hardcoded file names, and fails to find them (the SDK directory has ''emulator.exe'' instead of ''emulator'', etc). The other problem is that of classpaths. The paths should be separated by a colon on Windows and a semicolon on Linux. The two scripts above thus provide the executables that can get called from the IDEs and do the string transformations so that each side (the native IDE and the SDK within wine) can exchange classpath definitions.

Revision as of 00:32, 24 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 (24 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.

The method used here is also applicable to previous versions of the Series 40 SDKs on Linux, but the integration scripts will need to be adapted for the different paths


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

Emulator

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 set up on your desktop. Now you should be able to start the emulator as any other program.

Nokia Asha SDK 1.0 running under Wine

Running Java ME apps in the emulator/SDK

To run a .JAR of a Java ME application, you can use the Open menu option (your native Linux filesystem is under the Z: drive). Note that the emulator automatically uses the .JAD file present in the same directory as the .JAR file.

Open JAR

Here's an example how the Asha UI Component demos looks like when opened via the above method.

Enabling the SDK for IDE usage

Java defines a way how SDKs and emulators are identified and invoked by SDKs. In order for this to work with the Linux IDEs, File:Emulator preverify.zip need to be added to the SDK install. Extract and copy them to the bin directory of the SDK.

Copy emulator and preverify scipts

Plaintext clipboard-friendly version:

cd ~/.wine/drive_c/Nokia/Devices/Nokia_Asha_SDK_1_0/bin
cp ~/Downloads/emulator .
cp ~/Downloads/preverify .
chmod +x emulator preverify

This should be enough to make our SDK install fully functional. By invoking the emulator script, we can verify if everything is installed correctly.

Query emulator parameters

Plaintext clipboard-friendly version:

~/.wine/drive_c/Nokia/Devices/Nokia_Asha_SDK_1_0/bin/emulator -version 2> /dev/null
~/.wine/drive_c/Nokia/Devices/Nokia_Asha_SDK_1_0/bin/emulator -Xquery 2> /dev/null

For the technically inclined, here is the explanation why this is required. Even though the SDK's property file defines the correct executables, IDEs like netbeans look for hardcoded file names, and fails to find them (the SDK directory has emulator.exe instead of emulator, etc). The other problem is that of classpaths. The paths should be separated by a colon on Windows and a semicolon on Linux. The two scripts above thus provide the executables that can get called from the IDEs and do the string transformations so that each side (the native IDE and the SDK within wine) can exchange classpath definitions.

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.

308 page views in the last 30 days.