【发布时间】:2013-12-10 23:15:03
【问题描述】:
我正在尝试用 java 构建一个应用程序,但我收到一条错误消息:
/home/user/Documents/Installation_Files/csa/build2/rtiperftest.1.1b/perftest_java/build.xml:97: 执行失败:java.io.IOException:无法运行程序 “/home/user/Documents/Installation_Files/csa/build2/rtiperftest.1.1b/${env.NDDSHOME}/scripts/rtiddsgen” (在目录中 “/home/user/Documents/Installation_Files/csa/build2/rtiperftest.1.1b”): error=2, 没有这样的文件或目录
env.NDDSHOME 是需要设置的环境变量吗?
在 build.xml 文件中,我还看到了 ${rtidds.rtiddsgen}、${rtidds.home}、${script.suffix} 和其他具有 ${...} 语法的文件。这是什么意思?这些都是在环境变量中定义的吗?
这里是 build.xml 文件供参考:
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: build.xml 2570 2009-05-28 14:42:37Z elaine $ Copyright 2006,
Real-Time Innovations. All rights reserved. No duplications, whole or
partial, manual or electronic, may be made without express written
permission. Any such copies, or revisions thereof, must display this
notice unaltered. This code contains trade secrets of Real-Time
Innovations, Inc. modification history:
=====================
17oct08,rbw Reorganized source files to make it easier to ship test
implementations separately 08oct08,rbw Refactored DDS dependencies to
com.rti.perftest.impl.PerfTestLauncher 20jun08,rbw javac path changes
23may08,rbw Enable preprocessor when running rtiddsgen to enable key
support 30apr08,rbw Fixed deletion order when cleaning 03apr08,rbw
Fail build when code gen fails 02apr08,rbw Created
========================================================================== -->
<project basedir=".." default="default" name="PerfTest">
<!-- ===================================================================== -->
<!-- End of $Id: build.xml 2570 2009-05-28 14:42:37Z elaine $ -->
<description> A combined throughput and latency test for RTI Data Distribution Service in Java. </description>
<!-- ================================================================= -->
<!-- Public Targets -->
<!-- ================================================================= -->
<target name="default" description="Build a JAR file containing the test" depends="build-jar">
</target>
<target name="clean" description="Delete compiled code">
<delete file="${jar.out.file}"/>
<delete dir="${javac.out.dir}"/>
</target>
<!-- ================================================================= -->
<!-- Internal Targets -->
<!-- ================================================================= -->
<target name="build-jar" depends="compile">
<echo message="Building PerfTest JAR: ${jar.out.file}"/>
<echo message="...containing classes: ${javac.out.dir}"/>
<mkdir dir="${jar.out.dir}"/>
<jar basedir="${javac.out.dir}" update="false" index="true" duplicate="fail" destfile="${jar.out.file}">
<fileset dir="." includes="**/*.class"/>
<manifest>
<attribute name="Main-Class" value="com.rti.perftest.ddsimpl.PerfTestLauncher"/>
</manifest>
</jar>
</target>
<target name="compile" depends="generate">
<echo message="Compiling PerfTest in dir: ${javac.out.dir}"/>
<echo message="...using RTI DDS JAR file: ${rtidds.jar}"/>
<mkdir dir="${javac.out.dir}"/>
<javac target="1.5" optimize="${javac.optimize}" deprecation="${javac.deprecation}" debug="${javac.debug}" destdir="${javac.out.dir}" srcdir=".">
<include name="perftest_java/**/*.java"/>
<include name="perftest_java_util/**/*.java"/>
<classpath>
<pathelement path="${rtidds.jar}"/>
</classpath>
</javac>
</target>
<target name="generate" depends="properties">
<echo message="Generating code with: ${rtidds.rtiddsgen} ${env.RTIDDSGEN_PREPROCESSOR} "/>
<exec failonerror="true" failifexecutionfails="true" executable="${rtidds.rtiddsgen}">
<arg line="-d perftest_java"/>
<arg line="-language Java"/>
<arg line="-package com.rti.perftest.gen"/>
<arg line="-replace"/>
<arg line="${env.RTIDDSGEN_PREPROCESSOR}"/>
<arg file="idl/test.idl"/>
</exec>
</target>
<target name="properties">
<property environment="env"/>
<property name="rtidds.home" location="${env.NDDSHOME}"/>
<property name="rtidds.jar" location="${rtidds.home}/class/nddsjava.jar"/>
<property name="env.RTIDDSGEN_PREPROCESSOR" value=""/>
<condition value=".bat" else="" property="script.suffix">
<os family="Windows"/>
</condition>
<property name="rtidds.rtiddsgen" location="${rtidds.home}/scripts/rtiddsgen${script.suffix}"/>
</target>
</project>
【问题讨论】: