[TIP] Mobility Pack on Mac

UPDATE: Follow this link for update about 6.1 release and Mac. You can find setup for 6.0 in comments.

There is no official build of Mobility Pack for Mac. There exist a trick/hack how to use Mobility Pack on Mac. I'd like to say that everything that is written bellow is on your own risc and do not expect any support from Mobility Pack side when an problem occurs. I just wanted to try it on Mac and share this information with you.


Install IDE and Emulator
Download NetBeans5.0 (FCS for Mac and install it. There isn't a build of Mobility Pack for MacOS but you can install it on windows or linux and then just pack or copy directory '{nb_install}/mobility7.2'. Unzip it then to your NetBeans installation directory on Mac. You can start NetBeans now. The Mobility Pack should be available in IDE. You can create a Mobile project but you cannot run it yet. We need an emulator first.
There is free emulator working on MacOS - mpowerplayer. Download it, unzip and then change preverify({mpp_install}/osx/preverify/preverify}) to be runable (chmod +x).

Add Emulator Platform to IDE
Go to Tools > Java Platform Manager, press Add Platform... button. Then select Custom Java Micro Edition Platform Emulator and 'Next'

Set up Platform Home to the mpowerplayer installation directory. 'Platform Name' and 'Device Name' aren't really important here. You can name it as you want e.g. 'mpowerplayer' and 'mpp'.
Set up Preverify Command to
"{platformhome}{/}osx{/}preverify{/}preverify" {classpath|-classpath "{classpath}"} -d "{destdir}" "{srcdir}"
then set up Execution Command
java -jar {platformhome}{/}player.jar {jadfile}
You will have to have java installed, of course. The IDE won't run without it anyway :)
Set up Debugger Command
java -Xdebug -Xrunjdwp:transport={debugtransport},server={debugserver},suspend={debugsuspend},address={debugaddress} -jar {platformhome}{/}player.jar {jadfile}
Press 'Next' button.

You will have to choose which jars you need in Bootstrap Libraries. You can leave all jars that IDE found for you in the list but you'll have to add classes.jar from Java. You should find it in System/Libraries/Framework/JavaVM.Framework/classes directory. Use java 1.4 or 1.3

The libraries from mpowerplayer directory enable you to develop only in MIDP1.0 and CLDC1.1. You will need libraries for MIDP2.0 and CLDC1.0 to be able to develop for this profile and configuration. You can get these libraries from the bundled WTK that is in ~/.netbeans/5.0/emulators/wtk22_win/emulator/wtk22/lib. Their names are obvious cldcapi10.jar, midpapi20.jar.
Then you can click 'Finish' and new emulator platform apprears in platform list. You can use this new platform for your projects.


Run a Project in Emulator
Create new project from File > New Project..., select Mobile and Mobile Application, click 'Next', choose a location and name for your project, let the checkbox Create Hello MIDlet checked, click 'Next', select the mpowerplayer as Emulator Platform, you can 'Finish'.
New project appears. Run it and it should compile and run in the emulator.

You are able to create, compile, debug a Java ME project in NetBeans with Mobility Pack now.

I'd like to thank to David Kopp that has found the debug command.

UPDATE: there are 2 threads solving interesting issues on http://developer.mpowerplayer.com

UPDATE for 5.5 release: After unzip of the 'mobility7.2' directory you have to add line with 'mobility7.2' to file '{nb_install}/etc/netbeans.clusters'. After restart of IDE the Mobility Pack should work.
Comments:

Excellent article, you have just removed the one reason I have for keeping a windows machine around.

I had to do a few things to get this working.

First make sure you unzip the mobilty archive from linux or windows to this dir:

NetBeansIDE5.0Beta2.app/Contents/Resources/NetBeans/

I also had to edit netbeans.conf (NetBeansIDE5.0Beta2.app/Contents/Resources/NetBeans/etc) and directly specify the 1.5 JDK (the preference app in Utilities had no effect, Netbeans was still running under 1.4)

I added:

#netbeans_jdkhome="/path/to/jdk"
netbeans_jdkhome="/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/"

I notice that the option for Midp 2.0 is not available, it is on the windows version, I can't see any good reason why not.

Posted by Keith Ahern on November 21, 2005 at 09:27 PM CET #

Hi. This article is very interesting to me. And I tried as your instruction,but build always failed,cause preverify cannot execute. Offcourse,I made it runnnable. I can't see why not.

Posted by satoshi on January 04, 2006 at 11:57 PM CET #

can you use preverify from comand line? - run it with Ant verbosity level set on verbose in Tools > Options > Miscellanous > Ant
Is the path to preverify set properly in custom platform? you can check it in Tools > Java Platform Manager

Posted by Lukas on January 05, 2006 at 10:45 AM CET #

the mpowerplayer sdk I've just downloaded supports MIDP 2.0 and the bluetooth API, provided a native JSR-82 implementation exists (I'm currently trying RXTX.org javax.comm 2.0 + javabluetooth.org) is it possible to adapt the configuration of the "Custom Java Micro Edition Platform Emulator" to enable them?

Posted by magomarcelo on January 09, 2006 at 06:44 PM CET #

Hi Lukas, I get the following error when trying to compile on OS X with NB 5.0 RC1:

Preverifying 26 file(s) into /Users/markus/Documents/Java/PeopleIS/build/preverified directory.
Error preverifying class java.lang.Class
VERIFIER ERROR java/lang/Class.newInstance0()Ljava/lang/Object;:
Illegal type in constant pool
/Users/markus/Documents/Java/PeopleIS/nbproject/build-impl.xml:399: The following error occurred while executing this line:
/Users/markus/Documents/Java/PeopleIS/nbproject/build-impl.xml:379: The following error occurred while executing this line:
/Users/markus/Documents/Java/PeopleIS/nbproject/build-impl.xml:269: Preverification failed with error code 1.
BUILD FAILED (total time: 4 seconds)

Do you have any idea on what I might have done wrong?

Regards,
Markus Svensson

Posted by Markus Svensson on January 14, 2006 at 05:30 AM CET #

2 magomarcelo: yes, just add the jars to classpath and it should work. Let me know. 2 Marcuss: Don't you use a j2se code? It looks like it try to preverify java.lang.Object Why? I don't have time right now. i'll try to look at it later - look at http://developer.mpowerplayer.com/viewtopic.php?t=160
http://developer.mpowerplayer.com/viewtopic.php?t=85

Posted by Lukas on January 16, 2006 at 06:27 AM CET #

Lukas,
magomarcelo helped me out. It turns out it doesn't like Java 1.5,but if the classes.jar file from 1.4.2 is used everything works fine.

Posted by Markus Svensson on January 16, 2006 at 08:44 AM CET #

hi, I have installed rxtx on my Macosx and i have modified the references javax.comm --> gnu.io, but I can't find the "comX" address of my bluetooth device. HCIDriver.init(new UARTTransport("?????")); I have a bluetooth device integrated in my powerbook g4 and I have added a "serial port Service" in my bluetooth preferences. Do u know something about this problem?

Posted by Aran on June 19, 2006 at 03:34 AM CEST #

Hi all Mac users, there is the mobility pack available in zip distribution. You don't have to use the zipped build from linux anymore. The zip is for NetBeans 6.0, so now it's in development stage - can be unstable. There will be a Milestones builds available together with NetBeans. I hope that you'll enjoy it. http://blogs.sun.com/lukas/entry/zip_distribution_of_mobility_pack

Posted by Lukas on September 01, 2006 at 02:07 AM CEST #

Mac users, u might be interested in following tutorial how to work with MobPack 6.0 + MPP. http://www.redclock.net/my%20pointless%20things/CA16CD9B-CEE3-424D-89CC-962E91309F4C.html

Posted by Lukas on October 21, 2006 at 07:03 AM CEST #

I'll second Markus' joy at magomarcelo suggestion, I am using Xcode 2.2 and was coming up with similiar verifier errors and a Error loading class build.\*.class error when locating the bootstrap classes with .bash and na unrecognised file error in mpowerplayer. I edited the build.xml file in the Ant template that came with mpowerplayer to look for the .../Versions/1.4.2/Classes/classes.java bootstrap and it seems to be humming along, so thanks for helping my headache. milex

Posted by milex on January 15, 2007 at 03:44 AM CET #

sdvsdv

Posted by sdvsdv on February 14, 2007 at 04:59 AM CET #

Hi Lukas,i have followed all the instructions written above but when i build the file it returns an error: /Users/Elisa/Test/nbproject/build-impl.xml:269: java.io.IOException: “/Applications/mpp-sdk/osx/preverify/preverify”: not found i don't know how to solve the problem...can you help me?thanks

Posted by italian student on June 21, 2007 at 10:14 AM CEST #

@italian student: Do you have execution rights for the preverify? This issue has beeen discussed at http://developer.mpowerplayer.com/index.php?topic=200.0

Posted by Lukas on July 13, 2007 at 03:20 AM CEST #

Hi Lukas! My question is regarding web services implemented in jax-ws and j2me wireless toolkit 2.2 and mobility 5. Our application sends records audio data of 39 seconds as maximum length to a web service. The data is converted to a string. Its size is 632,088 bytes. We have problems retrieving the string data from the web service when the data is more than 2 seconds long where the length of the 2 second recording (as a string) is 32,088 bytes. These are our observations when trying to retrieve data more than 32,088 bytes. We utilized the tcp monitor to view data flow in our ports. The data (>32088 bytes) can be seen. However in our phone emulator, the result is null. We were wondering if j2me web services has a limit in data retrieval. Moreover, if the data, for example, is more than its limit, does it accept the data partially until its limit or does it reject the data altogether, thus returning a null value? We would really appreciate any insight and/or recommendations regarding this matter. Thanks. :D Celene

Posted by celene on August 01, 2007 at 01:44 AM CEST #

Hi Celene,<br>
I have no idea what is wrong. AFAIK, there is no restriction on the length.

Posted by Lukas on August 09, 2007 at 08:56 AM CEST #

Hi Lukas

Thanks for this information regarding java me on os x; it's a great help! I have compiled additional information on how to configure os x (leopard) with netbeans 6.0 beta 2 and mobility 8. It can be found here http://brain-spanner.blogspot.com/2007/11/os-x-j2me-and-netbeans-60.html

cheers
geoff

Posted by geoff on November 06, 2007 at 12:09 PM CET #

That's cool, Geoff. Thanks for the update

Posted by Lukas on November 07, 2007 at 05:00 AM CET #

Hmmm...after selecting [finish] project creation, the windows NB window doesn't close, a few directories are created and I get the following error:

java.lang.UnsupportedClassVersionError: Bad version number in .class file

Tried on JVM 5 and 6preview9

Here's my platform...
Product Version: NetBeans IDE 6.0 (Build 200711261600)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-119
System: Mac OS X version 10.5.2 running on i386; MacRoman; en_US (nb)

Posted by EP on February 21, 2008 at 10:56 AM CET #

@EP: this error usually appears when you use a project that was compiled with different java version. Try to clean and build, restart.

Posted by Lukas on March 06, 2008 at 11:49 AM CET #

I have downloaded the mobile game which you created "LAB-6400: Create Your Own Mobile Game". I am actually using Netbeans IDE 6.5.1 to do the exercise of creating mobile game step-by-step I have managed all the exercises 1 till 3, apart from exercise 4 which I am stuck on its the connecting part. I completed all 3 exercises in Netbeans IDE 6.0.1 as you mentioned the software needed, but when I got to exercise 4 I had problem adding new configuration so I did a research came up with an idea to install Netbeans 6.5.1 which solved the configuration part know I am stuck on the part where it needs to connect to web service client, when I type the WSDL URL: http://193.86.76.42:8080/DukeHighScores/HighScoresService?WSDL and click the Retrieve WSDL button it gives the error "Download failed: I/O exception: Connection reset (Check the proxy settings.)" I have tried all the different setting even by disabling firewalls and virus software. If you could let me know what I am doing wrong and try and figure what is causing this problem, I will really appreciate your help thank you.

Posted by Isy on June 08, 2009 at 08:28 AM CEST #

I have downloaded the mobile game which you created "LAB-6400: Create Your Own Mobile Game". I am actually using Netbeans IDE 6.5.1 to do the exercise of creating mobile game step-by-step I have managed all the exercises 1 till 3, apart from exercise 4 which I am stuck on its the connecting part. I completed all 3 exercises in Netbeans IDE 6.0.1 as you mentioned the software needed, but when I got to exercise 4 I had problem adding new configuration so I did a research came up with an idea to install Netbeans 6.5.1 which solved the configuration part know I am stuck on the part where it needs to connect to web service client, when I type the WSDL URL: http://193.86.76.42:8080/DukeHighScores/HighScoresService?WSDL and click the Retrieve WSDL button it gives the error "Download failed: I/O exception: Connection reset (Check the proxy settings.)" I have tried all the different setting even by disabling firewalls and virus software. If you could let me know what I am doing wrong and try and figure what is causing this problem, I will really appreciate your help thank you.

Posted by Isy on June 08, 2009 at 08:30 AM CEST #

I have know completed all the tasks for "LAB-6400: Create Your Own Mobile Game". The problem i'm getting is "cannot connect to the server", this happens when I click on High Scores it then displays Retreiving Data and then the error message.

Posted by Isy on June 11, 2009 at 07:12 AM CEST #

I have know completed all the tasks for "LAB-6400: Create Your Own Mobile Game". The problem i'm getting is "cannot connect to the server", this happens when I click on High Scores it then displays Retreiving Data and then the error message.

Posted by Isy on June 16, 2009 at 07:13 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

This is the main channel to share news, tips and other stuff related to my work. Sometimes you can find even personal stuff. Enjoy your reading...

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
news
Blogroll

No bookmarks in folder

OldNews
MyTrash
NavBar
NetBeans
LinksToBeExpanded