Axeva
Axeva

Reputation: 4737

PhoneGap CreateProcess build errors. C:\Program not found

I've been building PhoneGap apps for BlackBerry for about a year now. Suddenly, the build process is hitting errors like this:

build:
     [exec] [INFO]                      Parsing command line options
     [exec] [INFO]                      Parsing bbwp.properties
     [exec] [INFO]                      Validating application archive
     [exec] [INFO]                      Parsing config.xml
     [exec] [WARNING]                   Failed to find the <author> element
     [exec] [INFO]                      Populating application source
     [exec] [INFO]                      Compiling BlackBerry WebWorks applicatio
n
     [exec] I/O Error: Cannot run program "C:\Program": CreateProcess error=2, T
he system cannot find the file specified
     [exec] [ERROR]                     RAPC exception occurred

I suspect this may have something to do with a recent Java update (Java 7 maybe?)

I've tried the old DOS 8.3 trick of using PROGRA~1 instead of Program Files in the bbwp.properties and project.properties files. None of that seems to help.

Any ideas where else the problem might reside?

Upvotes: 2

Views: 950

Answers (2)

Carlos487
Carlos487

Reputation: 1489

The problem is that Webworks installer copies the JAVA PATH to a couple of files:

installvariables.properties (<java>XXXXXXXXXXX</java>)
bin\bbwp.properties (Java_Home=XXXXXXXXXXXX)

That leads to errors when compiling, even if you have changed your PATH variables and JAVA instalation.

Change the value to the correct path in these files to solve the problem.

Is recommendable to install all this stuff in non-whitespace paths because that could lead to other compiling problems.

Upvotes: 0

Axeva
Axeva

Reputation: 4737

I've seen a few other people out on the Internet asking the same question, so I'll post my solution here in case it helps those who hit the problem in the future.

The root of the problem seems to be related to the upgrade to Java 7. The combination of it and Apache Ant get hung up on file paths with spaces. After hours of tinkering, the best solution was to reinstall Java, Apache Ant, WebWorks and PhoneGap. Each were placed in a folder off the root of the C:\ drive with no spaces in the filenames.

C:
 ├ \ant
 ├ \java
 ├ \phonegap
 └ \webworks

Once I had this org structure, and reset all of the environment variables (PATH, JAVA_HOME, ANT_HOME, etc.) the builds all started working again. Just make sure you update your project.properties file in your project folder.

Update:

It may also be helpful to use the DOS Where command to see where Java resides on your hard drive.

> where java

In my case, the JAVA_HOME path pointed to Java 1.6, but a check of the Java version from the command line (java -version) showed that Java 1.7 was being run. The reason was that Java.exe had been installed in my C:\Windows\System32 folder (why?), and since that folder is the first entry in my PATH variable, that version of java.exe is what gets run. Always.

Bottom line: Use the DOS Where command to ensure the version of java being run by ANT is really the version you think it is.

Upvotes: 1

Related Questions