Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #3906

Re: Error while compilling program on Linux

From Nigel Wade <nmw-news@ion.le.ac.uk>
Newsgroups comp.lang.java.programmer
Subject Re: Error while compilling program on Linux
Date 2011-05-10 09:47 +0100
Message-ID <92sce0FodrU1@mid.individual.net> (permalink)
References <14db58a7-1f7f-4a8d-89d4-b27559860fff@d1g2000yqm.googlegroups.com>

Show all headers | View raw


On 10/05/11 06:54, ruds wrote:
> Hi,
> I want to execute a program on linux but it is giving me an error:
> "Syntax error, 'for each' statements are only available if source
> level is 5.0"
> I have JDK 1.6 installed and my JAVA_HOME and CLASSPATH variable are
> having the paths correct, still I'm getting this error.

Neither of those environment variables affect which executable gets run
when you type the javac command.

> On checking the version: javac -version I'm getting: Eclipse Java
> Compiler v_677_R32x, 3.2.1 release
> this is happening even if I expicitly set the $CLASSPATH.
> I have set CLASSPATH in my .profile too.
> This program was working perfectly 10 days ago and now suddenly it has
> started giving errors.
> What might be the problem?
> Please help.

Installing Eclipse may have put the Eclipse javac binary before the JDK
in the PATH. If so, it's simply a matter of fixing your PATH so that JDK
path comes first.

You don't say what flavour of Linux you have, but another possible
explanation is that it uses "alternatives", and installing Eclipse has
overridden the default Java compiler setting.

To see if this is the case type (you may need to be root to do this):

 update-alternatives --list javac

If alternatives is installed, and it is being used to provide alternate
Java installations, this should tell you which javac are available.
You can use the update-alternatives command to switch between the
installed Java implementations.

-- 
Nigel Wade

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Error  while compilling program on Linux ruds <rudranee@gmail.com> - 2011-05-09 22:54 -0700
  Re: Error  while compilling program on Linux Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-05-10 08:04 +0000
  Re: Error  while compilling program on Linux Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-05-10 09:47 +0100
  Re: Error  while compilling program on Linux Martin Gregorie <martin@address-in-sig.invalid> - 2011-05-10 20:46 +0000
    Re: Error while compilling program on Linux ruds <rudranee@gmail.com> - 2011-05-10 22:49 -0700
  Re: Error  while compilling program on Linux Roedy Green <see_website@mindprod.com.invalid> - 2011-05-11 03:06 -0700
    Re: Error  while compilling program on Linux Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-05-11 14:47 +0100
      Re: Error  while compilling program on Linux Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-05-11 15:31 +0000
        Re: Error  while compilling program on Linux Lew <noone@lewscanon.com> - 2011-05-11 16:01 -0400

csiph-web