You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by m1ke <un...@yahoo.co.uk> on 2007/01/03 12:50:14 UTC

Getting Ant to compile to a different VM?

Hi. I am using Ant within Eclipse and need to compile to java 1.3. The
problem is Eclipse is loaded up with 1.5 - and as its loaded up in this, Ant
uses 1.5. All the settings in Eclipse are set to compile to 1.3, but I'm
having a lot of trouble finding how to do this within the Ant settings also.
There is a Runtime JRE option which is currently set to "run in the same JRE
as the workspace", whenever a separate JRE is selected for 1.3 the compiler
produces an error
Unable to load default ProjectHelper due to java.lang.NoClassDefFoundError:
org/xml/sax/SAXException.

Within Windows > preferences > Ant > runtime, under global entries I have
replaced tools.jar from 1.5 to 1.3 one, which then produces the error:
       :6: cannot access java.util.Collection
       [javac] bad class file:
c:\jdk1.5.0_07\jre\lib\rt.jar(java/util/Collection.class)
       [javac] class file has wrong version 49.0, should be 47.0
       [javac] Please remove or make sure it appears in the correct
subdirectory of the classpath.
       [javac] import java.util.Collection;
       [javac]                  ^
       [javac] 1 error
So it's still looking in 1.5 directory.. I'm hoping any Eclipse users can
help or even if there is a general ant solution, as I'm not sure how to get
to stop looking in the 1.5 directory and look in the 1.3.. thanks a lot
-- 
View this message in context: http://www.nabble.com/Getting-Ant-to-compile-to-a-different-VM--tf2913012.html#a8139338
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: Getting Ant to compile to a different VM?

Posted by m1ke <un...@yahoo.co.uk>.
Hi Scot. Thanks for the reply. I have sorted it finally after a lot of
hassle. The solution was to go to the build.xml and in the javac part at
source="1.3" and target="1.3" ... seems a little simple! Thanks for the help

Scot P. Floess wrote:
> 
> It sounds like an environment issue...  Regarding the class version 
> error...I think you are correct - it is compiled to 1.3 however, for 
> some reason, the 1.3 VM is attempting to use the 1.5 version of the Java 
> classes.  You may need to install a 1.3 version of the JDK and "tell" 
> Eclipse to use that.  Again, I am not an Eclipse user so I don't have 
> any "words of wisdom" with respect to Eclipse.
> 

-- 
View this message in context: http://www.nabble.com/Getting-Ant-to-compile-to-a-different-VM--tf2913012.html#a8142915
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: Getting Ant to compile to a different VM?

Posted by "Scot P. Floess" <fl...@mindspring.com>.
It sounds like an environment issue...  Regarding the class version 
error...I think you are correct - it is compiled to 1.3 however, for 
some reason, the 1.3 VM is attempting to use the 1.5 version of the Java 
classes.  You may need to install a 1.3 version of the JDK and "tell" 
Eclipse to use that.  Again, I am not an Eclipse user so I don't have 
any "words of wisdom" with respect to Eclipse.

m1ke wrote:
> Hiya, at that point -- the ant builder run time preferences has a 'global
> entries' section which contains tools.jar for jdk 1.5. If I replace it with
> 1.3 it comes up with those errors (as its still looking for other libraries
> in 1.5 folder so there's a mix of java versions). Not sure how to change the
> others or get it to stop looking there. However, if I keep the same 1.5
> tools.jar the program compiles with a warning:
>
> 94: warning: non-varargs call of varargs method with inexact argument type
> for last parameter;
>        [javac] cast to java.lang.Object for a varargs call
>        [javac] cast to java.lang.Object[] for a non-varargs call and to
> suppress this warning
>        [javac]                   dbid = (String) m.invoke(cl, null);
>        [javac]                                                ^
>        [javac] Note: Some input files use or override a deprecated API.
>        [javac] Note: Recompile with -Xlint:deprecation for details.
>        [javac] Note: Some input files use unchecked or unsafe operations.
>        [javac] Note: Recompile with -Xlint:unchecked for details.
>        [javac] 1 warning
>
> So basically its compiling to 1.5 instead of 1.3.
>
>
> Scot P. Floess wrote:
>   
>> OK I found your original email...  It looks like you have a number of 
>> problems...  When you get that exception (class version) what is it you 
>> are doing at that time?  That doesn't look to me to be a compile time 
>> exception...
>>
>> Scot P. Floess wrote:
>>     
>>> I believe its simply:  <javac target="1.3"/>
>>>
>>> You may also have to specify using the attribute source="1.3"
>>>
>>> When you say "it's still having the problem" - can you refresh my 
>>> memory - what is the problem exactly?  I deleted my emails :(
>>>
>>>
>>> m1ke wrote:
>>>       
>>>> Hi ,thanks for the reply. Yeah there is a build.xml, previously tried 
>>>> putting
>>>> a < target="1.3"> tag in a javac area of the build.xml... perhaps it 
>>>> wasnt
>>>> entered correctly as it's still having the problem. Will try again.. 
>>>> what is
>>>> the best way to do go about it? (just double-checking entered it 
>>>> correctly)
>>>>
>>>>
>>>> Scot P. Floess wrote:
>>>>  
>>>>         
>>>>> If you need to compile targeted to JDK 1.3, you will need to set 
>>>>> your <javac target="1.3">...  I am not an Eclipse user so I can't 
>>>>> help you there...  I'm guessing an Ant build.xml is generated that 
>>>>> you can edit?
>>>>>
>>>>>     
>>>>>           
>>>>   
>>>>         
>> -- 
>> Scot P. Floess
>> 27 Lake Royale
>> Louisburg, NC  27549
>>
>> 252-478-8087 (Home)
>> 919-754-4592 (Work)
>>
>> Chief Architect JPlate  http://sourceforge.net/projects/jplate
>> Chief Architect JavaPIM http://sourceforge.net/projects/javapim
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>
>>     
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


Re: Getting Ant to compile to a different VM?

Posted by m1ke <un...@yahoo.co.uk>.
Hiya, at that point -- the ant builder run time preferences has a 'global
entries' section which contains tools.jar for jdk 1.5. If I replace it with
1.3 it comes up with those errors (as its still looking for other libraries
in 1.5 folder so there's a mix of java versions). Not sure how to change the
others or get it to stop looking there. However, if I keep the same 1.5
tools.jar the program compiles with a warning:

94: warning: non-varargs call of varargs method with inexact argument type
for last parameter;
       [javac] cast to java.lang.Object for a varargs call
       [javac] cast to java.lang.Object[] for a non-varargs call and to
suppress this warning
       [javac]                   dbid = (String) m.invoke(cl, null);
       [javac]                                                ^
       [javac] Note: Some input files use or override a deprecated API.
       [javac] Note: Recompile with -Xlint:deprecation for details.
       [javac] Note: Some input files use unchecked or unsafe operations.
       [javac] Note: Recompile with -Xlint:unchecked for details.
       [javac] 1 warning

So basically its compiling to 1.5 instead of 1.3.


Scot P. Floess wrote:
> 
> OK I found your original email...  It looks like you have a number of 
> problems...  When you get that exception (class version) what is it you 
> are doing at that time?  That doesn't look to me to be a compile time 
> exception...
> 
> Scot P. Floess wrote:
>> I believe its simply:  <javac target="1.3"/>
>>
>> You may also have to specify using the attribute source="1.3"
>>
>> When you say "it's still having the problem" - can you refresh my 
>> memory - what is the problem exactly?  I deleted my emails :(
>>
>>
>> m1ke wrote:
>>> Hi ,thanks for the reply. Yeah there is a build.xml, previously tried 
>>> putting
>>> a < target="1.3"> tag in a javac area of the build.xml... perhaps it 
>>> wasnt
>>> entered correctly as it's still having the problem. Will try again.. 
>>> what is
>>> the best way to do go about it? (just double-checking entered it 
>>> correctly)
>>>
>>>
>>> Scot P. Floess wrote:
>>>  
>>>> If you need to compile targeted to JDK 1.3, you will need to set 
>>>> your <javac target="1.3">...  I am not an Eclipse user so I can't 
>>>> help you there...  I'm guessing an Ant build.xml is generated that 
>>>> you can edit?
>>>>
>>>>     
>>>
>>>   
>>
> 
> -- 
> Scot P. Floess
> 27 Lake Royale
> Louisburg, NC  27549
> 
> 252-478-8087 (Home)
> 919-754-4592 (Work)
> 
> Chief Architect JPlate  http://sourceforge.net/projects/jplate
> Chief Architect JavaPIM http://sourceforge.net/projects/javapim
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Getting-Ant-to-compile-to-a-different-VM--tf2913012.html#a8140874
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: Getting Ant to compile to a different VM?

Posted by "Scot P. Floess" <fl...@mindspring.com>.
OK I found your original email...  It looks like you have a number of 
problems...  When you get that exception (class version) what is it you 
are doing at that time?  That doesn't look to me to be a compile time 
exception...

Scot P. Floess wrote:
> I believe its simply:  <javac target="1.3"/>
>
> You may also have to specify using the attribute source="1.3"
>
> When you say "it's still having the problem" - can you refresh my 
> memory - what is the problem exactly?  I deleted my emails :(
>
>
> m1ke wrote:
>> Hi ,thanks for the reply. Yeah there is a build.xml, previously tried 
>> putting
>> a < target="1.3"> tag in a javac area of the build.xml... perhaps it 
>> wasnt
>> entered correctly as it's still having the problem. Will try again.. 
>> what is
>> the best way to do go about it? (just double-checking entered it 
>> correctly)
>>
>>
>> Scot P. Floess wrote:
>>  
>>> If you need to compile targeted to JDK 1.3, you will need to set 
>>> your <javac target="1.3">...  I am not an Eclipse user so I can't 
>>> help you there...  I'm guessing an Ant build.xml is generated that 
>>> you can edit?
>>>
>>>     
>>
>>   
>

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


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


Re: Getting Ant to compile to a different VM?

Posted by "Scot P. Floess" <fl...@mindspring.com>.
I believe its simply:  <javac target="1.3"/>

You may also have to specify using the attribute source="1.3"

When you say "it's still having the problem" - can you refresh my memory 
- what is the problem exactly?  I deleted my emails :(


m1ke wrote:
> Hi ,thanks for the reply. Yeah there is a build.xml, previously tried putting
> a < target="1.3"> tag in a javac area of the build.xml... perhaps it wasnt
> entered correctly as it's still having the problem. Will try again.. what is
> the best way to do go about it? (just double-checking entered it correctly)
>
>
> Scot P. Floess wrote:
>   
>> If you need to compile targeted to JDK 1.3, you will need to set your 
>> <javac target="1.3">...  I am not an Eclipse user so I can't help you 
>> there...  I'm guessing an Ant build.xml is generated that you can edit?
>>
>>     
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


Re: Getting Ant to compile to a different VM?

Posted by m1ke <un...@yahoo.co.uk>.
Hi ,thanks for the reply. Yeah there is a build.xml, previously tried putting
a < target="1.3"> tag in a javac area of the build.xml... perhaps it wasnt
entered correctly as it's still having the problem. Will try again.. what is
the best way to do go about it? (just double-checking entered it correctly)


Scot P. Floess wrote:
> 
> If you need to compile targeted to JDK 1.3, you will need to set your 
> <javac target="1.3">...  I am not an Eclipse user so I can't help you 
> there...  I'm guessing an Ant build.xml is generated that you can edit?
> 

-- 
View this message in context: http://www.nabble.com/Getting-Ant-to-compile-to-a-different-VM--tf2913012.html#a8140220
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: Getting Ant to compile to a different VM?

Posted by "Scot P. Floess" <fl...@mindspring.com>.
If you need to compile targeted to JDK 1.3, you will need to set your 
<javac target="1.3">...  I am not an Eclipse user so I can't help you 
there...  I'm guessing an Ant build.xml is generated that you can edit?

m1ke wrote:
> Hi. I am using Ant within Eclipse and need to compile to java 1.3. The
> problem is Eclipse is loaded up with 1.5 - and as its loaded up in this, Ant
> uses 1.5. All the settings in Eclipse are set to compile to 1.3, but I'm
> having a lot of trouble finding how to do this within the Ant settings also.
> There is a Runtime JRE option which is currently set to "run in the same JRE
> as the workspace", whenever a separate JRE is selected for 1.3 the compiler
> produces an error
> Unable to load default ProjectHelper due to java.lang.NoClassDefFoundError:
> org/xml/sax/SAXException.
>
> Within Windows > preferences > Ant > runtime, under global entries I have
> replaced tools.jar from 1.5 to 1.3 one, which then produces the error:
>        :6: cannot access java.util.Collection
>        [javac] bad class file:
> c:\jdk1.5.0_07\jre\lib\rt.jar(java/util/Collection.class)
>        [javac] class file has wrong version 49.0, should be 47.0
>        [javac] Please remove or make sure it appears in the correct
> subdirectory of the classpath.
>        [javac] import java.util.Collection;
>        [javac]                  ^
>        [javac] 1 error
> So it's still looking in 1.5 directory.. I'm hoping any Eclipse users can
> help or even if there is a general ant solution, as I'm not sure how to get
> to stop looking in the 1.5 directory and look in the 1.3.. thanks a lot
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


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