Fixing issues with PhoneGap for WebOS on 64-bit Windows

Problem

Recently I was told that in near future I might start working on a project using PhoneGap to create a pilot application for iOS and possibly later use it for other mobile platforms. I have been working with HTML/JavaScript/CSS stack for quiet a while  but I had no experience with mobile development in general and toolset that PhoneGap provides in particular. So I decided that I would start playing with it as soon as I find some spare time so that when time for the project is allocated, I will have some basic understanding of the platform. I do not have an iPad or any OS X devices at home, but I do have Windows machines and TouchPad I picked up during the fire sale which is left unused most of the time, so I decided I will go ahead and use it for PhoneGap development. As it happens sometimes when you start working with a new toolset, you are up to a bumpy start having the development environment set up.

After following the instructions and installing Java, webOS SDK, cygwin and downloading the latest copy of PhoneGap I proceeded to deploying and running the “Hello World” app on my TouchPad. Before I got it actually running, I had to solve the following problems:

  • Running make in cygwin resulted in "palm-package: Command not found Makefile:36: recipe for target 'package' failed make: ***[package] Error 127"
  • Running make after fixing the problem above resulted in "error: 64-bit java required"

If you came across the same problems, here is how to solve them.

 

 

Solution: Short version

  • Go to "directory_where_you_extracted_PhoneGap\lib\webos" folder. Open the Makefile file in the text editor of your choice and search for the term “palm-“. You will find three entries: palm-package, palm-install and palm-launch. Change them by appending “.bat” to the end of the commands, so that they become palm-package.bat, palm-install.bat and palm-launch.bat. Save the file.
  • Now make sure that you installed 64-bit version of Java. You can check it by running “java –version” command in cmd.exe. Next, add path for the Java’s bin directory (typically “C:\Program Files\Java\jre6\bin”) to the Path environment variable (Computer->Properties->Advanced system settings->Environment variables). Make sure to restart cygwin’s bash terminal if it was open, since it copies the windows’ environment variables when it starts.

 

 

Solution: Long version

After having all the prerequisites installed, I opened the PhoneGap\lib\webos directory in cygwin’s bash terminal and ran make command per documentation. Instead of getting the app up and running on my touchpad I was presented with palm-package: Command not found error:

palm_package_error

To verify that the command is indeed unavailable and it’s not just some problem with the Makefile itself (the Makefile is the target for the make command), I ran “which” command:

which_palm_package

My first suspicion was that webOS SDK did not add itself to the Path environment variable. So I fired up cmd.exe and tried palm-package command to see if it works outside cygwin:

cmd_palm_package

As you can see, it works just fine in cmd.exe. So I went to %ProgramFiles(x86)%/Palm/SDK/bin to check what palm-package command actually resolves into:

explorer_palm_package

Palm-package command resolves into palm-package.bat file. Interesting, looks like cygwin is able to call *.exe files just fine, but *.bat files are not found. To verify this I ran “which” command in cygwin’s terminal for palm-package.bat:

which_palm_package_bat

Well, cygwin found it! Quick trip to Google also confirms that this is a known problem. Now that I knew what the problem is the only thing left was to change the Makefile to use [command].bat instead of [command]. Searching inside the Makefile revealed 3 entries in the file that needed to be changed:

makefile_original

So I added .bat extension to the commands:

makefile_modified

Now it all should work and I should finally see my app running on my TouchPad. But wait, what is this?

64bit_java_required_error

I knew for sure that Java was installed. Running “java –version” in cmd.exe showed that it is indeed installed. One thing that I noticed though, was that  I actually have 32-bit version of Java installed and webOS SDK requires 64-bit version. Turned out that there is almost an unnoticeable link “all Java downloads here” on Java download page, which lets you pick between 32- and 64-bit versions of Java. I quickly uninstalled the 32-bit version and installed 64-bit one, ran make in cygwin, but still got the same error. This time I actually went  to Computer->Properties->Advanced system settings->Environment variables and added “C:\Program Files\Java\jre6\bin” to the system’s Path variable. I restarted cygwin’s terminal (it copies Windows environment variables when it starts), changed directory to _PhoneGap_folder/lib/webos, ran make command one more time and voilà – the application is up and running on the TouchPad!

Print | posted @ Sunday, April 22, 2012 2:56 PM

Comments on this entry:

No comments posted yet.

Post A Comment
Title:
Name:
Email:
Comment:
Verification: