# [q] Installing Java 10 on freebsd 11



## platform (Jun 16, 2018)

I need to install latest Oracle JDK on my FreeBSD dev machine (x86_64, 11-RC2, zfs within VirtualBox 5.12).
The ports collection has Oracle JDK 9 linux, but requires to download JDK from Oracle site.
Oracle site no longer makes JDK 9 linux available, and instead there is JDK 10 (for Linux).

I tried to just download JDK 10 linux, the modified The makefile in /usr/ports/java/Linux-oracle-jdk9 (to point to the new JDK by updating major/minor and patch level). The executed:  make install NO_CHECKSUM=1 .  ran into a bunch of errors. So I guess this was not the workaround.

Is there an approach to address this gap?

thx in advance


----------



## ShelLuser (Jun 16, 2018)

I think you're mixing up some facts here. The Ports collection has OpenJDK8, but not 9. In fact, I'm not even sure if 9 is actually a valid release anymore.

So if you need Java on FreeBSD then your best option at this time is java/openjdk8. That is the latest Java release for FreeBSD.

I'm pretty sure it'll suffice because seriously, the projects which actually use the features introduced by the latest Java standards can be counted on one hand at this time (time of writing).

Still, if you insist on version 10 then just grab the Linux version and use that to setup the rest of the environment.


----------



## platform (Jun 16, 2018)

Thank you for your follow up. I do need Oracle JDK 10, not OpenJDK 8.  The ports collection has Oracle JDK9 for Linux (which is what I am starting with, only trying to modify for 10).

WRT your suggestion  





> "...if you insist on version 10 then just grab the Linux version and use that to setup the rest of the environment...."



The Linux setup does not just work out of the box in my understanding (but I did not try it), which is why I tried to use /usr/ports/java/Linux-oracle-jdk9 as a foundation.  I got stuck, as simply modifying the make file with
JDK_VERSION=10
JDK_UPDATE_VERSION=0
JDK_PATCH_VERSION=1

was not enough.
Which is, why, I was hoping that folks more knowledgeable than me, could recommend additional changes to the Makefile in Linux-oracle-jdk9, to get it to install the jdk-10.0.1_linux-x64_bin.tar.gz

The errors I am getting are :


> pkg-static: Unable to access file /usr/ports/java/linux-oracle-jdk9/work/stage/usr/local/linux-oracle-jdk10/lib/jdk.plugin.dom.jar: No such file or directory.



And the same error for libcpr.so and others






ShelLuser said:


> I think you're mixing up some facts here. The Ports collection has OpenJDK8, but not 9. In fact, I'm not even sure if 9 is actually a valid release anymore.
> 
> So if you need Java on FreeBSD then your best option at this time is java/openjdk8. That is the latest Java release for FreeBSD.
> 
> ...


Than[/QUOTE]


----------



## ondra_knezour (Jun 16, 2018)

See PR 228848 - Add three new ports for Linux Java: JRE 10 (linux-oracle-jre10), JDK 10 (linux-oracle-jdk10) and Server JRE 10 (linux-oracle-serverjre10)


----------



## platform (Jun 17, 2018)

ondra_knezour thank you.  I think this is exactly what I need.   
I downloaded the .patch file.  Could you help with steps of how to apply to the source tree?
(simply copying it to /usr/ports   and then doing patch -C  < patchfile.patch did not work ).
(my bsd is 11.2-RC2)

thx again


----------



## platform (Jun 17, 2018)

I was able to apply the patch by doing (as root)
cd /usr/ports
patch -p0 < /home/myhome/Downloads/linux-oracle-java10.patch

cd /usr/ports/java/Linux-oracle-jd10
make config-recursive
make install

all worked
My /etc/fstab   has:

# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ada0p2             none    swap    sw              0       0
linprocfs   /compat/linux/proc   linprocfs   rw   0  0
linsysfs    /compat/linux/sys   linsysfs        rw      0       0
tmpfs    /compat/linux/dev/shm  tmpfs   rw,mode=1777    0       0



Unfortunately, it seems like there is still some problem

[root@fbtr1 /usr/ports/java/linux-oracle-jdk10]# kldload linprocfs
kldload: can't load linprocfs: module already loaded or in kernel
[root@fbtr1 /usr/ports/java/linux-oracle-jdk10]# java
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xffffffffff600800, pid=3119, tid=100539
#
# JRE version:  (10.0.1+10) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (10.0.1+10, mixed mode, aot, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  0xffffffffff600800
#
# Core dump will be written. Default location: core.3119 (may not exist)
#
# An error report file with more information is saved as:
# /usr/ports/java/linux-oracle-jdk10/hs_err_pid3119.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
Abort trap (core dumped)
[root@fbtr1 /usr/ports/java/linux-oracle-jdk10]#


----------



## ondra_knezour (Jun 17, 2018)

Try to submit your output with the error log mentioned in it and at least output of the uname -a command to the PR mentioned above. Patch author or somebody watching progress of this PR is your best bet.


----------



## platform (Jun 18, 2018)

ondra_knezour   thx.  I updated the PR  you referenced with my bug report.


----------



## Sérgio (Jun 20, 2018)

According to the ports document, you'll need linux-c7. This crashes with linux-c6.


----------



## giahung1997 (Jun 21, 2018)

I would say Java 9 or 10 is a short term release (think about Ubuntu not LTS branch) and will be EOL very quickly. I you want it desperately, try it on Linux or Windows. Why go the hard way? What do you want to accomplish? Wait for Java 11 (a LTS like Java 8), it will be available in ports as OpenJDK11 for sure


----------



## Sérgio (Jun 21, 2018)

I cannot find any work being done to port recent OpenJDK versions to BSD.

http://openjdk.java.net/projects/bsd-port/


----------



## platform (Jun 22, 2018)

just to close the loop on this. 
I worked with the maintainer (Lev), followed his advice to use Linux-c7.
He also updated the required dependencies to use c7, after my  bug report.
Also, there was small issue with one of the bash-sensitive scripts that he fixed.

All in all Oracle Java JDK 10 is now working, and thanks to Lev's patch is available in the ports tree.
https://svnweb.freebsd.org/ports/head/java/linux-oracle-jdk10/

It is only for x86_64. 
I am running in on version 11 RC2.

thx for all the help


----------



## bvansomeren (Jul 9, 2018)

giahung1997 said:


> I would say Java 9 or 10 is a short term release (think about Ubuntu not LTS branch) and will be EOL very quickly. I you want it desperately, try it on Linux or Windows. Why go the hard way? What do you want to accomplish? Wait for Java 11 (a LTS like Java 8), it will be available in ports as OpenJDK11 for sure



RHEL (one of the bigger contributors) will not be spinning anything except LTS openjdk, so my best guess is that you're right.
After 11 lands, Redhat will make their version and the porting work will start


----------



## SirDice (Jul 9, 2018)

bvansomeren said:


> RHEL (one of the bigger contributors) will not be spinning anything except LTS openjdk, so my best guess is that you're right.
> After 11 lands, Redhat will make their version and the porting work will start


https://access.redhat.com/articles/3253281


----------



## platform (Dec 11, 2018)

Has JDK 11 been released for FreeBSD ?  (I do not see it in ports)


----------



## SirDice (Jan 30, 2019)

platform said:


> Has JDK 11 been released for FreeBSD ? (I do not see it in ports)


If it's not in the ports tree, it's not been released.


----------



## Remington (Jul 19, 2019)

Major Java releases are every 6 months and many Java developers including myself are staying with JDK 11 because of its LTS.  It's expected that JDK 17 release in 2021 will be the next LTS.  So anything in between, the support or updates will be discontinued quickly.  I wouldn't recommend using JDK 10.


----------



## ucomp (Jul 19, 2019)

Remington said:


> .... Java releases ...


Remington, you answered to an outdated information(see the date of the posts before you)....

BSD has its own development-branch called bsd-port...
In addition to  LTS you will be supported by  Top BSD-programmers     :








						battleblow - Overview
					

battleblow has 37 repositories available. Follow their code on GitHub.




					github.com
				




if you're interested in you can visit the FreeBSD java mailing list


----------

