2 The Java™ Environment

Ensure that you have the current ports collection as make will fail if it attempts to build older source. You can upgrade your entire ports collection by using CVSup. See the Using CVSup section of the Handbook for more information. You can also download the ports you need manually from ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/ to get you going.

Note: You will need Linux Emulation (Linux-ABI) enabled in your kernel configuration. Simply add the following option to your kernel configuration file recompile it, and reinstall the kernel. Instructions for building a kernel can be found in the FreeBSD Handbook.

options        COMPAT_LINUX

The above option will add Linux-ABI support to your kernel when it is next recompiled.

The listed dependencies below are required to be installed manually in a the proper order. Dependencies that are automatically downloaded are not listed here.

You will need to get the following:

  1. Download bsd-jdk131-patches-9.tar.gz from http://www.eyesbeyond.com/freebsddom/java/jdk13.html and place it under /usr/ports/distfiles.

  2. Next open your web browser and head over to http://java.sun.com/j2se/1.3/download-linux.html and find SDK downloads. Click on the “continue” button below “GNUZIP Tar Shell Script”. Be sure you read every word of the license page before you click on the “Accept” button! You will be brought to a page titled “Download Java(TM) 2 SDK, Standard Edition 1.3.1_10”. Scroll to the bottom and click on the “HTTP download” button. When the “File Download” box comes up, be sure to click on the “Open” button rather than the “Save” button. You will be presented with another “File Download” box - this time choose “Save” and you will be able to get j2sdk-1_3_1_10-linux-i386.bin. Put it in /usr/ports/distfiles.

  3. Go to http://wwws.sun.com/software/communitysource/j2se/java2/download.html. In the table under Download Link(s), for Java 2 SDK 1.3.1, go to the right-hand cell and click “Download”. You will be taken to the “Sign On” page, where you must sign in if you already have an account, or register for access otherwise. Once you have signed in, you will be taken to the “Legal” page, where you must accept the license agreement; scroll down (reading the license) and click on the “Continue” button. The next page is the “Receipt” page. This is where you will save your order number. You will be able to choose the server that is nearest to you. Click on “Java 2 SDK, Standard Edition, version 1.3.1”. Save the j2sdk-1_3_1-src.tar.gz to the /usr/ports/distfiles/ directory.

Note: It is very important for you to read the License Agreement which has been issued by Sun Microsystems Corp. There are several restrictions in place on the use of Java™, which you must address. The FreeBSD Project does not take any responsibility for your actions.

Do not discard any of the downloaded files, as they will be needed for building some of the native ports for FreeBSD, which are discussed later on.

Now that you have assembled all the source files and ports, you need to start by building java/linux-jdk13:

# cd /usr/ports/java/linux-jdk13
# make all install clean

Once you have built java/linux-jdk13, you need to test it, to make sure it works as intended. To do that:

# cd /usr/local/linux-jdk1.3.1/bin
# ./java -version

The output of the above command should be as follows:

java version "1.3.1_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_10-b02)
Classic VM (build 1.3.1_02-b02, green threads, nojit)

If you did not get the correct response, you need to:

# cd /usr/ports/java/linux-jdk13
# make deinstall

And make sure that /usr/local does not contain a linux-jdk1.3.1 directory. If you find a fragment of the directory, delete it. Repeat the build and install process for java/linux-jdk13.

To make the native Java Development Kit 1.3.1 for FreeBSD, do the following:

  1. Make sure you have the j2sdk-1_3_1-src.tar.gz file in /usr/ports/distfiles. This file is needed for applying the “patchset” discussed below.

  2. You will need to download the patchset for building the port. The patchset file is called bsd-jdk131-patches-9.tar.gz. You should verify the integrity of the file by checking its MD5 checksum to make sure your copy is not corrupt.

    md5 bsd-jdk131-patches-9.tar.gz
    
    MD5 (bsd-jdk131-patches-9.tar.gz) = 29c83880d3555abcf74fc7df9db1959f
    

    The patchset is available from: http://www.eyesbeyond.com/freebsddom/java/index.html

The last step above (building the native JDK™) will take some time.

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:38