sun jdk 1.6 under FreeBSD 8.1

Hi,
I have successfully installed sun-jdk-1.6 under FreeBSD 8.1, but when i run
Code:
$java -version
i get this error:
Code:
$ java -version ELF binary type "0" not known.
/usr/local/linux-sun-jdk1.6.0/bin/java: 1: Syntax error: "(" unexpected

I installed sun-jdk by ports:
Code:
1.	# cd linux_base-fc4/
	# make install clean

2.	paste jdk-6u22-linux-i586.bin in /usr/ports/distfiles

3.	# cd /usr/ports/java/linux-sun-jdk16/
	make install clean

4.	#reboot

Where did I go wrong?
Thanks in advance.
 
I was troubleshooting this. I'm quite near to a solution.

I add these lines in /etc/rc.conf:
Code:
linux_enable="YES"
then added two environment variables:
Code:
setenv JAVA_HOME "/usr/local/linux-sun-jdk1.6.0/"
setenv LD_LIBRARY_PATH /usr/local/linux-sun-jdk1.6.0/jre/lib/i386/jli

Now there are two problems in this.
First, after setting these environment variables, if i run java -version, i get this warning:
Code:
Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location - find_vma failed
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode)

Second, the environment variable does not persist if i reboot my machine. I tried fixing it by writing a shell script containing the setenv commands and placed it under /root/bin. But then when i run java -version as a normal user, I get the same error of ELF binary type "0" not known.


I googled for "Set environment variables permanently in FreeBSD", but did not get any useful result. please help.
 
Use emulators/linux_base-f10. Fc4 is really old.

Also set in /etc/make.conf:
Code:
JAVA_PREFERRED_PORTS?=JAVA_PORT_LINUX_SUN_JDK_1_6

That's all I had to do:

Code:
dice@molly:~>java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode)
dice@molly:~>
 
SirDice said:
That's all I had to do:
dice@molly:~>java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode)
dice@molly:~>

Thanks for the reply. I already tried it.
Code:
1. pkg_remove -v -r linux_base-fc4-4
2. pkg_remove -v -r linux-sun-jdk-1.6.0.22
3. add JAVA_PREFERRED_PORTS?=JAVA_PORT_LINUX_SUN_JDK_1_6 in make.conf
4. pkg_add -v -r linux_base-f10
5. cd /usr/ports/java/linux-sun-jdk16 -> make install clean
6. java -> /usr/local/linux-sun-jdk1.6.0/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such 
file or directory

I had no errors while installing java.
 
Make sure java/javavmwrapper is properly installed. It should be installed as a dependency of linux-sun-jdk16.

I don't have that libjli anywhere so I'm wondering why it's looking for it.
 
one more question....
is there any way to install sun jdk by using pkg_add? ports take a lot of time for installation...
 
SOLVED IT FINALLY.

Just add this line in etc/fstab
Code:
linprocfs   /compat/linux/proc   linprocfs   rw   0  0

Sun jdk version "1.6.0_22" on FreeBSD 8.1
 
Back
Top