ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: Ant and the Windows Registry
Date Fri, 13 Oct 2006 13:34:42 GMT
On 10/13/06, Robert Pepersack <RPepersack@mdinsurance.state.md.us> wrote:
> Hi all,
>
> I would like to read and alter a Windows registry key with Ant.  You
> may ask why would I want to change the Windows registry??!!  I want to
> change the registry because I want to change my J2EE server's (Sybase
> EAServer) classpath from Ant.  My fellow developers and I could change
> our servers' classpathes manually by opening regedit, but this would be
> prone to point-and-click screw-ups.  I think that changing the registry
> from Java would be more reliable and less error-prone.
>
> I Googled on the subject and found that there is a Java Preferences API
> and Orangevolt Ant Tasks.  Has anyone used these, or know of something
> better?
>
The orangevolt ant tasks look pretty nice. They include a jni dll
that accesses the win reg (why oh why did sun not support jdirect?)

On initial load, the tasks  copy the dll into $JAVA_HOME/jre/bin.
The tasks can then read and write reg entries.

Usage: drop the orangevolt-ant-tasks.jar file into %USERPROFILE%/.ant/lib
and
use:
<project name="rox" default="main">
    <taskdef resource="com/orangevolt/tools/ant/taskdefs.properties"/>

  <target name="main">

    <win32.registry root="HKEY_LOCAL_MACHINE" key="SOFTWARE">
      <!--
           softwareExists will be set if
           HKEY_LOCAL_MACHINE\SOFTWARE exists
           -->
      <exists property="softwareExists"/>
    </win32.registry>

    <echo message="softwareExists=${softwareExists}"/>
  </target>
</project>

Peter


> Thanks,
>
> Bob
>
> Robert Pepersack
> Senior Lead Developer
> Maryland Insurance Administration
> 410-468-2054
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message