簡體   English   中英

使用Ant生成工具生成錯誤“無法打開文件'C:\\ Program':[Errno 2]沒有此類文件或目錄”

[英]Build error using Ant build tool “can't open file 'C:\Program': [Errno 2] No such file or directory”

我將Python配置為path變量,下面是path變量的內容

%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%systemroot%\system32\windowspowershell\v1.0\;C:\Python27\;c:\program files\java\jdk1.7.0_03\bin;.;c:\program files\tortoisesvn\bin;d:\apache-ant-1.8.3\bin;c:\program files\ibm\gsk8\lib;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;%M2_HOME%\bin;C:\Program Files\Lenovo\Bluetooth Software\;

為什么配置Python意味着我要使用ant build和installj創建exe文件

<target name="installer.izpack.exe" depends="installer.izpack" description="build release executable izpack installer">
    <exec executable="python" failonerror="true">
        <arg line="${installer.izpack.dir}/utils/wrappers/izpack2exe/izpack2exe.py"/>
        <arg line="--file=${basedir}/installer/EasyIT-installer.jar"/>
        <arg line="--output=${basedir}/installer/EasyIT-installer.exe"/>
        <arg line="--no-upx"/>
    </exec>
</target>

但是在構建應用時出現以下錯誤:

installer.izpack.exe:
     [exec] python: can't open file 'C:\Program': [Errno 2] No such file or directory

BUILD FAILED
E:\Java Projects\Spark Projects\EastIT - Copy\build\build.xml:873: exec returned: 2

Total time: 51 seconds

您的路徑中有空格,例如

c:\program files\java\jdk1.7.0_03\bin

您必須引用路徑,如下所示:

"c:\program files\java\jdk1.7.0_03\bin"

並非100%知道Python,但這應該可行:

%systemroot%\\ system32;%systemroot%;%systemroot%\\ system32 \\ wbem;%systemroot%\\ system32 \\ windowspowershell \\ v1.0 \\; C:\\ Python27 \\;“ c:\\ program files \\ java \\ jdk1.7.0_03 \\ bin“;。; c:\\ program files \\ tortoisesvn \\ bin; d:\\ apache-ant-1.8.3 \\ bin; c:\\ program files \\ ibm \\ gsk8 \\ lib; C:\\ PROGRA〜1 \\ IBM \\ SQLLIB \\ BIN; C:\\ PROGRA〜1 \\ IBM \\ SQLLIB \\ FUNCTION; C:\\ PROGRA〜1 \\ IBM \\ SQLLIB \\ SAMPLES \\ REPL;%M2_HOME%\\ bin;“ C:\\ Program Files \\ Lenovo \\ Bluetooth Software \\ “;

請注意,您的某些路徑組件被縮短為8.3長度兼容(它們中有〜)。 如果您不喜歡引號或不適用於Python,則可以使用以下命令

目錄/ x

以獲取每個路徑組件的簡化版本,例如在我的系統上

06/12/2012  09:09 AM    <DIR>          PROGRA~1     Program Files
06/12/2012  09:08 AM    <DIR>          PROGRA~2     Program Files (x86)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM