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



我在命令提示符下使用ant中的phonegap blackberry。Windows 7,64x,可以肯定Java SDK是32位的。(http://wiki.phonegap.com/w/page/31930982/Getting-Started-with-PhoneGap-BlackBerry-WebWorks)

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:
 generate-cod-name:
 [echo] Generated name: PhoneGapSample.cod
clean:
 [delete] Deleting directory C:BBWWphonegapsamplebuild
package-app:
[mkdir] Created dir: C:BBWWphonegapsamplebuildwidget
 [copy] Copying 9 files to C:BBWWphonegapsamplebuildwidget
  [zip] Building zip: C:BBWWphonegapsamplebuildPhoneGapSample.zip
build:
 [exec] [ERROR]             Failed to run launch java.exe.
BUILD SUCCESSFUL
Total time: 0 seconds

我真的不知道我需要什么环境变量,但我像phonegap教程一样设置它:

用户变量JAVA_HOME设置为:

C:Program Files (x86)Javajdk1.7.0;%JAVA_HOME%bin in system

你知道我错过了什么吗?

ant -d blackberry build:错误

Setting project property: properties.blackberry.bbwp.bin -> C:BBWWbbwp.exe
[available] Found: C:BBWWbbwp.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:BBWWbbwp.exe' with arguments:
     [exec] 'C:BBWWphonegapsamplebuildPhoneGapSample.zip'
     [exec] '/o'
     [exec] 'C:BBWWphonegapsamplebuild'
     [exec]
     [exec] The ' characters around the executable and arguments are
     [exec] not part of the command.
Execute:Java13CommandLauncher: Executing 'C:BBWWbbwp.exe' with arguments:
'C:BBWWphonegapsamplebuildPhoneGapSample.zip'
'/o'
'C:BBWWphonegapsamplebuild'
The ' characters around the executable and arguments are
not part of the command.
   [subant] Exiting C:BBWWphonegapsampleblackberry.xml.
BUILD FAILED
C:BBWWphonegapsamplebuild.xml:39: The following error occurred while executi
ng this line:
C:BBWWphonegapsampleblackberry.xml:156: The following error occurred while e
xecuting this line:
C:BBWWphonegapsampleblackberry.xml:182: Execute failed: java.io.IOException:
 Cannot run program "C:BBWWbbwp.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:BBWWphonegapsample>

来自ant -diagnostics:的JAVA信息

java.runtime.name : Java(TM) SE Runtime Environment
sun.boot.library.path : C:Program Files (x86)Javajdk1.7.0jrebin
java.vm.version : 21.0-b17
ant.library.dir : C:ANTlib
user.country.format : GB
java.vm.vendor : Oracle Corporation
java.vendor.url : http://java.oracle.com/
path.separator : ;
java.vm.name : Java HotSpot(TM) Client VM
file.encoding.pkg : sun.io
user.script :
user.country : US
sun.java.launcher : SUN_STANDARD
sun.os.patch.level : Service Pack 1
java.vm.specification.name : Java Virtual Machine Specification
user.dir : C:BBWWphonegapsample
java.runtime.version : 1.7.0-b147
java.awt.graphicsenv : sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs : C:Program Files (x86)Javajdk1.7.0jrelibendorsed
os.arch : x86
java.vm.specification.vendor : Oracle Corporation
user.variant :
os.name : Windows 7
ant.home : C:ANT
sun.jnu.encoding : Cp1252
java.library.path : C:Program Files (x86)Javajdk1.7.0bin;C:WindowsSunJava
bin;C:Windowssystem32;C:Windows;%CommonProgramFiles%Microsoft SharedWindow
s Live;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem
32WindowsPowerShellv1.0;C:ANTbin;C:Program Files (x86)QuickTimeQTSystem
  ;%JAVA_HOME%bin;C:Program Files (x86)Javajdk1.7.0bin;.
java.specification.name : Java Platform API Specification
java.class.version : 51.0
sun.management.compiler : HotSpot Client Compiler
os.version : 6.1
java.awt.printerjob : sun.awt.windows.WPrinterJob
java.specification.version : 1.7
file.encoding : Cp1252
java.class.path : C:ANTlibant-launcher.jar;C:Program Files (x86)Javajdk1.7
.0bin;C:ANTlibant-antlr.jar;C:ANTlibant-apache-bcel.jar;C:ANTlibant-a
pache-bsf.jar;C:ANTlibant-apache-log4j.jar;C:ANTlibant-apache-oro.jar;C:A
NTlibant-apache-regexp.jar;C:ANTlibant-apache-resolver.jar;C:ANTlibant-a
pache-xalan2.jar;C:ANTlibant-commons-logging.jar;C:ANTlibant-commons-net.j
ar;C:ANTlibant-jai.jar;C:ANTlibant-javamail.jar;C:ANTlibant-jdepend.jar
;C:ANTlibant-jmf.jar;C:ANTlibant-jsch.jar;C:ANTlibant-junit.jar;C:ANT
libant-junit4.jar;C:ANTlibant-launcher.jar;C:ANTlibant-netrexx.jar;C:ANT
libant-swing.jar;C:ANTlibant-testutil.jar;C:ANTlibant.jar;C:Program Fil
es (x86)Javajdk1.7.0libtools.jar
java.vm.specification.version : 1.7
sun.arch.data.model : 32
java.home : C:Program Files (x86)Javajdk1.7.0jre
sun.java.command : org.apache.tools.ant.launch.Launcher -cp C:Program Files (x8
6)Javajdk1.7.0bin -diagnostics
java.specification.vendor : Oracle Corporation
user.language : en
awt.toolkit : sun.awt.windows.WToolkit
java.vm.info : mixed mode
java.version : 1.7.0
java.ext.dirs : C:Program Files (x86)Javajdk1.7.0jrelibext;C:WindowsSun
Javalibext
sun.boot.class.path : C:Program Files (x86)Javajdk1.7.0jrelibresources.jar
;C:Program Files (x86)Javajdk1.7.0jrelibrt.jar;C:Program Files (x86)Java
jdk1.7.0jrelibsunrsasign.jar;C:Program Files (x86)Javajdk1.7.0jrelibjs
se.jar;C:Program Files (x86)Javajdk1.7.0jrelibjce.jar;C:Program Files (x8
6)Javajdk1.7.0jrelibcharsets.jar;C:Program Files (x86)Javajdk1.7.0jrec
lasses
java.vendor : Oracle Corporation
file.separator : 
java.vendor.url.bug : http://bugreport.sun.com/bugreport/
sun.cpu.endian : little
sun.io.unicode.encoding : UnicodeLittle
sun.desktop : windows
sun.cpu.isalist : pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86

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

看起来BlackBerry WebWorks安装有问题,Windows抱怨C:BBWWbbwp.exe不是正确的exe文件。

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

C:BBWWbbwp.exe C:BBWWphonegapsamplebuildPhoneGapSample.zip /o C:BBWWphonegapsamplebuildPhoneGapSample.zip

看看问题是否出现。如果是,请尝试重新安装BBWW。

请在blackberry.xml文件中将BlackBerry WebWorks 2.1.0.13的bbwp.exebbwp.bat更改为webworks.bat,如下所示:

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}/webworks.bat">
<equals arg1="${isMacOSX}" arg2="true" />

相关内容

  • 没有找到相关文章