pavement

Java

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
m
m (note on installing older Java from pkg and also details on compiling.)
Line 1: Line 1:
 +
To install Java, you must compile it or install a prebuilt package. Currently there are no pre-built packages for the FreeBSD 5.x tree, although you can use the older Java 1.3.1 packages for FreeBSD 4.8 (and later,) tree. These are older packages (the latest Java is 1.4.2 (although 1.5 is just around the corner, widespread use of this recent release is not yet common).
 +
 +
If you're using FreeBSD 4.x, and you don't mind using an older Java, check out the [http://www.freebsdfoundation.org/downloads/java-errata.shtml FreeBSD Foundation's Java pre-built binaries]. They're .tbz's and you'll want to install them with [[pkg_add]].
 +
 +
If you want to use a newer Java, or if you're running the 5.x releases instead of the 4.x tree, you'll need to compile and install your own Java VM.
 +
 
Installing Java 1.4.2 SDK, the quick and dirty way.
 
Installing Java 1.4.2 SDK, the quick and dirty way.
  
Line 17: Line 23:
 
  j2sdk-1_4_2_06-linux-i586.bin from [http://java.sun.com/j2se/1.4.2/download.html Sun's j2se JDK page]
 
  j2sdk-1_4_2_06-linux-i586.bin from [http://java.sun.com/j2se/1.4.2/download.html Sun's j2se JDK page]
  
4. to enable linux compatibility -- you can do this via [[sysinstall]]  
+
4. to enable linux compatibility -- you can do this via [[sysinstall]] if you didn't do it on your initial install.
  
 
5. add the following line to your [[ /etc/fstab]]:
 
5. add the following line to your [[ /etc/fstab]]:
Line 33: Line 39:
 
9. and install it:
 
9. and install it:
 
  samizdata# make install
 
  samizdata# make install
 +
 +
 +
Note that you don't want to ''make install clean'' because if something fails at some point during the install, the ''clean'' will wipe out your work files. Just run ''make install'' and when it's done, clean up with a ''make clean && make distclean'' after it's installed. Don't forget to use [[rehash]] after the install, and you can test to see that it's installed and working by running a ''java -version''.
 +
  
 
See http://taosecurity.blogspot.com/2004/11/installing-java-on-freebsd-in-january.html for a similar method of doing this.
 
See http://taosecurity.blogspot.com/2004/11/installing-java-on-freebsd-in-january.html for a similar method of doing this.

Revision as of 19:32, 8 January 2005

To install Java, you must compile it or install a prebuilt package. Currently there are no pre-built packages for the FreeBSD 5.x tree, although you can use the older Java 1.3.1 packages for FreeBSD 4.8 (and later,) tree. These are older packages (the latest Java is 1.4.2 (although 1.5 is just around the corner, widespread use of this recent release is not yet common).

If you're using FreeBSD 4.x, and you don't mind using an older Java, check out the FreeBSD Foundation's Java pre-built binaries. They're .tbz's and you'll want to install them with pkg_add.

If you want to use a newer Java, or if you're running the 5.x releases instead of the 4.x tree, you'll need to compile and install your own Java VM.

Installing Java 1.4.2 SDK, the quick and dirty way.

NOTE THAT THERE ARE LICENSING ISSUES WITH JAVA TECHNOLOGIES FROM SUN.COM AND FreeBSD -- IT IS YOUR RESPONSIBILITY TO RECONSILE THESE AS THEY PERTAIN TO YOUR USE OF JAVA

You will need:

1. about 2 gigs free disk space. Check that you have this by running df

2. to update your ports tree -- see cvsup and Update_the_ports_tree

3 to download the following files:

bsd-jdk14-patches-6.tar.gz from Eyesbeyond.com
j2re-1_4_2_06-linux-i586.bin from Sun's j2se JRE page
j2sdk-1_4_2-bin-scsl.zip from This page at sun.com
j2sdk-1_4_2-mozilla_headers-unix.zip from This page at sun.com
j2sdk-1_4_2-src-scsl.zip from This page at sun.com
j2sdk-1_4_2_06-linux-i586.bin from Sun's j2se JDK page

4. to enable linux compatibility -- you can do this via sysinstall if you didn't do it on your initial install.

5. add the following line to your /etc/fstab:

linprocfs   /compat/linux/proc   linprocfs   rw   0  0

6. to run linprocfs -- you may need to do this:

kldload linprocfs
mount /compat/linux/proc

7. place the files you downloaded in the third step in /usr/ports/distfiles

8. go into the jdk14 dir:

samizdata# cd /usr/ports/java/jdk14

9. and install it:

samizdata# make install


Note that you don't want to make install clean because if something fails at some point during the install, the clean will wipe out your work files. Just run make install and when it's done, clean up with a make clean && make distclean after it's installed. Don't forget to use rehash after the install, and you can test to see that it's installed and working by running a java -version.


See http://taosecurity.blogspot.com/2004/11/installing-java-on-freebsd-in-january.html for a similar method of doing this.

See also the discussion at Talk:Java

Personal tools