Difference between revisions of "JDK"

From CBLFS
Jump to navigationJump to search
(Created page.)
 
Line 21: Line 21:
 
It appears that this link MUST REMAIN after installing the Java binaries.  Removing it and attempting to execute any of the Java programs results in "No such file or directory."
 
It appears that this link MUST REMAIN after installing the Java binaries.  Removing it and attempting to execute any of the Java programs results in "No such file or directory."
  
Create the link.
+
If you have a '''Pure64''' system create a link so the path to ld.so is correct:
  
 
   mkdir -v /lib64 &&
 
   mkdir -v /lib64 &&
Line 56: Line 56:
 
   ln -v -nsf jdk-precompiled-1.5.0_10 /opt/jdk/jdk
 
   ln -v -nsf jdk-precompiled-1.5.0_10 /opt/jdk/jdk
  
Add a shell startup file to the /etc/profile.d directory with the following commands as the "root" user:
+
Create an addition to the [[Bash Startup Files]] with the following command:
  
  cat > /etc/profile.d/jdk.sh << "EOF"
+
cat > /etc/profile.d/30-jdk.sh << "EOF"
  # Begin /etc/profile.d/jdk.sh
+
# Begin /etc/profile.d/30-jdk.sh
 
+
  # Set JAVA_HOME directory
+
# Set JAVA_HOME directory
  JAVA_HOME=/opt/jdk/jdk
+
JAVA_HOME=/opt/jdk/jdk
  export JAVA_HOME
+
export JAVA_HOME
 
+
  # Adjust PATH
+
# Adjust PATH
  pathappend ${JAVA_HOME}/bin PATH
+
export PATH="${PATH}:${JAVA_HOME}/bin"
 
+
  # Auto Java Classpath Updating
+
# Auto Java Classpath Updating
  # Create symlinks to this directory for auto classpath setting
+
# Create symlinks to this directory for auto classpath setting
  AUTO_CLASSPATH_DIR=/usr/lib/classpath
+
AUTO_CLASSPATH_DIR=/usr/lib/classpath
  if [ -z ${CLASSPATH} ]; then
+
if [ -z ${CLASSPATH} ]; then
    CLASSPATH=.:${AUTO_CLASSPATH_DIR}
+
  CLASSPATH=.:${AUTO_CLASSPATH_DIR}
  else
+
else
    CLASSPATH="${CLASSPATH}:.:${AUTO_CLASSPATH_DIR}"
+
  CLASSPATH="${CLASSPATH}:.:${AUTO_CLASSPATH_DIR}"
  fi
+
fi
 
+
  # Check for empty AUTO_CLASSPATH_DIR
+
# Check for empty AUTO_CLASSPATH_DIR
  ls ${AUTO_CLASSPATH_DIR}/*.jar &> /dev/null &&
+
ls ${AUTO_CLASSPATH_DIR}/*.jar &> /dev/null &&
  for i in ${AUTO_CLASSPATH_DIR}/*.jar
+
for i in ${AUTO_CLASSPATH_DIR}/*.jar
    do CLASSPATH=${CLASSPATH}:"${i}"
+
  do CLASSPATH=${CLASSPATH}:"${i}"
  done
+
done
  export CLASSPATH
+
export CLASSPATH
 
+
  # End /etc/profile.d/jdk.sh
+
# End /etc/profile.d/30-jdk.sh
  EOF
+
EOF

Revision as of 13:52, 1 December 2006

Binary Download: http://java.sun.com/j2se/1.5.0/download.jsp (to download jdk-1_5_0_10-linux-amd64.bin)

The following installation instructions only cover the installation of the 64-bit precompiled binaries. If you want or need plugins, you must install the 32-bit version on a pure 32-bit or multilib system.

Dependencies

No packages, but read note below in non-multilib section.

Non-Multilib

Precompiled Binaries

NOTE: The JDK binary installation script for 64-bit systems has the dynamic linker path hard-coded at /lib64/ld-linux-x86-64.so.2. If installing on a pure 64-bit system the dynamic linker will be installed in /lib. Changing this path manually or with a sed in the *.bin corrupts the *.bin and the install will fail. It is necessary to create a /lib64 directory and a symlink to /lib/ld-2.4.so before attempting to unpack and install the Java binary.

It appears that this link MUST REMAIN after installing the Java binaries. Removing it and attempting to execute any of the Java programs results in "No such file or directory."

If you have a Pure64 system create a link so the path to ld.so is correct:

 mkdir -v /lib64 &&
 ln -sv /lib/ld-2.4.so /lib64/ld-linux-x86-64.so.2

To install the JDK binary you will be required to accept the license agreement. Unpack the JDK binary.

 cp -v jdk-1_5_0_10-linux-amd64.bin jdk-mod.bin &&
 chmod +x jdk-mod.bin &&
 ./jdk-mod.bin

As the root user, install the precompiled binaries.

 cd jdk1.5.0_10 &&
 install -v -d /opt/jdk/jdk-precompiled-1.5.0_10 &&
 mv -v * /opt/jdk/jdk-precompiled-1.5.0_10 &&
 chown -v -R root:root /opt/jdk/jdk-precompiled-1.5.0_10 &&
 ln -v -sf motif21/libmawt.so \
    /opt/jdk/jdk-precompiled-1.5.0_10/jre/lib/amd64/ &&
 cd ..

Source Build

TO DO. Need smart guy for this.

Multilib

TO DO. Need smart guy for this.

Configuration

Create a link to the directory of the Java you wish to use (precompiled or built from source).

 ln -v -nsf jdk-precompiled-1.5.0_10 /opt/jdk/jdk

Create an addition to the Bash Startup Files with the following command:

cat > /etc/profile.d/30-jdk.sh << "EOF"
# Begin /etc/profile.d/30-jdk.sh

# Set JAVA_HOME directory
JAVA_HOME=/opt/jdk/jdk
export JAVA_HOME

# Adjust PATH
export PATH="${PATH}:${JAVA_HOME}/bin"

# Auto Java Classpath Updating
# Create symlinks to this directory for auto classpath setting
AUTO_CLASSPATH_DIR=/usr/lib/classpath
if [ -z ${CLASSPATH} ]; then
  CLASSPATH=.:${AUTO_CLASSPATH_DIR}
else
  CLASSPATH="${CLASSPATH}:.:${AUTO_CLASSPATH_DIR}"
fi

# Check for empty AUTO_CLASSPATH_DIR
ls ${AUTO_CLASSPATH_DIR}/*.jar &> /dev/null &&
for i in ${AUTO_CLASSPATH_DIR}/*.jar
  do CLASSPATH=${CLASSPATH}:"${i}"
done
export CLASSPATH

# End /etc/profile.d/30-jdk.sh
EOF