Main BLOGGER
Google
WWW THIS BLOG
Tuesday, May 30, 2006
 
Java: using system property

1. use java –D option to define system property

   <!-- define the "run-xclient" target -->

   <target name="runX" depends="xClient">

      <java classname="xclient.Client" fork="true">

        <jvmarg value="-DcontainerHome=${project-home}"/>

        <classpath refid="classpath"/>

        <classpath>

            <pathelement location="${project-home}/classes"/>

        </classpath>

      </java>

   </target>

 

2. in the code, use System.getProperty()

          String home = System.getProperty("containerHome", "/home/pliu/");

 

In this way, we can use different build.properties file and switch smoothly between windows and linux

 

<?xml version="1.0"?>

 

<project default="build">

 

   <property file="build.properties"/>

 

 

 




<< Home

Powered by Blogger

Google
WWW THIS BLOG