Re: Configuring Java in Suse 11.1 Linux
piscesboy wrote:
I updated my JDK to 1.6 in Suse Linux 11.1 and it can't compile even
the simplest of programs.
To check that my default java is correctly set, I ran:
/usr/sbin/update-alternatives --display java
and got:
java - status is auto.
link currently points to /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
That's confusing. That looks like a JRE rather than a JDK (i.e. a runtime only
environment, not a development environment). I'm surprised it has a javac
compiler as part of it.
Unfortunately the only openSUSE system I have [had] has just been packed up
ready to be shipped to China, so I can't test it. However, I'm almost certain
that the Sun Java is available on the nonOSS CD. Try installing that version of
Java and setting it as the default environment via alternatives. I'm almost
certain that's what I did on that system. Even if you don't have the non-OSS CD
you should be able to install Sun Java via YaST if your repos are configured
correctly.
followed by a bunch of alternative java installs.
It is set to choose the "best" JDK for the job which is jre-1.6.0-
openjdk/bin/java
Now even the following simple code won't compile properly:
import java.io.*;
public class Hello{
public static void main(String[] args){
System.out.println("It works.");
}
}
when I compile using javac Hello.java.
Every time, it says "undefined reference to 'main'.
Am I invoking it wrong?
It almost sounds like the OpenJDK JRE includes the javac executable, but not the
libraries on which it depends. Unless it's an openSUSE packaging error and the
javac command is from a different package, but because you've set the Java
environment to a JRE using alternatives the javac command now points to some
faulty location. If you follow all the symbolic links from javac ('which javac'
will tell you where that chain starts) to an actual executable, what package
does that executable derive from?
--
Nigel Wade