Home Help Center

What Development Environment to use for Java

gsteele9gsteele9 Member Greg SteeleOrganization: RetiredProject: Backup System
I'm looking for the easiest way to develop at least parts of an ICE application in Java.

In the past, I've used Eclipse for Java and Visual Studio 2005 for C# or VB. It looks like there is no usable Eclipse plugin for ICE and I don't know how to develop a Java application with VS2005. I've tried Gaylord Fureau's IcEclipse plugin for Eclipse at ICEEclipse - A plugin for the IDE Eclipse, but it looks like nobody's updating it and it supports an old version of ICE.

Your download description for the "Windows Installer for Visual Studio 2005 SP1" refers to Java. Is there something I'm missing in VS2005 that would let me develop Java apps? As an alternative, is there any hope for an Eclipse plugin? Should I drop back to command line stuff for ICE/Java?

Thanks in advance for any suggestions you can make.

Comments

  • mefostermefoster Member Mary Ellen FosterOrganization: Heriot-Watt University, EdinburghProject: ECHOES learning environment ✭✭✭
    I use Eclipse to develop my Java Ice servers. I use the old "IcEclipse" plug-in purely to provide syntax highlighting -- it's not useful for much more. But it's not too hard to set up a good Ant build.xml file and ensure that slice2java gets run at appropriate points in the project's lifecycle, and that's worked pretty well for me.

    In my build.xml, I have two targets that looks like this (where JAST_ICE_DIR is the directory where my *.ice files are, and all of my files are in the "jast" module):
    <target name="slice2java">
            <mkdir dir="src" />
            <slice2java outputdir="src">
                <includepath path="${env.JAST_ICE_DIR}" />
                <includepath path="${ice_slice_dir}" />
                <fileset dir="${env.JAST_ICE_DIR}/jast">
                    <include name="common/Agent.ice" />
                    <include name="common/Object.ice" />
                    <!-- ... and so on ... -->
                </fileset>
                <meta value="java:java5" />
            </slice2java>
        </target>
    
        <target name="clean-slice2java">
            <delete dir="src/jast" />
            <delete file="src/.depend" />
        </target>
    
    
    You also need to make sure to "taskdef" the Ice Java tasks properly; this may be in the Ice documentation, but if not, ask me.

    Then, in Eclipse, you need to set things up like this; this is based on instructions I wrote up for my colleagues recently.
    1. Right click on the project and choose Properties. Inside that window, choose Builders, click on New ..., and then choose Ant Builder and press OK
    2. On the Main tab, give it whatever name you want (e.g., "slice2java builder"). For the Buildfile, click Browse Workspace, select your new project on the left, and then select build.xml on the right and press OK. Press Apply.
    3. Choose the Refresh tab. Check Refresh resources on completion. Choose Specific resources and then click the Specify Resources ... button. Open the tree under your new project and check the box next to the src directory. Press OK and then Apply.
    4. Choose the Targets tab. You need to change the targets to run in all four of the situations: for During a “Clean” choose the clean-slice2java target and un-check all other targets; for the other three, choose slice2java and un-check the others. Once you’ve chosen the targets for all four fields, press Apply.
    5. Choose the Build Options tab. Check Specify working set ... and press the Specify Resources ... button. Browse to your project and select its build.xml file. Press Finish and then OK.
    6. Back in the Builders screen, select the new builder you just added and move it above the default Java Builder. Press OK.
    If you're lucky, the project will now automatically call slice2java before trying to build itself, and all of your interfaces will be available.

    I hope this is sort of useful. Let me know if something doesn't work and I can clarify.

    MEF
  • gsteele9gsteele9 Member Greg SteeleOrganization: RetiredProject: Backup System
    Thanks for your suggestions

    Thanks a lot for taking the time to respond.

    I'll have to do some reading on Ant, but could you tell me which "Ice Java tasks" need to be taskdef'd? I couldn't find any occurrences of "taskdef" in the ICE pdf.

    Thanks again for your help.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Greg,

    Mary Ellen is referring to the ant taskdef in the common.xml file that comes with the Ice Java demos build system:
        <!-- Install the Slice ant tasks. -->
        <target name="task-init">
    
            <condition property="task.jar.file" value="${dist.lib.dir}/ant-ice-${ice.version}.jar">
                <available file="${dist.lib.dir}/ant-ice-${ice.version}.jar"/>
            </condition>
    
            <condition property="task.jar.file" value="${dist.lib.dir}/ant-ice.jar">
                <and>
                    <not><isset property="task.jar.file"/></not>
                    <available file="${dist.lib.dir}/ant-ice.jar"/>
                </and>
            </condition>
    
            <taskdef name="slice2java" classpath="${task.jar.file}" classname="Slice2JavaTask"/>
            <taskdef name="slice2freezej" classpath="${task.jar.file}" classname="Slice2FreezeJTask" />
    
        </target>
    

    Best regards,
    Bernard
  • gsteele9gsteele9 Member Greg SteeleOrganization: RetiredProject: Backup System
    Thanks Bernard. I can see that I'll need to educate myself on Ant. I think I understand how it will help. These posts will be very useful to me.
  • gsteele9gsteele9 Member Greg SteeleOrganization: RetiredProject: Backup System
    I got it working. Thanks to both Bernard and Mary Ellen for their help.

    I was thinking that I'd have to write all the Ant tasks, but after Bernard's note I realized that all I needed was a taskdef equating slicetojava to the Slice2JavaTask included in ant-ice.jar.
Sign In or Register to comment.