无法在ant phonegap中运行launch java.exe错误

无法在ant phonegap中运行launch java.exe错误,java,blackberry,ant,sdk,cordova,Java,Blackberry,Ant,Sdk,Cordova,我正在命令提示符下使用ant中的phonegap blackberry。Windows7,64x,相当确定JavaSDK是32位的。 () Ant工作正常,java版本返回: java version "1.7.0" Java(TM) SE Runtime Environment (build 1.7.0-b147) Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode) 然而,当我在phonegap示例文件夹中运行ant blackbe

我正在命令提示符下使用ant中的phonegap blackberry。Windows7,64x,相当确定JavaSDK是32位的。 ()

Ant工作正常,java版本返回:

java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode)
然而,当我在phonegap示例文件夹中运行ant blackberry build时,我得到:

    build:
 generate-cod-name:
 [echo] Generated name: PhoneGapSample.cod
clean:
 [delete] Deleting directory C:\BBWW\phonegap\sample\build
package-app:
[mkdir] Created dir: C:\BBWW\phonegap\sample\build\widget
 [copy] Copying 9 files to C:\BBWW\phonegap\sample\build\widget
  [zip] Building zip: C:\BBWW\phonegap\sample\build\PhoneGapSample.zip

build:
 [exec] [ERROR]             Failed to run launch java.exe.
BUILD SUCCESSFUL
Total time: 0 seconds
我不知道我需要什么样的环境变量,但我像phonegap教程那样设置它:

用户变量
JAVA\u HOME
设置为:

C:\Program Files (x86)\Java\jdk1.7.0;%JAVA_HOME%\bin in system
你知道我遗漏了什么吗

ant-d blackberry build出现错误:

Setting project property: properties.blackberry.bbwp.bin -> C:\BBWW\bbwp.exe
[available] Found: C:\BBWW\bbwp.exe
Setting project property: properties.blackberry.bbwp.exists -> true
Class java.util.Vector loaded from parent loader (parentFirst)
     [exec] Current OS is Windows 7
     [exec] Executing 'C:\BBWW\bbwp.exe' with arguments:
     [exec] 'C:\BBWW\phonegap\sample\build\PhoneGapSample.zip'
     [exec] '/o'
     [exec] 'C:\BBWW\phonegap\sample\build'
     [exec]
     [exec] The ' characters around the executable and arguments are
     [exec] not part of the command.
Execute:Java13CommandLauncher: Executing 'C:\BBWW\bbwp.exe' with arguments:
'C:\BBWW\phonegap\sample\build\PhoneGapSample.zip'
'/o'
'C:\BBWW\phonegap\sample\build'

The ' characters around the executable and arguments are
not part of the command.
   [subant] Exiting C:\BBWW\phonegap\sample\blackberry.xml.

BUILD FAILED
C:\BBWW\phonegap\sample\build.xml:39: The following error occurred while executi
ng this line:
C:\BBWW\phonegap\sample\blackberry.xml:156: The following error occurred while e
xecuting this line:
C:\BBWW\phonegap\sample\blackberry.xml:182: Execute failed: java.io.IOException:
 Cannot run program "C:\BBWW\bbwp.exe": CreateProcess error=193, %1 is not a val
id Win32 application
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        at java.lang.Runtime.exec(Runtime.java:615)
        at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Exec
ute.java:862)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
        at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
        at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
        at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:217)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.jav
a:398)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(Single
CheckExecutor.java:38)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
        at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:302)
        at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:809)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32
 application
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:188)
        at java.lang.ProcessImpl.start(ProcessImpl.java:132)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
        ... 66 more

Total time: 0 seconds

C:\BBWW\phonegap\sample>

BlackBerry WebWorks安装似乎有问题,Windows抱怨
C:\BBWW\bbwp.exe
不是正确的exe文件

尝试手动运行Ant尝试的相同命令:

C:\BBWW\bbwp.exe C:\BBWW\phonegap\sample\build\PhoneGapSample.zip /o C:\BBWW\phonegap\sample\build\PhoneGapSample.zip

看看问题是否发生了。如果是这样,请尝试重新安装BBWW。

在安装新版本的jdk后,我遇到了相同的错误。我发现bbwp在bin/bbwp.properties中保存了它的配置。将bbwp.properties中的java标记的值替换到您的正确jdk位置。

请将
bbwp.exe
bbwp.bat
更改为
webworks.bat
以便在
BlackBerry.xml
文件中使用BlackBerry webworks 2.1.0.13,如下所示:

condition property="bbwp" value="${properties.blackberry.bbwp.dir}/bbwp" else="${properties.blackberry.bbwp.dir}/bbwp.exe">
<equals arg1="${isMacOSX}" arg2="true" />
condition property=“bbwp”value=“${properties.blackberry.bbwp.dir}/bbwp”else=“${properties.blackberry.bbwp.dir}/bbwp.exe”>

改为:

condition property="bbwp" value="${properties.blackberry.bbwp.dir}/bbwp" else="${properties.blackberry.bbwp.dir}/webworks.bat">
<equals arg1="${isMacOSX}" arg2="true" />
condition property=“bbwp”value=“${properties.blackberry.bbwp.dir}/bbwp”else=“${properties.blackberry.bbwp.dir}/webworks.bat”>

您能用
-v
开关运行ant吗?这可能会提供有关问题的更多详细信息。是的,但是像往常一样附加ant目标。尝试添加
-d
,而不是
-v
,Ant将更加冗长。在您的例子中:
ant-dbblackberry build
。另外,
ant-diagnostics
可能会提供一些有用的信息。它有很多代码!我在上面编辑了我希望的主要内容?不确定是否要运行该命令,但C:\BBWW\bbwp.exe是一个0KB的应用程序&不是有效的应用程序。希望重新安装可以修复它-谢谢你的帮助-然后我遇到了一个新错误-找不到c:/程序。Java在我的(x86)文件夹中,我看到这些空间导致了问题。因此,我将Java重新安装到一个没有空格的文件夹中。并且返回了找不到java.exe错误!并且没有构建失败或bbwp.exe问题。我猜BBWP在错误的地方看到了java,所以我重新安装了BBWP。它的工作!再次感谢
condition property="bbwp" value="${properties.blackberry.bbwp.dir}/bbwp" else="${properties.blackberry.bbwp.dir}/webworks.bat">
<equals arg1="${isMacOSX}" arg2="true" />