Skip to main content



      Home
Home » Newcomers » Newcomers » Ant + Eclipse
Ant + Eclipse [message #12869] Sat, 22 January 2005 19:47 Go to next message
Eclipse UserFriend
Originally posted by: mhuggins.udel.edu

When I attempt to build my build.xml file with Ant in Eclipse, I get the
following message in my output when executing a <javac .../> element:

BUILD FAILED: java.lang.UnsupportedClassVersionError:
com/sun/tools/javac/Main (Unsupported major.minor version 49.0)


If needed, the contents are nothing more than a slightly modified sample
as provided at http://ant.apache.org ...


<?xml version="1.0" encoding="UTF-8" ?>

<project name="mysite" default="dist" basedir=".">
<description>simple site build file</description>

<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>

<target name="init">
<!-- Create the time stamp -->
<tstamp/>

<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>

<target name="compile" depends="init" description="compile the source" >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>

<target name="dist" depends="compile" description="generate the
distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>

<!-- Put everything in ${build} into the mysite-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/mysite-${DSTAMP}.jar" basedir="${build}"/>
</target>

<target name="clean" description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
Re: Ant + Eclipse [message #12878 is a reply to message #12869] Sat, 22 January 2005 20:04 Go to previous messageGo to next message
Eclipse UserFriend
Looks like you have an incompatible tools.jar on your Ant runtime classpath
with the JRE/JDK you are attempting to run the build in.
Are you running Ant in a 1.3 VM and attempting to use a 1.4 tools.jar (and
therefore the unsupportedClassVersion error)?

Window>Preferences>Ant>Runtime>Classpath

HTH
Darins

"Matt Huggins" <mhuggins@udel.edu> wrote in message
news:csus6l$rt0$1@www.eclipse.org...
> When I attempt to build my build.xml file with Ant in Eclipse, I get the
> following message in my output when executing a <javac .../> element:
>
> BUILD FAILED: java.lang.UnsupportedClassVersionError:
> com/sun/tools/javac/Main (Unsupported major.minor version 49.0)
>
>
> If needed, the contents are nothing more than a slightly modified sample
> as provided at http://ant.apache.org ...
>
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> <project name="mysite" default="dist" basedir=".">
> <description>simple site build file</description>
>
> <!-- set global properties for this build -->
> <property name="src" location="src"/>
> <property name="build" location="build"/>
> <property name="dist" location="dist"/>
>
> <target name="init">
> <!-- Create the time stamp -->
> <tstamp/>
>
> <!-- Create the build directory structure used by compile -->
> <mkdir dir="${build}"/>
> </target>
>
> <target name="compile" depends="init" description="compile the source" >
> <!-- Compile the java code from ${src} into ${build} -->
> <javac srcdir="${src}" destdir="${build}"/>
> </target>
>
> <target name="dist" depends="compile" description="generate the
> distribution" >
> <!-- Create the distribution directory -->
> <mkdir dir="${dist}/lib"/>
>
> <!-- Put everything in ${build} into the mysite-${DSTAMP}.jar file -->
> <jar jarfile="${dist}/lib/mysite-${DSTAMP}.jar" basedir="${build}"/>
> </target>
>
> <target name="clean" description="clean up" >
> <!-- Delete the ${build} and ${dist} directory trees -->
> <delete dir="${build}"/>
> <delete dir="${dist}"/>
> </target>
> </project>
Re: Ant + Eclipse [message #12888 is a reply to message #12878] Sat, 22 January 2005 20:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mhuggins.udel.edu

I've got:
- Apache Ant 1.6.2 (using the jar's included with Eclipse)
- JDK 1.5.0 (this is the tools.jar I'm using)
- J2RE 1.4.2



Darin Swanson wrote:

> Looks like you have an incompatible tools.jar on your Ant runtime classpath
> with the JRE/JDK you are attempting to run the build in.
> Are you running Ant in a 1.3 VM and attempting to use a 1.4 tools.jar (and
> therefore the unsupportedClassVersion error)?
>
> Window>Preferences>Ant>Runtime>Classpath
>
> HTH
> Darins
>
> "Matt Huggins" <mhuggins@udel.edu> wrote in message
> news:csus6l$rt0$1@www.eclipse.org...
>
>>When I attempt to build my build.xml file with Ant in Eclipse, I get the
>>following message in my output when executing a <javac .../> element:
>>
>>BUILD FAILED: java.lang.UnsupportedClassVersionError:
>>com/sun/tools/javac/Main (Unsupported major.minor version 49.0)
>>
>>
>>If needed, the contents are nothing more than a slightly modified sample
>>as provided at http://ant.apache.org ...
>>
>>
>><?xml version="1.0" encoding="UTF-8" ?>
>>
>><project name="mysite" default="dist" basedir=".">
>><description>simple site build file</description>
>>
>><!-- set global properties for this build -->
>><property name="src" location="src"/>
>><property name="build" location="build"/>
>><property name="dist" location="dist"/>
>>
>><target name="init">
>><!-- Create the time stamp -->
>><tstamp/>
>>
>><!-- Create the build directory structure used by compile -->
>><mkdir dir="${build}"/>
>></target>
>>
>><target name="compile" depends="init" description="compile the source" >
>><!-- Compile the java code from ${src} into ${build} -->
>><javac srcdir="${src}" destdir="${build}"/>
>></target>
>>
>><target name="dist" depends="compile" description="generate the
>>distribution" >
>><!-- Create the distribution directory -->
>><mkdir dir="${dist}/lib"/>
>>
>><!-- Put everything in ${build} into the mysite-${DSTAMP}.jar file -->
>><jar jarfile="${dist}/lib/mysite-${DSTAMP}.jar" basedir="${build}"/>
>></target>
>>
>><target name="clean" description="clean up" >
>><!-- Delete the ${build} and ${dist} directory trees -->
>><delete dir="${build}"/>
>><delete dir="${dist}"/>
>></target>
>></project>
>
>
>
Re: Ant + Eclipse - Solution [message #12900 is a reply to message #12888] Sat, 22 January 2005 20:22 Go to previous message
Eclipse UserFriend
Originally posted by: mhuggins.udel.edu

I resolved the issue. Here's what I did in case anyone else runs into
the same problem. I right clicked on the build.xml file in the Package
Explorer, chose the "Run" menu from the popup, and the "External Tools"
option in the "Run" sub-menu. In the External Tools window, I clicked
the "JRE" tab, and selected the "Run in the same JRE as the workspace".
(The previous radio button that was selected was "Seperate JRE" with
my JRE 1.4.2 path selected.)

This fixed my problem...now just to work through the compile errors!
Thanks for the help!


Matt Huggins wrote:

> I've got:
> - Apache Ant 1.6.2 (using the jar's included with Eclipse)
> - JDK 1.5.0 (this is the tools.jar I'm using)
> - J2RE 1.4.2
>
>
>
> Darin Swanson wrote:
>
>> Looks like you have an incompatible tools.jar on your Ant runtime
>> classpath with the JRE/JDK you are attempting to run the build in.
>> Are you running Ant in a 1.3 VM and attempting to use a 1.4 tools.jar
>> (and therefore the unsupportedClassVersion error)?
>>
>> Window>Preferences>Ant>Runtime>Classpath
>>
>> HTH
>> Darins
>>
>> "Matt Huggins" <mhuggins@udel.edu> wrote in message
>> news:csus6l$rt0$1@www.eclipse.org...
>>
>>> When I attempt to build my build.xml file with Ant in Eclipse, I get
>>> the following message in my output when executing a <javac .../>
>>> element:
>>>
>>> BUILD FAILED: java.lang.UnsupportedClassVersionError:
>>> com/sun/tools/javac/Main (Unsupported major.minor version 49.0)
>>>
>>>
>>> If needed, the contents are nothing more than a slightly modified
>>> sample as provided at http://ant.apache.org ...
>>>
>>>
>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>
>>> <project name="mysite" default="dist" basedir=".">
>>> <description>simple site build file</description>
>>>
>>> <!-- set global properties for this build -->
>>> <property name="src" location="src"/>
>>> <property name="build" location="build"/>
>>> <property name="dist" location="dist"/>
>>>
>>> <target name="init">
>>> <!-- Create the time stamp -->
>>> <tstamp/>
>>>
>>> <!-- Create the build directory structure used by compile -->
>>> <mkdir dir="${build}"/>
>>> </target>
>>>
>>> <target name="compile" depends="init" description="compile the source" >
>>> <!-- Compile the java code from ${src} into ${build} -->
>>> <javac srcdir="${src}" destdir="${build}"/>
>>> </target>
>>>
>>> <target name="dist" depends="compile" description="generate the
>>> distribution" >
>>> <!-- Create the distribution directory -->
>>> <mkdir dir="${dist}/lib"/>
>>>
>>> <!-- Put everything in ${build} into the mysite-${DSTAMP}.jar file -->
>>> <jar jarfile="${dist}/lib/mysite-${DSTAMP}.jar" basedir="${build}"/>
>>> </target>
>>>
>>> <target name="clean" description="clean up" >
>>> <!-- Delete the ${build} and ${dist} directory trees -->
>>> <delete dir="${build}"/>
>>> <delete dir="${dist}"/>
>>> </target>
>>> </project>
>>
>>
>>
>>
Previous Topic:Eclipse setup for WEB-INF/classes folder
Next Topic:Multi-file replace
Goto Forum:
  


Current Time: Sun Jun 01 13:49:36 EDT 2025

Powered by FUDForum. Page generated in 0.06593 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top