Skip to content

Instantly share code, notes, and snippets.

@nathggns
Created January 29, 2015 20:25
Show Gist options
  • Save nathggns/1315a313d1a94aaf71ed to your computer and use it in GitHub Desktop.
Save nathggns/1315a313d1a94aaf71ed to your computer and use it in GitHub Desktop.

Revisions

  1. nathggns created this gist Jan 29, 2015.
    30 changes: 30 additions & 0 deletions freebsd-java.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    Before installing this JRE, you have to install the linux binary compatibility on FreeBSD, you can follow this documentation.
    Jave requires some information about the proc. You have to mount linprocfs, type:

    kldload linprocfs
    mount -t linprocfs linprocfs /compat/linux/proc

    and add this line to /etc/fstab:

    linprocfs /compat/linux/proc linprocfs rw 0 0


    The Sun/Oracle JRE has a dependency marked as forbidden and the installation will fail. Go to `/usr/ports/textproc/linux-f10-expat2.0.1/` and in the Makefile remove the line which starts with `FORBIDDEN=`.
    Next you have to manually get the linux tarball due to licence issue (like `jre-7u65-linux-i586.tar.gz`) from java official web site and copy the file to `/usr/ports/distfiles`. Then to install the JRE, go to `/usr/ports/java/linux-sun-jre17/` and run:

    make install distclean

    Note: The previous version of this part, tested on FreeBSD 9.2 amd64, was explained like this: You may have to set `JRE_UPDATE_VERSION` variable in your Makefile to the actual number (e.g. 45 like in this example) and run `make install NO_CHECKSUM=1`.


    Try running `java -version`. You may end up with a message that it can not find libjli.so. One way to fix it is to add your java paths to the search explicitly. Make a symlink:

    ln -s /usr/local/linux-sun-jre1.7.0/lib/i386 /compat/linux/usr/lib/java

    And in `/compat/linux/etc/ld.so.conf.d/java.conf` add:

    /usr/lib/java
    /usr/lib/java/jli

    Run /compat/linux/sbin/ldconfig.
    Now java -version should work.