×
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 -)
hamishwillee (Talk | contribs)
m (Hamishwillee - Subedited/Reviewed)
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:Tools for Java ME]][[Category:Deployment/Installation on Java ME]][[Category:Series 40]]
+
[[Category:Tools for Java ME]][[Category:Nokia Asha Web Apps]][[Category:Tools]][[Category:SDK]][[Category:IDE]][[Category:Linux]][[Category:Series 40]][[Category:Nokia Asha]][[Category:Nokia Asha Platform 1.0]]
 
{{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}}
 +
{{SeeAlso|
 +
* [[Developing Nokia Asha apps on Linux]]
 +
* [[Developing Nokia Asha apps on Linux with Netbeans]]
 +
* [[Developing Series 40 apps on Linux]]}}
 
{{ArticleMetaData <!-- v1.2 -->
 
{{ArticleMetaData <!-- v1.2 -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
Line 6: Line 10:
 
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 
|sdk=[https://developer.nokia.com/Develop/asha/java/ Nokia Asha SDK 1.0]
 
|sdk=[https://developer.nokia.com/Develop/asha/java/ Nokia Asha SDK 1.0]
|platform= Series 40
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 
 
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 
 
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 
|translated-by= <!-- [[User:XXXX]] -->
 
|translated-by= <!-- [[User:XXXX]] -->
Line 25: Line 26:
  
 
==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 can also be integrated with your NetBeans or Eclipse 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 application 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 (thus there is no speed overhead in the IDE itself). 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.
  
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 [[Developing Series 40 apps on Linux|Series 40 SDKs on Linux]], but the integration scripts will need to be adapted for the different paths.
  
 +
[[File:Java emu running.png|thumb|none|500px|Nokia Asha SDK 1.0 running under Wine]]
  
 
==Installation==
 
==Installation==
  
To start with you need to install a bit of software on your system first. Install, in order:
+
To start with you need to install some software on your Linux system.  
 +
 
 +
Install, in order:
 
* [http://www.winehq.org/ Wine]
 
* [http://www.winehq.org/ Wine]
 
* [http://java.com/en/download/manual.jsp?locale=en The 32bit Java JRE for '''Windows''']
 
* [http://java.com/en/download/manual.jsp?locale=en The 32bit Java JRE for '''Windows''']
Line 40: Line 48:
  
 
===Wine===
 
===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.  
+
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''.  
  
[[image:Ubuntu SW center wine.png||Install Wine from the Ubuntu software center]]  
+
[[File:Ubuntu SW center wine.png|frame|none|Install Wine from the Ubuntu software center]]  
  
 
If you prefer the console, on deb-based systems just enter from the command line:
 
If you prefer the console, on deb-based systems just enter from the command line:
 
+
<code bash>sudo apt-get install wine</code>
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. The approach has been verified on Wine 1.4 and Wine 1.6
 
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
Line 52: Line 59:
 
===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. [[image:JRE install.png|thumb|Install JRE from Ubuntu]] The terminal equivalent is
+
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.  
 +
[[File:JRE install.png|none|frame|Install JRE from Ubuntu]]  
  
wine /path/to/jre-7u25-windows-i586.exe
+
The terminal equivalent is
 +
<code bash>wine /path/to/jre-7u25-windows-i586.exe</code>
  
 
===Emulator===
 
===Emulator===
Now you can install the Nokia Java SDKs, available from [https://developer.nokia.com/Develop/asha/java/ here]. Always use the offline installers. Under Ubuntu, you can double-click the Nokia Asha SDK installer just as you did the JRE. [[image:Nokia Asha SDK install.png|thumb|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.
+
Now you can install the Nokia Java SDKs, available from [http://developer.nokia.com/Develop/asha/java/ here]. Always use the offline installers.  
  
[[Image:Java emu running.png||Nokia Asha SDK 1.0 running under Wine]]
+
Under Ubuntu, you can double-click the Nokia Asha SDK installer just as you did the JRE. 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.
 +
 
 +
[[File:Nokia Asha SDK install.png|frame|none|Install Nokia Asha SDK 1.0 from Ubuntu]]  
  
 
===Running Java ME apps in the emulator/SDK===
 
===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.
+
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.
  
[[File:Open JAR from emu.png||Open JAR]]
+
[[File:Open JAR from emu.png|frame|none|Open JAR]]
  
Here's an example how the [https://projects.developer.nokia.com/asha_ui_component_demos Asha UI Component demos] looks like when opened via the above method.  
+
The image in the [[#Introduction|introduction]] shows what the [https://projects.developer.nokia.com/asha_ui_component_demos Asha UI Component demos] looks like when opened via the above method.  
  
 
===Enabling the SDK for IDE usage===
 
===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|these two scripts]] need to be added to the SDK install. Extract and copy them to the ''bin'' directory of the SDK.
+
Java defines the mechanism for how SDKs and emulators are identified and invoked by SDKs. In order for this to work with the Linux IDEs, [[:File:Emulator preverify.zip|these two scripts]] need to be added to the SDK install. Extract and copy them to the ''bin'' directory of the SDK.
  
[[File:Asha SDK Linux scripts.png|Copy emulator and preverify scipts]]
+
[[File:Asha SDK Linux scripts.png|frame|none|Copy emulator and preverify scipts]]
  
 
Plaintext clipboard-friendly version:
 
Plaintext clipboard-friendly version:
Line 84: Line 95:
 
This should be enough to make our SDK install fully functional. By invoking the emulator script, we can verify if everything is installed correctly.
 
This should be enough to make our SDK install fully functional. By invoking the emulator script, we can verify if everything is installed correctly.
  
[[File:Asha SDK Linux versionquery.png||Query emulator parameters]]
+
[[File:Asha SDK Linux versionquery.png|frame|none|Query emulator parameters]]
  
 
Plaintext clipboard-friendly version:
 
Plaintext clipboard-friendly version:
Line 91: Line 102:
 
  ~/.wine/drive_c/Nokia/Devices/Nokia_Asha_SDK_1_0/bin/emulator -Xquery 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.
+
{{Note|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 hard-coded 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==
 
==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 [http://www.developer.nokia.com/Develop/Series_40/Series_40_web_apps/Documentation/ documentation available].
+
The Web Apps development environment is available as a set of native Linux applications. Everything should work fine under Linux "out of the box" - you can follow the instructions in the [http://www.developer.nokia.com/Develop/Series_40/Series_40_web_apps/Documentation/ documentation] for installation and configuration.
 +
 
 +
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.
  
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.
+
Alternatively, the device emulators that come with the Java ME SDKs have the real native browsers installed. To test the 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==
 
==Conclusion==
Now you should be able to develop and test Java ME apps under Linux with the Nokia Series 40 device emulators! Enjoy.
+
Now you should be able to develop and test Java ME apps under Linux with the Nokia Asha (and Series 40) device emulators! Enjoy.

Revision as of 03:07, 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: hamishwillee (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 application 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.

Nokia Asha SDK 1.0 running under Wine

Installation

To start with you need to install some software on your Linux system.

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. 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.

Install Nokia Asha SDK 1.0 from Ubuntu

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

The image in the introduction shows what the Asha UI Component demos looks like when opened via the above method.

Enabling the SDK for IDE usage

Java defines the mechanism for how SDKs and emulators are identified and invoked by SDKs. In order for this to work with the Linux IDEs, these two scripts 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

Note.pngNote: 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 hard-coded 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

The Web Apps development environment is available as a set of native Linux applications. Everything should work fine under Linux "out of the box" - you can follow the instructions in the documentation for installation and configuration.

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.

Alternatively, the device emulators that come with the Java ME SDKs have the real native browsers installed. To test the 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 Asha (and Series 40) device emulators! Enjoy.

534 page views in the last 30 days.
×