# javavm: bsdjava vs. freebsd



## mickey (Dec 19, 2009)

On a FreeBSD 8.0-RELEASE-p1 system, I have installed these:

jdk-1.6.0.3p4_13
diablo-jdk-1.6.0.07.02_7

By default I am using the _bsdjava_ VM, which corresponds to jdk-1.6.0.3p4_13 built from ports.

Since the upgrade from 7.2 to 8.0, I noticed that some Java applications, that open network connections, stopped working (i.e. they cannot connect to a server).

To my surprise I just discovered, that when I use the _freebsd_ Java VM (diablo-jdk-1.6.0.07.02_7), these applications work properly. So it seems there is some problem with the current JDK built from ports.

Has anyone discovered similar behaviour in running Java applications?


----------



## achix (Dec 19, 2009)

In my new amd64, FreeBSD 8.0-RELEASE i have installed 

diablo-jdk-1.6.0.07.02_7
openjdk6-b16_2

I have run Jboss-5.1.0.GA successfully with both of them with no noticeable different behavior.

Diablo is compiled against FreeBSD 7.x and needs FreeBSD 7 compatibility to be enabled (COMPAT_FREEBSD7). So, Diablo, generally is not recommended for 8.x (as per the FreeBSD java community).

Now about your native jdk-1.6.0.3p4_13 issue:
Have you configured this system to be IPV6 enabled?
Did you enable IPV6 option at compilation?
Did you tried playing with java.net.preferIPv4Stack=true System property (-D) ?

Anyways, the future is openjdk, so we should do our work (testing, playing, production) there.


----------



## mickey (Dec 19, 2009)

achix said:
			
		

> Diablo is compiled against FreeBSD 7.x and needs FreeBSD 7 compatibility to be enabled (COMPAT_FREEBSD7). So, Diablo, generally is not recommended for 8.x (as per the FreeBSD java community).



Since I am using the nvidia driver, I have 5/6/7 compatibility compiled into my kernel and installed the correspondig compat packages from the ports.



			
				achix said:
			
		

> Now about your native jdk-1.6.0.3p4_13 issue:
> Have you configured this system to be IPV6 enabled?
> Did you enable IPV6 option at compilation?
> Did you tried playing with java.net.preferIPv4Stack=true System property (-D) ?



As of FreeBSD 8.0 I have (for the first time) put the option _INET6_ in my kernel configuration, as I was somehow getting annoyed by more and more software complaining like:

socket: protocol not supported

Other than that, I have not enabled IPv6 in /etc/rc.conf, and the world is compiled (by default) with IPv6 support. The native JDK is also compiled with IPv6 support turned on, so I am guessing where my problem lives 

`$ setenv JAVAVM_OPTS "-Djava.net.preferIPv4Stack=true"` indeed fixes the problem. Thanks!



			
				achix said:
			
		

> Anyways, the future is openjdk, so we should do our work (testing, playing, production) there.



Maybe I will give openjdk a try these days. As I am using JDK for some software development, I would be interested in how it performs compared to Sun JDK, too.


----------

