using javac error

I’ve downloaded and extracted rpm files from jdk-6u7-linux-i586-rpm.bin.
All of the rpms are installed without error.
The problem 1: no man manual about javac, but javac does exist
The problem 2: all java script cannot be compiled, the error is:

/usr/lib/gcc/i586-suse-linux/4.3/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status

Why not install the RPMs shipping with openSUSE?


  1. There is no manual because you did not install the rpms from openSUSE, and therefore need to install documentation yourself.

  2. Assuming your code is correct, I would wonder why javac is pointing to some gcc library. Probably because your javac sym link is pointing to gnu’s version of java, and you are importing packages incorrectly or your classpath is off.

Fix: as stated, install the opensuse rpms. Otherwise, this is probably going to be more work than you want. (Updating symlinks, classpaths, etc.)

Your system can handle multiple versions of jre and/or jdk. This is controlled by a linking mechanism, which is located under “/etc/alternatives/”. In your situation, the rpms you installed did not properly configured themselves through this mec. and you’re ended up using gcj, the Gnu Java Compiler, which would produce “a.out” instead of “xxx.class” and requires an argument “–main=<class name>” to indicate which class contains the main method you want os to invoke when “a.out” is executed.

you may try the following command

update-alternatives --config javac

to see if the rpms has registered themselves but not configured, under which case it would be pretty easy to use your new jdk. And there do exist a manual page for update-alternatives so you will have something to refer to if the command won’t do.