# Java -- any users out there?



## gardner (Dec 30, 2011)

I am exploring running Java on FreeBSD x86 (32-bit).  I am finding that there is some info, but the FreeBSD Java project (http://www.freebsd.org/java/) is quite thin and out of date.

I have built most of the Java options and given them a try.  I have the Sun 1.6 JDK built from source, OpenJDK 6 and 7 and the Linux 1.6_30 JDK running.  They all seem to work at some level, although the Linux one has been fussy to set up with all the required compatibility bits.

My little project for now is to run the SPEC JVM2008 benchmark with each of the JDKs I can build, just to see if they all run okay and see which one appears to be faster.  My results are about like this:


```
JVM          Score
------------------
jdk1.6.0     18.5
openjdk6     16.3
openjdk7     23.3
Linux jdk1.6 22.1
```

As things sit, openjdk7 looks like my best bet in terms of simplicity to configure and manage, and performance.

I'm not sure if others have done any specific performance tuning with JVMs on FreeBSD.  Does anyone have more detailed ideas about the best JVM to choose relative to any types of applications?

My initial requirement is for a server app -- I would like to run an app server, maybe a servlet engine, but ideally JBoss -- and a database application.  I won't be running Java browser plug-ins or swing apps or any of that.

Has anyone had a go at setting up the IBM or WebLogic (JRocket) Linux JVMs on FreeBSD?  I may have a crack at that -- I would love to be able to get WebSphere 7 running on 8.2R.


----------



## gardner (Dec 31, 2011)

I do not believe this thread should have been sent to the ports forum.  It is not principally about the maintenance or installation of any port.


----------



## DutchDaemon (Dec 31, 2011)

Java is a port, and its functionality fits nowhere else. Running third-party software that is not a web or network service usually also ends up in this forum.


----------



## ddaley (Dec 31, 2011)

I have been using Open JDK 6 for about a month now with no issues.  I tried using Open JDK 7 at first, but had some issues with the way that the XML schema compiler generates classes in that version.  I'll have to deal with this issue at some point, but Open JDK 6 works great for now.  

I am running Netbeans and eclipse (for different projects) and am running tomcat.  I have been using maven and git without any issues.

I have two FreeBSD "machines" set up right now.  At work, I am running FreeBSD on a MacBook Pro using VMware Fusion.  At home I am running FreeBSD 8.2 on am AMD64 machine.  I have similar setups in both instances and so far no major issues that were not self inflicted.

This is one of the projects that I am working on: https://github.com/rackspace/repose

If you install git, openjdk6, and maven3, you can pull down the code and build/run it just fine on FreeBSD


----------



## grigorovl (Dec 31, 2011)

Unfortunately, due to the "official" lack of support for Android development and Glassfish server, I am forced to use a VirtualBox image with GNU/Linux. My main studies are in java, and I was only able to get Eclipse to work with regular java. I was also able to get EJB's to work with Netbeans, but I prefer Eclipse.

BSDroid[1] hasn't been updated in a while, and it's also stuck on Android 2.2 for FreeBSD-8 i386. The GlassFish Tools Bundle for Eclipse v1.2[2] is not available for FreeBSD. Bensmann's blog[3] shows how to install Java 6 and Glassfish 3.1 on FreeBSD 8. I think this is the closest to a current guide there is out there.

I need Android SKD and emulator, as well as Glassfish. I love FreeBSD and I know this issue is only a matter of time, thus I run my Eclipse in a VirtualBox image, rather than moving away.

[1]http://bsdroid.org/tiki-index.php
[2]http://dlc.sun.com.edgesuite.net/glassfish/eclipse/
[3]http://blog.bensmann.com/installing-java-6-and-glassfish-31-on-freebsd


----------



## ddaley (Dec 31, 2011)

One interesting thing I have noticed is this.  My work computer is a quad core i7 MacBook Pro.  I run 32 bit i386 FreeBSD in VMware Fusion and allocate 3GB of RAM and 2 cores to the VM.  My home machine is an AMD Phenom II x4 3Ghz processor with 8GB of RAM and I am running the 64 bit AMD version of the OS.

Building my maven application on the laptop (running in a VM) takes about 90 secs.  Building the same application using the same JDK on the AMD machine takes about 15 secs longer.  Not sure if this is due to the OS being 64 bit or AMD or what.  Overall, the AMD machine seems faster.  

I haven't done any official benchmarks of the two systems to compare overall performance though.

Another tidbit... building the same application under OSX using the JVM that comes from apple is about the same as FreeBSD running under the VM.  The OSX version may be about 5 to 10 secs faster on average.

Maybe I'll compile a table with multiple build times from each configuration.


----------



## zeiz (Jan 10, 2012)

My current job requires Talend Open Studio that is opensource software and it fortunately has versions for Linux and Solaris. BSD compatibility is declared. 
It runs on Sun Java and doesn't on OpenJDK. Of course I want it on FreeBSD.
I installed jdk1.6, diablo-jdk1.6 and then eclipse which pulled also OpenJDK1.6. I found an 2009 advice on internet to launch Talend with

```
$ ./TOS_DI-linux-gtk-x86.sh -os freebsd
```
It didn't start and I got errors:

```
ELF binary type "0" not known.
./TOS_DI-linux-gtk-x86.sh: ./TOS_DI-linux-gtk-x86_64: Exec format error
```
There are also Perl scripts there to lauch Talend on Solaris but they also didn't help.
Maybe java-guys know how to launch Talend on FreeBSD-9-STABLE-amd64?


----------



## achix (Jan 11, 2012)

zeiz said:
			
		

> My current job requires Talend Open Studio that is opensource software and it fortunately has versions for Linux and Solaris. BSD compatibility is declared.
> It runs on Sun Java and doesn't on OpenJDK. Of course I want it on FreeBSD.
> I installed jdk1.6, diablo-jdk1.6 and then eclipse which pulled also OpenJDK1.6. I found an 2009 advice on internet to launch Talend with
> 
> ...



what does [CMD="kldstat"] | grep linux [/CMD] shows? Your issue seems to be linux compatibility and not java.


----------



## achix (Jan 11, 2012)

gardner said:
			
		

> My little project for now is to run the SPEC JVM2008 benchmark with each of the JDKs I can build, just to see if they all run okay and see which one appears to be faster.  My results are about like this:
> 
> 
> ```
> ...



Haven't tried openjdk7 but from the other contestants I choose openjdk6. It is ultra stable. Have been running eclipse, jboss for a year without issues. Also I am a java architect (emm.... developer ), and since 2004 I use eclipse on FreeBSD.


----------



## zeiz (Jan 12, 2012)

Thanks for answering, achix

```
$ kldstat |grep linux
 3    3 0xffffffff8241f000 45090    linux.ko
```
Also

```
$ java -version
java version "1.6.0_03-p4"
Java(TM) SE Runtime Environment (build 1.6.0_03-p4-zeiz_06_jan_2012_15_17-b00)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-p4-zeiz_06_jan_2012_15_17-b00, mixed mode)
```
And

```
zzbsdf2# ls /var/db/pkg |grep linux
linux-f10-atk-1.24.0
linux-f10-cairo-1.8.0_1
linux-f10-curl-7.19.6_1
linux-f10-cyrus-sasl2-2.1.22_1
linux-f10-expat-2.0.1
linux-f10-flashplugin-10.3r183.11
linux-f10-fontconfig-2.6.0
linux-f10-gtk2-2.14.7_3
linux-f10-jpeg-6b
linux-f10-libssh2-0.18
linux-f10-nspr-4.7.6
linux-f10-nss-3.12.3.99.3_1
linux-f10-openldap-2.4.12_1
linux-f10-openssl-0.9.8g
linux-f10-pango-1.28.3
linux-f10-png-1.2.37_1
linux-f10-sqlite3-3.5.9_1
linux-f10-tiff-3.8.2
linux-f10-xorg-libs-7.4_1
linux_base-f10-10_4
```


----------

