Hi John,

We do something roughly similiar to this.  We sometimes compile our client
and server components using a different Java version

1.  No, you shouldn't need different classpaths.  We have no compiler jars
in the classpath when invoking the <javac> task.

2.  I could never get the compiler attribute to work correctly. so our
compile target uses a property to point to the compiler executable location.

So our compile targets look like this:

        <!-- Compile the java classes using javac 1.3 on Windows -->
        <target name="compileNTServer" 
                  description="* Compile the java classes using javac 1.3 on
Win" if="ENV.windir">
                <echo message="-> [project buildIncludes] - [target
compileNTServer]"/>
                <javac srcdir="${srcpath}" destdir="${classes}"
classpath="${classpath}"
executable="${nt.server.compiler.loc}/bin/javac" fork="yes"/>
        </target>
        <!-- Compile the java classes using javac 1.4 on WinNT -->
        <target name="compileNTClient" 
                  description="* Compile the java classes using javac 1.4 on
Win" if="ENV.windir">
                <echo message="-> [project buildIncludes] - [target
compileNTClient]"/>
                <javac srcdir="${srcpath}" destdir="${classes}"
classpath="${classpath}"
executable="${nt.client.compiler.loc}/bin/javac" fork="yes"/>
        </target>

you could have

        <target name="compile">
                <javac srcdir="${srcpath}" destdir="${classes}"
classpath="${classpath}"
executable="${compiler.loc}/bin/javac" fork="yes"/>
        </target>

With ${compiler.loc} set depending on the previous targets..

To get this working I needed to set fork to "true".  

Anyone know a better solution than this?
-----Original Message-----
From: Longie [mailto:[EMAIL PROTECTED]
Sent: 24 November 2004 17:47
To: [EMAIL PROTECTED]
Subject: Compiler Attribute


Hello,

I have different versions of java installed on a winxp machine. I need
to be able to run ant depending on the compiler which is chosen by the
user either via the program or at runtime via a command line argument.
If none is specified then use hte default java classpath.

Questions;

1) Do i need to set different classpaths for each of the java versions
installed and then set the compiler attribute

2) Is the compiler attribute set in 

<javac srcdir="${src-dir}" destdir="${obj-dir}" debug="on"
deprecation="on" commpiler="something"/>

I have been testing with classloaders but i will be wrapping  GUI around
Ant and i want to be able to give the user an option to use different
java versions so Ant is the better option.

Any help is appreciated.

John

-- 
------------------------
U: http://www.dingleonline.com
E: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
************************************************************************
This e-mail and any files transmitted with it are confidential and may be
privileged and are intended solely for the individual named/ for the use of
the individual or entity to whom they are addressed.If you are not the
intended addressee, you should not disseminate, distribute or copy this
e-mail.Please notify the sender immediately if you have received this e-mail
by mistake and delete this e-mail from your system.If you are not the
intended recipient, you are notified that reviewing, disclosing, copying,
distributing or taking any action in reliance on the contents of this e-mail
is strictly prohibited.Please note that any views or opinions expressed in
this e-mail are solely those of the author and do not necessarily represent
those of Traventec Limited.E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, or arrive late or incomplete.Traventec Limited therefore does not
accept liability for any errors or omissions in the contents of this
message, which arise as a result of e-mail transmission.The recipient should
check this e-mail and any attachments for the presence of viruses.This
e-mail has been swept for computer viruses however Traventec Limited accepts
no liability for any damage caused by any virus transmitted by this e-mail.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to