Meaningless Drivel is fun!*
The moose likes Ant, Maven and Other Build Tools and the fly likes Using multiple JDK for the same build script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Using multiple JDK for the same build script" Watch "Using multiple JDK for the same build script" New topic
Author

Using multiple JDK for the same build script

Raj Chukka
Greenhorn

Joined: Apr 09, 2007
Posts: 22
Hi,

I have JDK 1.3.1 on Unix and (JDK 1.4.2) on windows. I have build.xml file which should take the different JDK's based on the OS. I got the following solutions for it.

1. Declare <property> in ant script like below and change it accodingly.

<property name="java.home" value="JDK_HOME_PATH"/>

2. I create a properties file for each env like below.

in unix:
<property file="jdk_unix.properties"/>

in windows
<property file="jdk_windows.properties"/>

whenever i run the build.xml, i will comment the other properties file.

is there any other way i can do this without any modifications on the build file?

Thanks in advance.

Thanks,
Raj Chukka
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Do this. In build.xml, have:



Then in build.properties have (using your locations, of course):



Then if you change or move the JDKs, you need update only the properties file.

P.S. Even this would work:



In this, the Windows setting is the default.
[ October 16, 2008: Message edited by: Peter Johnson ]

JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using multiple JDK for the same build script
 
Similar Threads
Ant Compilation slow
java.lang.VerifyError:
automatically echo project name for each task
Help needed with ANT
can't get the logger to log everything