Archived

This forum has been archived. Please start a new discussion on GitHub.

how to use Slice2JavaTask for ant

i am new to ice.and i use the ant task to compile ice file to java file.
i wrote this in my build.xml

<project name="IceExample" default="main" basedir=".">
<target name="declare">
<taskdef name="slice2java" classname="Slice2JavaTask" classpath="ilb"/>
</target>

<property name="slice.dir" value="ice"/>
<target name="main" depends="declare">
<mkdir dir="out" />
<slice2java outputdir=".">
<fileset dir="." includes="Hello.ice"/>
</slice2java>
</target>
</project>


the Hello.ice is an example in ice 1.4.
but after run "ant",error appears:
the output as follows:

declare:

main:
[slice2java] slice2java --output-dir E:\devwork\ice E:\devwork\ice\Hello.ice

BUILD FAILED
file:E:/devwork/ice/build.xml:11: Execute failed: java.io.IOException: CreatePro
cess: slice2java --output-dir E:\devwork\ice E:\devwork\ice\Hello.ice error=2

can anyone help me.3x

Comments

  • benoit
    benoit Rennes, France
    Is slice2java in your PATH? The Windows CreateProcess system call returns 2 which would indicate that slice2java wasn't found (2 = The system cannot find the file specified.) Perhaps, you can try to specify the full path of slice2java and see if it helps.

    Benoit.
  • Originally posted by benoit
    Is slice2java in your PATH? The Windows CreateProcess system call returns 2 which would indicate that slice2java wasn't found (2 = The system cannot find the file specified.) Perhaps, you can try to specify the full path of slice2java and see if it helps.

    Benoit.
    o i know,but is there any slice2java compiler which is not based on .net framework
  • benoit
    benoit Rennes, France
    I'm not sure I understand the question, slice2java is a regular command line tool to translate slice files to Java. The Slice2Java ant task requires slice2java to be in your PATH to work or to set the ICE_HOME environment variable to your Ice installation directory (sorry, I was wrong in my first post, you can't actually specify the full PATH of the slice2java executable).

    You can download the slice2java translator for your platform on our web site (check the Ice for Java/C# - Unix Binaries section or one of the Windows installers). Note that you don't need .NET to be installed to use the translator, just install one of the binary distribution and either put the Ice-1.5.0/bin directory in your PATH or set the ICE_HOME variauble to the location of the Ice-1.5.0 directory.

    Let us know if you still have troubles using the ant task!

    Benoit.
  • my system is win2000 and i mainly use ice for Java,i have tried these two binary distributions "Ice-1.5.0-VC70.msi" and "Ice-1.5.0-VC71.msi" but there are some trouble make me can not finish install,can you tell me any other distribution i can use.
    sorry for my stupid question,setting up the ice develope enviroment does not seem as easy as i did ago
    thank you very much
  • ok after i update my .net framework.i can use ice now.thank you all the same
  • bernard
    bernard Jupiter, FL
    The problem is that both installers have a dependency on the .NET framework, as they install the icecs assembly (Ice for C#) in the Global Assembly Cache (GAC). This is wrong: we will post updated installers soon.

    Cheers,
    Bernard
  • bernard
    bernard Jupiter, FL
    With Ice 1.5.1, the VC70 installer does not depend the .NET framework (and no longer includes Ice for C#).

    The VC71 installer includes Ice for C#, depends on .NET 1.1.4322, and redirects you to the .NET 1.1 download page if it's not installed on your PC.

    So if you're just interested in Ice for Java on Windows, we recommend the VC70 installer.

    Cheers,
    Bernard