[1466] in linux-announce channel archive
Java-Linux HOWTO (new!)
daemon@ATHENA.MIT.EDU (Lars Wirzenius)
Tue Dec 12 02:35:47 1995
Date: Tue, 12 Dec 1995 01:25:48 +0200
From: Lars Wirzenius <wirzeniu@cc.helsinki.fi>
To: linux-announce@vger.rutgers.edu
From: dmarks@eagle.ais.net (Daniel Marks)
Subject: Java-Linux HOWTO (new!)
Approved: linux-announce@news.ornl.gov (Lars Wirzenius)
Newsgroups: comp.os.linux.announce
Followup-to: comp.os.linux.misc
Organization: ?
-----BEGIN PGP SIGNED MESSAGE-----
Java Linux Mini HOW-TO by Daniel Marks Sat 2 Dec 1995
(dmarks@ais.net)
- -------------------------------------------------------------
This document acknowledges the following contributors to this
document and/or Java:
Arthur van Hoff (avh@eng.sun.com) - an implementor of Java, and very
patient with questions
Tim Lindholm (lindholm@eng.sun.com) - an implementor of Java,
provided invaluable information for the Linux port
The whole Sun Java team (java@java.sun.com) - for their excellent work
Linus Torvalds (Linus.Torvalds@cs.helsinki.fi) -
creator of Linux, maintainer of Linux kernel
H. J. Lu (hjl@nynexst.com) - architect of libc and ELF support
David Engel (david@ods.com) - creator of ld.so (dynamic
link editor)
Randy Chapman (chapman@u.washington.edu) - porting Java to Linux
and correcting this document
Daniel Barlow (daniel.barlow@sjc.ox.ac.uk) - writer of ELF HOWTO
Karl Asha (karl@blackdown.org) - for most of the Java ALPHA API
net and awt support, as well as providing the Web Site,
mailing list etc., for Java-Linux project
and all of the folks of the Java-Linux mailing list, who scream
loud and clear when something doesn't work.
Table of Contents
I. What is Java?
a. What is Java?
b. What is the Java-Linux project?
c. What software currently supports Java under Linux?
d. What is the difference between Alpha and Beta API Java?
II. How do I get Java?
a. What is required for Java under Linux?
b. Will LessTif work for Java-Linux?
c. Getting Java Development Kit for Linux
d. Getting Netscape 2.0b3 for Linux
III. How do I install Java?
a. Installing BETA API JDK for Linux
Questions and Answers
b . Installing Netscape 2.0b3 for Linux
Questions and Answers
IV. What are the current limitations/bugs in Java-Linux?
V. Where is the Java-Linux port going?
I. What is Java?
a. What is Java?
Java is a new computer language released by Sun MicroSystems,
Inc. It is superficially similar to C++. Java is machine and
platform independent - the same Java "binaries" will run on any
Java-capable runtime system. Java also has built in security- a
program written by an untrusted author is prevented from damaging or
compromising data integrity when executed. Java is also unique in
that it relieves the programmer from many of the burdens of C and C++
dynamic allocation schemes and pointers while still retaining much of
the speed of a compiled language. With built in garbage collections
and no pointers, Java programs don't have dangling pointers or memory
leaks. Java programs are also compiled into a byte-code rather than
native-code, which is interpreted rapidly by the Java Virtual Machine,
achieving most of the speed of native code.
Java was originally intended to be used in interactive TV, but
has recently become popular because it is used to write "Applets"
for the World Wide Web. These applets are Java programs that
run inside the WWW client, and add extra functionality to an otherwise
dead HTML document. Blinking, scrolling text, moving 3-D shapes, and
interactive games have all been written with Java. Because Java
supports common graphics primitives on all architectures, network
support, and file support, it is as capable as any compiled language.
The built-in security also ensures that Applets don't cause any harm
to the host computer.
For more information on Java, follow these URL's
http://java.sun.com - information about Java, programming
language references, etc.
http://www.gamelan.com - example Java Applets
http://www.blackdown.org - mirror of Sun Java pages, and Java-Linux
project home page (hasn't been
updated in awhile)
b. What is the Java-Linux project?
The Java-Linux project's goal is to port Sun's implementation of
the Java Development Kit (BETA API) to Linux. Currently, there is an
initial version of this port available. The browser based on Java,
called HotJava, has only been released for ALPHA API by Sun. HotJava
for BETA API will be ported by the Java-Linux folks after it is released.
To subscribe to the Java-Linux mailing list, send E-mail to
majordomo@substance.blackdown.org
with a message body:
subscribe java-linux
Also, links to archives for most of the major Linux mailing lists
(including linux-gcc and java-linux) can be found at
http://homer.ncm.com. Use this if you're only going to read the
mailing lists, because it doesn't clog up the lists with dead
addresses.
c. What software currently supports Java under Linux?
There are currently two software packages available that can
run Java applications under Linux. Sun's Java Development Kit has
an appletviewer, which can be used to run Applets standalone (outside
of a browser). Also, Netscape 2.0b3 (a BETA version - expires
January 31, 1996) will run Applets inside the browser under Linux.
d. What is the difference between ALPHA and BETA API?
The API of Java is a set of Java classes that interface to the
resources of the computer (graphics, sound, network, etc.) In the
more recent version of the BETA API, these Java classes have been
radically revised, and are incompatible with the ALPHA API. The new
JDK released by the Java-Linux project is BETA API, but the most
recent HotJava released by Sun is ALPHA API. Netscape 2.0b3 supports
BETA API, however. I recommend that anyone new to Java skip right to
the BETA API, and get the new Linux JDK and Netscape 2.0b3, and wait
for the BETA API HotJava to be completed. The only reason to use
ALPHA HotJava is to view the old Alpha legacy Applets.
II. How do I get Java?
a. What is required for Java under Linux?
Linux 1.2.x (x >= 1)
(if using kernel 1.2.x, see patch below in JDK
installation section)
or
Linux 1.3.x (x >= 40)
for Intel architecture (a DEC Alpha port is coming soon,
read below)
ELF ld.so and shared libraries (a MUST)
libc.so.5.2.x (x >= 16)
you can get libc.so.5.2.16 (the last public release
of libc) from ftp://tsx-11.mit.edu/pub/linux/packages/GCC
NOTE: libc.so.5.0.9 is not supported with the JDK port
anymore, and won't work.
ld-linux.so.1.7.x (x = 9) or (x >= 11)
8 MB of RAM (for X) - 16 MB STRONGLY RECOMMENDED
XFree 3.1.1 or 3.1.2
8 bpp (256 color mode) on X server
(16 bpp or 32 bpp don't count - read below)
Daniel Barlow's ELF HOWTO is an excellent guide on upgrading
an existing Linux distribution from a.out to ELF.
b. Will LessTif work for Java-Linux?
No. At the time of this writing, LessTif is still far too
primitive to work for Java-Linux. However, I'm sure they're
working on it. If you download the statically linked JDK,
it will take more time to load, but does not require the
shared Motif libraries.
c. Getting Java Development Kit for Linux
The JDK for Linux is available at:
If you have ELF shared Motif 2.0 libraries then get:
ftp://www.blackdown.org/pub/Java/linux.jdk.pre2.tar.gz
Otherwise get:
ftp://www.blackdown.org/pub/Java/linux.jdk.pre2.static-motif.tar.gz
In addition, if you do not have the versions of ld.so mentioned
above, a version of it can be found at ftp.ods.com.
CAUTION: Installing new versions of libc and ld.so can render
your Linux machine unable to operate unless you follow the
directions with those packages carefully. Please have a Linux
boot disk ready!
d. Getting Netscape 2.0b3 for Linux
Netscape 2.0b3 for Linux is available from:
ftp://ftp7.netscape.com/2.0b3/unix/
netscape-v20b3-export.i486-unknown-linux.tar.Z
All of the Netscape FTP sites (ftp.netscape.com,
ftp2.netscape.com, etc.) have Netscape 2.0b3, and
there are many mirror sites also.
III. How do I install Java?
a. Installing BETA API JDK for Linux
Throughout these instructions, I will assume that the
JDK will be installed in a directory called /usr/local/java.
(I am not sure if this is FSSTND compliant.) If you wish to
install it somewhere else, change /usr/local/java. You must
also be "root" to install this package.
Step A: Untar the appropriate archive, linux.jdk.pre2.tar.gz or
linux.jdk.pre2.static-motif.tar.gz in the directory tree
of /usr/local. The Linux JDK untars into a directory called
"java," so the directory for the JDK will be /usr/local/java.
The following commands untar the package:
cd /usr/local
tar xvvvfz linux.jdk.pre2.tar.gz
(or linux.jdk.pre2.static-motif.tar.gz)
Step B: Edit the files /usr/local/java/bin/appletviewer:
1. Edit the top line to be "#!/bin/sh"
2. After these lines:
#
# Determine JAVA_HOME
#
add:
JAVA_HOME="/usr/local/java"
and edit the file /usr/local/java/bin/.java_wrapper
1. Edit the top line to be "#!/bin/sh"
2. Put a "#" before the following two lines
PRG=`whence $0` >/dev/null 2>&1
J_HOME=`dirname $PRG`/..
and add after the J_HOME line:
J_HOME="/usr/local/java"
This fixes all the paths (the scripts work correctly on Solaris,
but not on Linux).
Step E: Now it should be ready to go. To test the appletviewer, try
this:
1. cd /usr/local/java/demo/Blink
2. /usr/local/java/bin/appletviewer example1.html
Common problems:
Q: JDK immediately prints "Segmentation Violation" when running
appletviewer or javac.
You are using an old version of ld.so. Upgrade to an ld.so
version mentioned above (version 1.7.11 is preferred
currently).
Q: JDK complains about not being able to find "libXm.so.2" library
A: You used the shared Motif JDK when you should have used the static
Motif JDK. Install the static version of JDK.
Q: JDK complains about not being able to find a symbol:
"__libc_malloc".
A: You are using libc.so.5.0.9, which is not supported by
Java-Linux JDK. Upgrade to libc.so.5.2.16. See instructions
above.
Q: JDK complains about not being able to find
"/usr/local/java/bin/i586/java"
A: You did not create the links needed in Step C. The JDK
was originally compiled on a Pentium, but if you do not
have a Pentium, you need to create these links to
provide a path to the binaries.
Alternately: you did not make the changes correctly to
the two scripts above. JAVA_HOME="/usr/local/java"
in the appletviewer script, and J_HOME="/usr/local/java"
in the .java_wrapper script.
Q: JDK complains about not being able to find one of:
libawt.so, libagent.so, libdatagram.so, libjpeg.so,
libmmedia.so.
A: These files are either missing from /usr/local/java/lib/i586,
or the links were not created correctly between
/usr/local/java/lib/`arch` and /usr/local/java/lib/i586.
Make a symlink between these two directories (filling in `arch`
with the actual results of the command "arch").
Also, if you have installed JDK ALPHA, you may also have
old libraries in your path. Remove the path from
/etc/ld.so.conf, and rerun /sbin/ldconfig.
If the JDK does not find a library "libXm.so.2," you
need to install the static-motif version of JDK rather
than the shared one.
Q: JDK complains that there is no /dev/zero.
A: Create a /dev/zero with this command (as root):
mknod /dev/zero c 1 5
chown root.sys /dev/zero
chmod a+rw /dev/zero
A: There is a problem with mmap.c under kernel 1.2.13.
Here's the fix:
*** mmap.c.save Tue Nov 28 23:23:03 1995
- --- mmap.c Tue Nov 28 23:23:21 1995
***************
*** 199,204 ****
- --- 199,205 ----
if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
return -EBADF;
}
+ flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
return do_mmap(file, get_fs_long(buffer), get_fs_long(buffer+1),
get_fs_long(buffer+2), flags, get_fs_long(buffer+5));
}
Q: I am using my fancy whizbang video card with XFree 3.1.x, and
when I run Appletviewer the graphics are all screwy.
A: The Linux JDK port only support 8 bpp modes (256 color). I
do not know why this is (I think there's assumptions in
bytes/pixel in the code). You must create a 8 bpp mode
in your XF86Config file and use it when running Java (currently).
b . Installing Netscape 2.0b3 for Linux
The Netscape 2.0b3 distribution must be installed in
"/usr/local/netscape" (well, it doesn't, but you will save yourself
a lot of headaches if you follow my directions). Warning,
doing this will sabotage any global Netscape X-defaults you
may have (but not your bookmarks). Do this:
mkdir /usr/local/netscape
cd /usr/local/netscape
tar xvvvvfz netscape-v20b3-export.i486-unknown-linux.tar.Z
cp Netscape.ad /usr/X386/lib/X11/app-defaults/Netscape
cp XKeysymDB /usr/X386/lib/X11
cp -r nls /usr/X386/lib/X11/nls
mkdir -p /usr/local/netscape/java/classes
ln -s /usr/local/netscape/moz2_0.car /usr/local/netscape/java/classes
You also may need to create one or more of the following links:
ln -s /var/X11R6/lib /usr/X386/lib/X11
Note: depending your your distribution, you may have to use the
path "/var/X11R6/lib/" instead of "/usr/X386/lib/X11." However,
Netscape expects to find the files in /usr/X386/lib/X11, so
you must at least have a link between them.
And then Netscape 2.0 will be all ready to go. Run Netscape 2.0
with /usr/local/netscape/netscape.
Common problems:
Q: When I run Netscape 2.0, it complains about not having any
of the correct X resources.
A: Make sure the Netscape.ad files is moved to
/usr/X386/lib/X11/app-defaults. Netscape 2.0 will not
run with the Netscape 1.x defaults file.
Q: Whenever I try to paste into the Netscape window, Netscape
crashes.
A: Make sure the nls directory that comes with Netscape is
moved to /usr/X386/lib/X11, and the XKeysymDB files in
in /usr/X386/lib/X11/XKeysymDB. This is a bug in the
X11R5 libraries Netscape is linked with.
Q: Whenever I try to run a Java Applet, Netscape crashes.
A: Make sure the file /usr/local/netscape/java/classes/moz2_0.car
is a link to or is the moz2_0.car file that is in the
Netscape 2.0 package.
Q: I am having problems with /dev/zero, mmap, with kernel
1.2.13, etc. etc.
A: See the same question under the JDK Q&A.
IV. What are the current limitations/bugs in Java-Linux?
UDP Datagram support is broken in JDK pre1.
Netscape 2.0b3 tends to crash inexplicably after running
Java applets for 5-10 minutes.
... i'm sure there's more ...
V. Where is the Java-Linux port going?
The Java-Linux project is pushing to have the Linux patches
included in Sun's Java ports tree. Also, they are lobbying to
get Borland to support Linux for their Java products.
The Java-Linux project is patiently waiting for HotJava
for the Beta API.
The Java-Linux mailing list wants to hear your bug reports
and see your patches.
Randy Chapman has been given access to a Linux Alpha machine
and is working on a port of Linux JDK for Alpha architecture.
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i
iQCVAwUBMMy5VYQRll5MupLRAQEBlQP/XqezxNSd0sLf0C1vigj/DZcCmy9p51QZ
BsGBLJtwkKuLudIZ1wcjKJdNdKqmQ1Arotnj4kJDst/wfIrJM+sYomuExtoTNmLy
+GNp8i2EzPLmF2hG9ct3oSEsCYlSG8ukn4527PQ7jifWTpuXvrydSwSrzswKGSMS
IYZKPWWv2lE=
=a3m8
-----END PGP SIGNATURE-----
--
This article has been digitally signed by the moderator, using PGP.
Finger wirzeniu@kruuna.helsinki.fi for PGP key needed for validating signature.
Send submissions for comp.os.linux.announce to: linux-announce@news.ornl.gov
PLEASE remember a short description of the software and the LOCATION.