Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » JAVA_HOME for Any Build
JAVA_HOME for Any Build [message #257759] Fri, 02 July 2004 00:35 Go to next message
Eclipse UserFriend
I have a small applet which I can run in eclipse (3.0) as a java applet
just fine. I wanted to see if I could create my own ant build file (shown
below), but it stops at the line:

<javac srcdir="${src}" destdir="${bin}" />

and the console window contains:

Buildfile: C:\Program Files\eclipse\workspace\test\build.xml
init:
compile:
[javac] Compiling 1 source file to
C:\Program Files\eclipse\workspace\test\bin

BUILD FAILED: C:\Program Files\eclipse\workspace\test\build.xml:16:
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK

Total time: 750 milliseconds

Can anyone help me figure out what I've done wrong?



Thanks,

Bobby Berns


<?xml version="1.0"?>
<project name="test" default="run" basedir=".">

<property name="src" value="." />
<property name="bin" value="bin" />
<property name="jar" value="jar" />
<property name="run" value="run" />

<target name="init">
<mkdir dir="${bin}" />
</target>

<target name="compile" depends="init">
<!-- Compile the java code -->

<javac srcdir="${src}" destdir="${bin}" />
</target>

<target name="jar" depends="compile">
<jar jarfile="ctod.jar" includes="*.class" basedir="${bin}" />
</target>

<target name="run" depends="compile">
<!-- Run The Application -->

<java classpath="${build}" classname="ctod" />
</target>

</project>
Re: JAVA_HOME for Any Build [message #257763 is a reply to message #257759] Fri, 02 July 2004 01:45 Go to previous messageGo to next message
Eclipse UserFriend
This is a FAQ.

You need a tools.jar on your Ant runtime classpath
You have several choices (of which I list the three of the most common):

start Eclipse using the -vm option to point to a JDK install and Eclipse
will automatically add a tools.jar to your Ant runtime classpath
set your JAVA_HOME environment variable to point to a JDK install and
Eclipse will automatically add a tools.jar to your Ant runtime classpath
add a tools.jar from your favorite JDK install to your Ant runtime
classpath either via the preferences (global setting) or as required on the
classpath tab of the
individual Ant launch configuration.

HTH
Darins

"Bobby Berns" <bobby@eagle-i.com> wrote in message
news:cc2olo$h9u$1@eclipse.org...
> I have a small applet which I can run in eclipse (3.0) as a java applet
> just fine. I wanted to see if I could create my own ant build file (shown
> below), but it stops at the line:
>
> <javac srcdir="${src}" destdir="${bin}" />
>
> and the console window contains:
>
> Buildfile: C:\Program Files\eclipse\workspace\test\build.xml
> init:
> compile:
> [javac] Compiling 1 source file to
> C:\Program Files\eclipse\workspace\test\bin
>
> BUILD FAILED: C:\Program Files\eclipse\workspace\test\build.xml:16:
> Unable to find a javac compiler;
> com.sun.tools.javac.Main is not on the classpath.
> Perhaps JAVA_HOME does not point to the JDK
>
> Total time: 750 milliseconds
>
> Can anyone help me figure out what I've done wrong?
>
>
>
> Thanks,
>
> Bobby Berns
>
>
> <?xml version="1.0"?>
> <project name="test" default="run" basedir=".">
>
> <property name="src" value="." />
> <property name="bin" value="bin" />
> <property name="jar" value="jar" />
> <property name="run" value="run" />
>
> <target name="init">
> <mkdir dir="${bin}" />
> </target>
>
> <target name="compile" depends="init">
> <!-- Compile the java code -->
>
> <javac srcdir="${src}" destdir="${bin}" />
> </target>
>
> <target name="jar" depends="compile">
> <jar jarfile="ctod.jar" includes="*.class" basedir="${bin}" />
> </target>
>
> <target name="run" depends="compile">
> <!-- Run The Application -->
>
> <java classpath="${build}" classname="ctod" />
> </target>
>
> </project>
>
>
Re: JAVA_HOME for Any Build [message #257766 is a reply to message #257763] Fri, 02 July 2004 01:45 Go to previous message
Eclipse UserFriend
Sorry about the formatting...looked good on my screen :-(

Darins

"Darin Swanson" <Darin_Swanson@us.ibm.com> wrote in message
news:cc2p6f$hsq$1@eclipse.org...
> This is a FAQ.
>
> You need a tools.jar on your Ant runtime classpath
> You have several choices (of which I list the three of the most common):
>
> start Eclipse using the -vm option to point to a JDK install and
Eclipse
> will automatically add a tools.jar to your Ant runtime classpath
> set your JAVA_HOME environment variable to point to a JDK install and
> Eclipse will automatically add a tools.jar to your Ant runtime classpath
> add a tools.jar from your favorite JDK install to your Ant runtime
> classpath either via the preferences (global setting) or as required on
the
> classpath tab of the
> individual Ant launch configuration.
>
> HTH
> Darins
>
> "Bobby Berns" <bobby@eagle-i.com> wrote in message
> news:cc2olo$h9u$1@eclipse.org...
> > I have a small applet which I can run in eclipse (3.0) as a java applet
> > just fine. I wanted to see if I could create my own ant build file
(shown
> > below), but it stops at the line:
> >
> > <javac srcdir="${src}" destdir="${bin}" />
> >
> > and the console window contains:
> >
> > Buildfile: C:\Program Files\eclipse\workspace\test\build.xml
> > init:
> > compile:
> > [javac] Compiling 1 source file to
> > C:\Program Files\eclipse\workspace\test\bin
> >
> > BUILD FAILED: C:\Program Files\eclipse\workspace\test\build.xml:16:
> > Unable to find a javac compiler;
> > com.sun.tools.javac.Main is not on the classpath.
> > Perhaps JAVA_HOME does not point to the JDK
> >
> > Total time: 750 milliseconds
> >
> > Can anyone help me figure out what I've done wrong?
> >
> >
> >
> > Thanks,
> >
> > Bobby Berns
> >
> >
> > <?xml version="1.0"?>
> > <project name="test" default="run" basedir=".">
> >
> > <property name="src" value="." />
> > <property name="bin" value="bin" />
> > <property name="jar" value="jar" />
> > <property name="run" value="run" />
> >
> > <target name="init">
> > <mkdir dir="${bin}" />
> > </target>
> >
> > <target name="compile" depends="init">
> > <!-- Compile the java code -->
> >
> > <javac srcdir="${src}" destdir="${bin}" />
> > </target>
> >
> > <target name="jar" depends="compile">
> > <jar jarfile="ctod.jar" includes="*.class" basedir="${bin}" />
> > </target>
> >
> > <target name="run" depends="compile">
> > <!-- Run The Application -->
> >
> > <java classpath="${build}" classname="ctod" />
> > </target>
> >
> > </project>
> >
> >
>
>
Re: JAVA_HOME for Any Build [message #257769 is a reply to message #257766] Fri, 02 July 2004 01:23 Go to previous message
Eclipse UserFriend
Thanks Darin. Adding the -vm to the eclipse startup did it. I HAD set
JAVA_HOME to a jdk in my system environments variables, but that somehow
didn't do it.

I also found that If I set fork to yes in the javac, thus allowing ref to
external jdk handled it also.



Darin Swanson wrote:

> Sorry about the formatting...looked good on my screen :-(

> Darins

> "Darin Swanson" <Darin_Swanson@us.ibm.com> wrote in message
> news:cc2p6f$hsq$1@eclipse.org...
> > This is a FAQ.
> >
> > You need a tools.jar on your Ant runtime classpath
> > You have several choices (of which I list the three of the most common):
> >
> > start Eclipse using the -vm option to point to a JDK install and
> Eclipse
> > will automatically add a tools.jar to your Ant runtime classpath
> > set your JAVA_HOME environment variable to point to a JDK install and
> > Eclipse will automatically add a tools.jar to your Ant runtime classpath
> > add a tools.jar from your favorite JDK install to your Ant runtime
> > classpath either via the preferences (global setting) or as required on
> the
> > classpath tab of the
> > individual Ant launch configuration.
> >
> > HTH
> > Darins
> >
> > "Bobby Berns" <bobby@eagle-i.com> wrote in message
> > news:cc2olo$h9u$1@eclipse.org...
> > > I have a small applet which I can run in eclipse (3.0) as a java applet
> > > just fine. I wanted to see if I could create my own ant build file
> (shown
> > > below), but it stops at the line:
> > >
> > > <javac srcdir="${src}" destdir="${bin}" />
> > >
> > > and the console window contains:
> > >
> > > Buildfile: C:Program Fileseclipseworkspacetestbuild.xml
> > > init:
> > > compile:
> > > [javac] Compiling 1 source file to
> > > C:Program Fileseclipseworkspacetestbin
> > >
> > > BUILD FAILED: C:Program Fileseclipseworkspacetestbuild.xml:16:
> > > Unable to find a javac compiler;
> > > com.sun.tools.javac.Main is not on the classpath.
> > > Perhaps JAVA_HOME does not point to the JDK
> > >
> > > Total time: 750 milliseconds
> > >
> > > Can anyone help me figure out what I've done wrong?
> > >
> > >
> > >
> > > Thanks,
> > >
> > > Bobby Berns
> > >
> > >
> > > <?xml version="1.0"?>
> > > <project name="test" default="run" basedir=".">
> > >
> > > <property name="src" value="." />
> > > <property name="bin" value="bin" />
> > > <property name="jar" value="jar" />
> > > <property name="run" value="run" />
> > >
> > > <target name="init">
> > > <mkdir dir="${bin}" />
> > > </target>
> > >
> > > <target name="compile" depends="init">
> > > <!-- Compile the java code -->
> > >
> > > <javac srcdir="${src}" destdir="${bin}" />
> > > </target>
> > >
> > > <target name="jar" depends="compile">
> > > <jar jarfile="ctod.jar" includes="*.class" basedir="${bin}" />
> > > </target>
> > >
> > > <target name="run" depends="compile">
> > > <!-- Run The Application -->
> > >
> > > <java classpath="${build}" classname="ctod" />
> > > </target>
> > >
> > > </project>
> > >
> > >
> >
> >
Previous Topic:Execute Applet from Ant build
Next Topic:Dynamic popup menu in viewerContribution
Goto Forum:
  


Current Time: Wed May 07 15:33:23 EDT 2025

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

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

Back to the top