hello, I am learning Java, on my first “Hello World” program, this is what I get
alon@linux-6xrt:~/java> javac Ch2Sample1.java
/usr/lib/gcc/i586-suse-linux/4.3/…/…/…/crt1.o: In function _start': /usr/src/packages/BUILD/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to main’
collect2: ld returned 1 exit status
alon@linux-6xrt:~/java>
I googled around but could not figure out. what is gcj?
I am running openSUSE 11.1
Code:
public class hello2 {
public static void main(String] args) {
System.out.println(“Hello World!”);
}
}
and no change, still
alon@linux-6xrt:~/java> javac hello2.java
/usr/lib/gcc/i586-suse-linux/4.3/…/…/…/crt1.o: In function _start': /usr/src/packages/BUILD/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to main’
collect2: ld returned 1 exit status
alon@linux-6xrt:~/java>
I also discovered I dont have the directory
/usr/lib/jvm/java-1.6.0-sun-1.6.0/bin
this is the output of my directory
alon@linux-6xrt:~/java> cd /usr/lib/jvm/
alon@linux-6xrt:/usr/lib/jvm> ls
java java-gcj jre-1.6.0-openjdk
java-1.5.0 jre jre-gcj
java-1.5.0-gcj jre-1.5.0 jre-openjdk
java-1.5.0-gcj-4.3-1.5.0.0 jre-1.5.0-gcj
java-1.6.0-openjdk-1.6.0 jre-1.6.0
alon@linux-6xrt:/usr/lib/jvm>
Where do I find my java compiler?
I got the java compiler from the openSUSE repository.
Where do I take it from here? Anysuggestions ? should I download the java compiler from the Sun website?
Thanks
Your java compiler isn’t in the ‘java-1.6.0-sun-1.6.0’ directory because you most likely haven’t got the java-sun version installed.
By default the openJDK is installed.
The only problem with it is that it some times doesn’t work.
So I recommend you install these packages:
java-1_6_0-sun
java-1_6_0-sun-devel
java-1_6_0-sun-plugin
And remove all the java-1_6_0-openjdk packages.
Then you’ve got the /usr/lib/jvm/java-1.6.0-sun-1.6.0/bin directory.
But if you don’t want to uninstall openJDK then the javac command is in:
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/bin