You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jeffrey Porter <je...@metadyne.uk.com> on 2001/09/20 12:05:14 UTC

JDK 1.1, Personal Java. Help?

I'm trying to write an ant script to compile our/my codebase that has
been
profiled for JDK 1.1.8 - Personal Java.

I know how to write the script to work with JDK1.3.

I just need to know how change the compiler used to JDK 1.1.


Thanks

JP.




-- it builds, quick ship it!



Re: JDK 1.1, Personal Java. Help?

Posted by David Walend <df...@cornell.edu>.
Jeffrey Porter wrote:

>  
> Thanks for the reply.
>  
>
> The trouble with setting the build.compiler to javac1.1 is that it 
> instructs the javac compiler to produce byte code
> for JDK1.1x. This is almost what I want.
>
> The thing is that objects such as java.util.List are still on the 
> classpath, so hence get
> compiled and used. Which I don't want. The reason for not wanting 
> these, incase anyone is not familer to Personal Java, is
> because Personal Java is essentially JDK 1.18 + some extensions. It 
> does not include classed such as some of the java.util.collections.
>
> So I want to compile with JDK1.1.8 + have my Collections.jar extension 
> on the path,
> so that I end up with compiled byte code that I know will run under 
> Personal Java, or I should get error messages saying that
> I'm using objects that are not available under Personal Java.
>
JP,

Have you tried the javac task's fork="yes" attribute? I'm not sure that 
will work, as I haven't had this particular conflict.

If that doesn't work, you can use an exec task instead, to call the 
javac from 1.1.8. Exec is not the most elegant approach, but it should work.

Dave

> David Walend wrote:
>
>> Jeffrey Porter wrote:
>>
>> >
>> > I'm trying to write an ant script to compile our/my codebase that has
>> > been
>> > profiled for JDK 1.1.8 - Personal Java.
>> >
>> > I know how to write the script to work with JDK1.3.
>> >
>> > I just need to know how change the compiler used to JDK 1.1.
>> >
>> >
>> JP,
>>
>> Does the javac task's target="1.1" attribute work for you?
>>
>> Dave
>>
>-- it builds, quick ship it!
>
>  





Re: JDK 1.1, Personal Java. Help?

Posted by Diane Holt <ho...@yahoo.com>.
--- Jeffrey Porter <je...@metadyne.uk.com> wrote:
>   <property name="build.compiler" value="javac1.1"/>

Should be:
  <property name="build.compiler" value="classic"/>

>   <property name="includeJavaRuntime" value="no"/>
>   <property name="includeAntRuntime" value="no"/>

The "includeJavaRuntime" and "includeAntRuntime" are attributes of the
<javac> task, not properties. If you're setting build.sysclasspath, which
globally turns these off, you don't need to set the attributes. If you'd
rather use the attributes, then you don't really need to set
build.sysclasspath. Which to use depends on whether you ever want to
compile using the runtime stuff, in which case you should use the
attributes in those <javac> tasks where you don't want the runtime stuff.

>classpath="${build}/production/classes/src/api:/usr/local/java/tools/junit3.5/junit.jar:/usr/java1.1/lib/classes.jar:/usr/local/personalJava/pj.jar:/usr/local/personalJava/EXTENSIONS/collections.jar"

I'd recommend using the nested <classpath> element -- makes adding or
removing things easier, and it's easier to read (see the full example
below for how this looks).  Also, are the 1.1 classes really in
"classes.jar"? I've only ever seen them in "classes.zip".
 
>         verbose="on"

Do you really want the compiler to run -verbose (ie., all that [parsed...]
[loaded...] stuff? -- that's what setting this attribute on does.

Here's the whole burrito:

<property name="build.sysclasspath" value="ignore"/>
<property name="build.compiler" value="classic"/>

<!-- Compile the java code from ${source} into ${build} -->
<target name="compileSUPPORT">
  <javac srcdir="${source}MetadynePJ/src/support"
         <!-- BTW: Are you missing a slash after ${source}? -->
         destdir="${build}/production/classes/src/support"
         excludes="AllTests,*TestSuite"
         <!-- BTW: Not sure this excludes is going to do what you want -->
         debug="on">
    <classpath>
      <pathelement location="${build}/production/classes/src/api">
      <pathelement location="/usr/local/java/tools/junit3.5/junit.jar">
      <pathelement location="/usr/java1.1/lib/classes.jar">
      <pathelement location="/usr/local/personalJava/pj.jar">
      <pathelement
location="/usr/local/personalJava/EXTENSIONS/collections.jar">
     </classpath>
  </javac>
</target>

Run 'ant -verbose compileSUPPORT' to verify the compile command-line
includes only those elements specified in <classpath> plus the srcdir and
destdir directories.

(Holler if this doesn't actually work :)

Diane



=====
(holtdl@yahoo.com)



__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

Re: JDK 1.1, Personal Java. Help?

Posted by Jeffrey Porter <je...@metadyne.uk.com>.
>>Holler if you need an example of a <javac> task for this.


Hey Diana,

I've tried what you suggested, I think.  Below I've included the script that
I'm running (tasks that follow have been excluded).
I know that I must be doing something wrong since I get the following line in
log from ANT


[javac] [loaded /usr/local/jdk1.3.1/jre/lib/rt.jar(java/lang/Thread.class) in
13 ms]



Which show the loading of  rt.jar from 1.3.1,

If you can offer any advice it would be great. My attempts at learning perl
to write the same task are proving frustrating.


Jeff.



==========================================

<project name="Ant-Metadyne-CDNA" default="compileSUPPORT" basedir=".">


  <property name="source"
value="/home/unittest/daily_build/metanixCDNAPersonalJava/sandbox/"/>
  <property name="build"
value="/home/unittest/daily_build/metanixCDNAPersonalJava/build"/>



  <property name="build.compiler" value="javac1.1"/>
  <property name="build.sysclasspath" value="ignore"/>
  <property name="includeJavaRuntime" value="no"/>
  <property name="includeAntRuntime" value="no"/>



  <!-- ===================================================================
-->
  <!-- Compiles the SUPPORT source code
-->
  <!-- ===================================================================
-->
  <target name="compileSUPPORT"   >

    <!-- Compile the java code from ${source} into ${build} -->
    <javac srcdir="${source}MetadynePJ/src/support"
        destdir="${build}/production/classes/src/support"
        excludes="AllTests,*TestSuite"

classpath="${build}/production/classes/src/api:/usr/local/java/tools/junit3.5/junit.jar:/usr/java1.1/lib/classes.jar:/usr/local/personalJava/pj.jar:/usr/local/personalJava/EXTENSIONS/collections.jar"

        debug="on"
        verbose="on"
     />

  </target>


</project>

















Diane Holt wrote:

> If you never want to use the runtime stuff in your classpath, set the
> global property build.sysclasspath="ignore". If you want to use the 1.1.8
> stuff only for certain compiles, set includeJavaRuntime="no" and
> includeAntRuntime="no" for those specific targets. In both cases, include
> the 1.1.8 classes.zip in the classpath for the compile.
>
> If you're using 'jikes' as your compiler, you'll also need to point the
> bootclasspath and extdirs attrs to someplace innocuous, since the Jikes
> stuff for Ant needs fixing.
>
> You can verify your compile command-line looks the way you want it to by
> running 'ant' with -verbose.
>
> Holler if you need an example of a <javac> task for this.
>
> Diane
>
> --- Jeffrey Porter <je...@metadyne.uk.com> wrote:
> >
> > Thanks for the reply.
> >
> >
> > The trouble with setting the build.compiler to javac1.1 is that it
> > instructs the javac compiler to produce byte code
> > for JDK1.1x. This is almost what I want.
> >
> > The thing is that objects such as java.util.List are still on the
> > classpath, so hence get
> > compiled and used. Which I don't want. The reason for not wanting these,
> > incase anyone is not familer to Personal Java, is
> > because Personal Java is essentially JDK 1.18 + some extensions. It does
> > not include classed such as some of the java.util.collections.
> >
> > So I want to compile with JDK1.1.8 + have my Collections.jar extension
> > on
> > the path,
> > so that I end up with compiled byte code that I know will run under
> > Personal Java, or I should get error messages saying that
> > I'm using objects that are not available under Personal Java.
> >
> > Thanks.
> >
> > JP.
> >
> >
> >
> >
> > David Walend wrote:
> >
> > > Jeffrey Porter wrote:
> > >
> > > >
> > > > I'm trying to write an ant script to compile our/my codebase that
> > has
> > > > been
> > > > profiled for JDK 1.1.8 - Personal Java.
> > > >
> > > > I know how to write the script to work with JDK1.3.
> > > >
> > > > I just need to know how change the compiler used to JDK 1.1.
> > > >
> > > >
> > > JP,
> > >
> > > Does the javac task's target="1.1" attribute work for you?
> > >
> > > Dave
> >
> > -- it builds, quick ship it!
> >
> >
> > > begin:vcard
> > n:Porter;Jeffrey
> > tel;work:44 (0)1895 254 254
> > x-mozilla-html:FALSE
> > org:Metadyne Ltd.;Research & Development
> > adr:;;;;;;
> > version:2.1
> > email;internet:jeff@metadyne.uk.com
> > title:Software Architect
> > x-mozilla-cpt:;27728
> > fn:Jeffrey Porter
> > end:vcard
> >
>
> =====
> (holtdl@yahoo.com)
>
> __________________________________________________
> Terrorist Attacks on U.S. - How can you help?
> Donate cash, emergency relief information
> http://dailynews.yahoo.com/fc/US/Emergency_Information/

-- it builds, quick ship it!



Re: JDK 1.1, Personal Java. Help?

Posted by Diane Holt <ho...@yahoo.com>.
If you never want to use the runtime stuff in your classpath, set the
global property build.sysclasspath="ignore". If you want to use the 1.1.8
stuff only for certain compiles, set includeJavaRuntime="no" and
includeAntRuntime="no" for those specific targets. In both cases, include
the 1.1.8 classes.zip in the classpath for the compile.

If you're using 'jikes' as your compiler, you'll also need to point the
bootclasspath and extdirs attrs to someplace innocuous, since the Jikes
stuff for Ant needs fixing.

You can verify your compile command-line looks the way you want it to by
running 'ant' with -verbose.

Holler if you need an example of a <javac> task for this.

Diane

--- Jeffrey Porter <je...@metadyne.uk.com> wrote:
> 
> Thanks for the reply.
> 
> 
> The trouble with setting the build.compiler to javac1.1 is that it
> instructs the javac compiler to produce byte code
> for JDK1.1x. This is almost what I want.
> 
> The thing is that objects such as java.util.List are still on the
> classpath, so hence get
> compiled and used. Which I don't want. The reason for not wanting these,
> incase anyone is not familer to Personal Java, is
> because Personal Java is essentially JDK 1.18 + some extensions. It does
> not include classed such as some of the java.util.collections.
> 
> So I want to compile with JDK1.1.8 + have my Collections.jar extension
> on
> the path,
> so that I end up with compiled byte code that I know will run under
> Personal Java, or I should get error messages saying that
> I'm using objects that are not available under Personal Java.
> 
> Thanks.
> 
> JP.
> 
> 
> 
> 
> David Walend wrote:
> 
> > Jeffrey Porter wrote:
> >
> > >
> > > I'm trying to write an ant script to compile our/my codebase that
> has
> > > been
> > > profiled for JDK 1.1.8 - Personal Java.
> > >
> > > I know how to write the script to work with JDK1.3.
> > >
> > > I just need to know how change the compiler used to JDK 1.1.
> > >
> > >
> > JP,
> >
> > Does the javac task's target="1.1" attribute work for you?
> >
> > Dave
> 
> -- it builds, quick ship it!
> 
> 
> > begin:vcard 
> n:Porter;Jeffrey
> tel;work:44 (0)1895 254 254
> x-mozilla-html:FALSE
> org:Metadyne Ltd.;Research & Development
> adr:;;;;;;
> version:2.1
> email;internet:jeff@metadyne.uk.com
> title:Software Architect
> x-mozilla-cpt:;27728
> fn:Jeffrey Porter
> end:vcard
> 


=====
(holtdl@yahoo.com)



__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

Re: JDK 1.1, Personal Java. Help?

Posted by Jeffrey Porter <je...@metadyne.uk.com>.
Thanks for the reply.


The trouble with setting the build.compiler to javac1.1 is that it
instructs the javac compiler to produce byte code
for JDK1.1x. This is almost what I want.

The thing is that objects such as java.util.List are still on the
classpath, so hence get
compiled and used. Which I don't want. The reason for not wanting these,
incase anyone is not familer to Personal Java, is
because Personal Java is essentially JDK 1.18 + some extensions. It does
not include classed such as some of the java.util.collections.

So I want to compile with JDK1.1.8 + have my Collections.jar extension on
the path,
so that I end up with compiled byte code that I know will run under
Personal Java, or I should get error messages saying that
I'm using objects that are not available under Personal Java.

Thanks.

JP.




David Walend wrote:

> Jeffrey Porter wrote:
>
> >
> > I'm trying to write an ant script to compile our/my codebase that has
> > been
> > profiled for JDK 1.1.8 - Personal Java.
> >
> > I know how to write the script to work with JDK1.3.
> >
> > I just need to know how change the compiler used to JDK 1.1.
> >
> >
> JP,
>
> Does the javac task's target="1.1" attribute work for you?
>
> Dave

-- it builds, quick ship it!



Re: JDK 1.1, Personal Java. Help?

Posted by David Walend <df...@cornell.edu>.
Jeffrey Porter wrote:

>  
> I'm trying to write an ant script to compile our/my codebase that has 
> been
> profiled for JDK 1.1.8 - Personal Java.
>
> I know how to write the script to work with JDK1.3.
>
> I just need to know how change the compiler used to JDK 1.1.
>  
>
JP,

Does the javac task's target="1.1" attribute work for you?

Dave