JDK

V

vw_bora

Hi,

A basic question. I am running eclipse and tried running a ant script
and got the error "Unable to find a javac compiler". Is this because I
need to install a JDK ? If so how can confirm if I have this installed
or not.

Thank you

Pete
 
T

Tim Slattery

Hi,

A basic question. I am running eclipse and tried running a ant script
and got the error "Unable to find a javac compiler". Is this because I
need to install a JDK?

Either that, or the directory containing javac.exe (or linux
equivalent) is not on your PATH.
If so how can confirm if I have this installed or not.

Search your disk for javac.exe?
 
L

Lew

Hi,

A basic question. I am running eclipse and tried running a ant script
and got the error "Unable to find a javac compiler". Is this because I
need to install a JDK ? If so how can confirm if I have this installed
or not.

You need to install a JDK. At a minimum, declare an environment variable
("envar") JAVA_HOME set to the installation directory. Most people add the
"bin/" subdirectory of JAVA_HOME to their PATH as well.

You know if you installed it by whether you or the sysadmin for the
workstation installed it, and by whether an executable "javac" (for Windows,
"javac.exe") exists on the system (in that aforementioned "bin/"
subdirectory). The parent directory of javac's "bin/" is the installation
directory.

For example, on my system the JDK is installed in "/opt/java/java/" and the
javac command is in "/opt/java/java/bin/".

$ echo $JAVA_HOME
/opt/java/java

$ ls $JAVA_HOME/bin/
appletviewer jarsigner jconsole jrunscript native2ascii schemagen xjc
apt java jcontrol jsadebugd orbd serialver
ControlPanel javac jdb jstack pack200 servertool
extcheck javadoc jhat jstat policytool tnameserv
HtmlConverter javah jinfo jstatd rmic unpack200
idlj javap jmap jvisualvm rmid wsgen
jar javaws jps keytool rmiregistry wsimport
 
V

vw_bora

You need to install a JDK.  At a minimum, declare an environment variable
("envar") JAVA_HOME set to the installation directory.  Most people add the
"bin/" subdirectory of JAVA_HOME to their PATH as well.

You know if you installed it by whether you or the sysadmin for the
workstation installed it, and by whether an executable "javac" (for Windows,
"javac.exe") exists on the system (in that aforementioned "bin/"
subdirectory).  The parent directory of javac's "bin/" is the installation
directory.

For example, on my system the JDK is installed in "/opt/java/java/" and the
javac command is in "/opt/java/java/bin/".

$ echo $JAVA_HOME
/opt/java/java

$ ls $JAVA_HOME/bin/
appletviewer   jarsigner  jconsole  jrunscript  native2ascii  schemagen   xjc
apt            java       jcontrol  jsadebugd   orbd          serialver
ControlPanel   javac      jdb       jstack      pack200       servertool
extcheck       javadoc    jhat      jstat       policytool    tnameserv
HtmlConverter  javah      jinfo     jstatd      rmic          unpack200
idlj           javap      jmap      jvisualvm   rmid          wsgen
jar            javaws     jps       keytool     rmiregistry   wsimport

Hi Lew,

Thanks for the reply.

I am actually using eclipse on my PC at home. Just developing simple
Java programs and Eclipse is good enough. Anyway I have never
installed a JDK so went on Sun website and installing "Java SE
Development Kit 6u16". Hopingfully will do the trick.

Thank you.

Pete
 
A

Alessio Stalla

I am actually using eclipse on my PC at home. Just developing simple
Java programs and Eclipse is good enough.

Because Eclipse includes its own compiler, which is not Sun's javac.
There may be a way to tell Ant to use this compiler as well, but I
don't know.
Anyway I have never installed a JDK so went on Sun website and installing "Java SE
Development Kit 6u16". Hopingfully will do the trick.

Yes, but you may need to tell Eclipse about it. IIRC Eclipse uses the
name "JRE" for the JRE proper (runtime only) and for the JDK as well
(development kit). You can set it globally, per project or even -
again IIRC - per run configuration (ant task in your case).

hth,
Alessio
 
A

Andreas Leitgeb

Lew said:
$ echo $JAVA_HOME
/opt/java/java

Let me guess: the second "java" is a symlink to the current
jdk(or jre) and you replace the symlink manually after the
installation of a newer jdk :) (that's how I have it here,
except that my symlink is "JAVA", so tabbing works better
with all the jdk's in the same directory)
 
L

Lew

Andreas said:
Let me guess: the second "java" is a symlink to the current
jdk(or jre) and you replace the symlink manually after the
installation of a newer jdk :) (that's how I have it here,
except that my symlink is "JAVA", so tabbing works better
with all the jdk's in the same directory)

Yep. WHen I used Fedora I didn't replace the symlink entirely manual but used
the 'alternatives' mechanism. I don't have that set up on Ubuntu so manually
it is, now.
 
R

Roedy Green

Hi,

A basic question. I am running eclipse and tried running a ant script
and got the error "Unable to find a javac compiler". Is this because I
need to install a JDK ? If so how can confirm if I have this installed
or not.

Thank you

Pete

see http://mindprod.com/jgloss/jdk.html for how to install and test
your JDK.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Don’t worry about where you are. Watch the first derivative."
translation:
"Don’t worry about how things are. Watch where they are headed."
~ Fred Green (born: 1913-07-12 died: 1992-04-10 at age: 78) (my Dad, an electrical engineer)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,838
Latest member
KandiceChi

Latest Threads

Top