Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA09925; Fri, 8 Dec 95 18:02:33 EST
Received: from liquor.cabi.net by MIT.EDU with SMTP
	id AA04924; Fri, 8 Dec 95 18:01:27 EST
Received: (from listadm@localhost) by liquor.cabi.net (8.6.12/8.6.12) id PAA01315; Fri, 8 Dec 1995 15:12:48 -0500
Resent-Date: Fri, 8 Dec 1995 15:12:48 -0500
From: "Eric S. Raymond" <esr@locke.ccil.org>
Message-Id: <199512082022.PAA03587@locke.ccil.org>
Subject: Java on Linux HOWTO, version 0.2
To: java-linux@java.blackdown.org, joey@sun.science.wayne.edu
Date: Fri, 8 Dec 1995 15:22:25 -0500 (EST)
X-Mailer: ELM [version 2.4 PL24]
Content-Type: text
Content-Length:      19034
Resent-Message-Id: <"vyg6B2.0.AK._l9om"@liquor>
Resent-From: java-linux@java.blackdown.org
X-Mailing-List: <java-linux@java.blackdown.org> archive/latest/677
X-Loop: java-linux@java.blackdown.org
Precedence: list
Resent-Sender: java-linux-request@java.blackdown.org

This is the second draft of the proposed Java-on-Linux HOWTO, incorporating
feedback from list members and the rumored but unpublished Red Hat mini-HOWTO
by Steve Greene.

I've been informed of Joey Oravec <joey@sun.science.wayne.edu>'s web page, and
skimmed it myself.  It appears to be a bit behind the curve, referring to the
alpha stuff, but to have some data I don't.

Joey: Shall we merge our efforts?  I'm willing to do the work to maintain a
merged version as an official LDP HOWTO, index it properly, and so forth.  

Steve: Please take a careful look at what I've edited in from your mini-HOWTO 
and send me any corrections you think useful.

Thanks for the helpful and extremely rapid feedback on 0.1.
------------------------------------------ CUT HERE --------------------------
<!-- This is the Java on Linux HOWTO, SGML source -- >
<!-- Eric S. Raymond, esr@snark.thyrsus.com -- >
<!-- The submission address is gregh@cc.gatech.edu -- >

<!doctype linuxdoc system>

<article>

<title>Java on Linux HOWTO
<author>maintained by Eric S. Raymond,
<htmlurl url="mailto:esr@snark.thyrsus.com" name="<esr@snark.thyrsus.com>"> 
<date>v.0.2, 8 Dec 1995

<abstract>
This document describes how to get started with Java and HotJava under
Linux, as either a user or a programmer.
</abstract>

<toc>

<sect> Unanswered Questions:
<p>
If you understand these issues, please contribute.

<itemize>
	<item> What are the ICE and SM libraries needed to link Andy
		Chapman's Java implementation?
	<item> What parts of the implementation are FRS?  What parts aren't?
	<item> Are there any FRS Java tools?
	<item> Where can one find FRS libraries of Java code?
</itemize>
</sect

<sect>Introduction
<p>
This document is a Linux-centric introduction to the world of Java and
HotJava.  These technologies are rapidly evolving, and we welcome
contributions from anywhere.
<p>
Note: There is an older FAQ-style document by 
<url url="mailto:joey@sun.science.wayne.edu" name="joey@sun.science.wayne.edu">
which primarily refers to the alpha document.  You can find it at
<url url="http://www.science.wayne.edu/~joey/java/linux.html">.  At some
point these documents may merge.
<p>
Places in this document that are in serious need of filling out are
bracketed with *** ***.  Please help us improve it.
</sect>

<sect> General Questions about Java and HotJava
<p>
This section is a general (non-Linux-specific) introduction to Java and 
HotJava.

<sect1> What are are Java and HotJava and why are they interesting?
<p>
Java is a network-aware language superficially resembling C++, but
much smaller and more compact and cleanly designed.  It's an
unlimited-extent language with garbage collection like Lisp, but with
strong type checking.  It includes lightweight processes (threads) as
a native facility and has powerful network-security features.  So far,
its major application is the HotJava browser.
<p>
HotJava is a WWW browser written in Java.  Its major advance over
other browsers is that it knows about a new HTML construct called an
APP, which is some Java class that executes on the client machine.
Thus, WWW documents written with Java in mind can have "live" code
objects embedded in them, as opposed to just data.
<p>
The ability to safely pass around code objects probably represents the most
significant advance in WWW technology since the first release of Mosaic.
At minimum, it delivers an extensible Web browser that won't need
perpetual upgrading to handle new image formats and tag types.
</sect1>

<sect1> Where do Java and HotJava come from?  Who can use them?
<p>
Java and HotJava were developed at Sun Microsystems by a team headed 
by James Gosling (well known as the designer of Gosling Emacs and
NeWS).
<p>
The last time Sun tried to set a major technical standard was NeWS,
its Network Window System.  Though NeWS was pretty universally
conceded to be technically superior to X, X won because its sources
were freely redistributable.  Sun learned from this mistake, and has
made Java/HotJava much more generally available; the sources can be
downloaded under a fairly relaxed license (see below).  Sun is
encouraging ports to non-Sun environments.
<p>
Netscape now interprets Java.  Microsoft licensed the technology in
early December 1995.  So it appears that Java support will probably
become universal in 1996.
<p>
Java used to be called Oak.  HotJava was once known as WebRunner.
</sect1>

<sect1> How mature is Java?
<p>
Java is currently (December 1995) in late beta.  The Java environment
API defining its access to the host OS and windowing system has
allegedly been frozen.
<p>
Significant holes are known to exist in the Java security
implementation.  It is not yet a good idea to use Java for sensitive
applications.  These problems are expected to be fixed in the production
(post-beta) releases.
</sect1>

<sect1> Where can I find documentation on Java and HotJava?
<p>
Sun maintains an extensive HTML web of Java and HotJava-related
documents at <url url="http://java.sun.com">.  These documents are 
mirrored at <url url="http://java.blackdown.com"> and elsewhere; see
Sun's list of mirror sites.
</sect1>

<sect1>Yes, but where can I find paper documentation?
<p>
SunSoft Press's official series of Java books is in the production pipeline at
Addison-Wesley.
<p>
O'Reilly Associates is working on its own series of Java books in
cooperation with Sun.
<p>
One of our contributors, browsing his local Bookstop/Barnes &
Noble/Borders, came up with 3 books already out:
<itemize>
	<item>One called 'Java in 60 minutes' that looked like a pretty
		strict syntactic description (about $20).
	<item>One from SamsNet called just `Java' (about $20).
	<item>One by Tim Ritchey called `Java!' that includes a
		CD-ROM (about $35).
</itemize>
Our informant continues: "I bought the 3rd one (by Tim Ritchey). Paper
leadtimes being what they are, the CD-ROM only has alpha stuff, though it
mentions that the beta version might be out by the time you read it and
suggests java.sun.com as a place to get more recent information.  Other
than that, it's pretty good, even to pointing out that `well, it's
pointless for me to spam you with pages and pages of API descriptions
because 1) it would quadruple the size of the book and 20 they're still ch
anging and 2) you can get that info online at ...etc'"
</sect1>

<sect1> Where can I find on-line collections of Java code?
<p>
*** We need some of these, especially FRS code ***
</sect1>
</sect>

<sect> Java as Freely Redistributable Software
<p>
Many Linux programmers are attached to producing freely redistributable 
software (FRS), and try to avoid committing a lot of time to tools for
which sources are not generally available.  In this section, we discuss
Sun's and Java's relationship with the FRS world.

<sect1> Are Java programs and applets freely redistributable?
<p>
They are if you write them and choose to make them FRS through some
mechanism (such as the GPL, or a BSD-style license, or declaring them
public domain).

<sect1> Which parts of the Java sources are freely redistributable?
<p>
***Would someone who understands the license terms please write this?***
</sect1>

<sect1> Is anyone cloning the parts that aren't freely redistributable?
<p>
Not that we know of, yet.  However, the specifications and architecture
description for Java will be public, so if Java becomes as popular as we
expect, it will be cloned.

<sect1> What is Sun's attitude towards FRS Java implementations and tools?
<p>
Sun people use the term "rogue port" for Java implementations that don't
rely on Sun-licensed code.  They seem to think some of these already exist,
but we don't know where they are, nor if they are FRS.
<p>
Sun has a Java validation suite.  They have said they'll certify any Java
port that passes it.  (Whether this validation will cost money is unknown.)
They're prepared to certify rogue ports, though this apparently hasn't
happened yet.
</sect1>
</sect>

<sect> Java On Linux Questions
<p>
Here you can learn the nuts and bolts of getting Java running on your Linux.

<sect1> Are Java and HotJava included in any of the Linux distributions?
<p>
No, not yet, but expect it any week now.
</sect1>

<sect1> How can I get the latest Java distribution for Linux?
<p>
Look in <url url="ftp://java.blackdown.org/pub/Java">.  The latest
Java-for-Linux can be downloaded from there.  You should browse
the <url url="ftp://java.blackdown.org/pub/Java/README"> first.
<p>
This port (from the Sun sources by Andy Chapman) is the one we refer to
elsewhere in this HOWTO.
</sect1>

<sect1> What environment will I need to run Java?
<p>
For starters, you need an ELF-based Linux.  There is no a.out support,
and at the speed the Linux world is switching over to ELF there is not
likely to be any in the future.
<p>
Note that the README on blackdown has aged a bit.  In reality, you'll need
these pieces:

<itemize>
	<item>libc.so.5 => /lib/libc.so.5.2.16 &nl
		(The standard C library)

	<item>libX11.so.6 => /usr/X11/lib/libX11.so.6.0 &nl
		(The base X11R6 library)

	<item>libXt.so.6 => /usr/X11/lib/libXt.so.6.0 &nl
		(The Athena toolkit library)

	<item>libXext.so.6 => /usr/X11/lib/libXext.so.6.0 &nl
		(The X extensions library)

	<item>libXpm.so.4 => /usr/X11/lib/libXpm.so.4.3  &nl
		(The X library for pixmap handling.)

	<item>libdl.so.1 => /lib/libdl.so.1.7.9 &nl
		***What is this, some dynamic-loader library?***

        <item>libICE.so.6 => /usr/X11/lib/libICE.so.6.0 &nl
		***Tell me this isn't Intrusion Countermeasure Electronics...***
	<item>libSM.so.6 => /usr/X11/lib/libSM.so.6.0 &nl
		***Java does bondage?***
</itemize>
The C and X support libraries may be in your Linux already.  The
dl, ICE, and SM libraries probably are not.
<p>
If you don't already have it, get libc.5.2.16.bin.tar.gz from
<url url="ftp://tsx-11.mit.edu/pub/linux/packages/GCC/">.
Uncompress and untar and copy the files in the lib subdirectory
of the top level of the hierarchy to /lib.
<p>
If you don't have a current version of ld.so (or libdl.so.1.7.*) you
will need to update. ld.so.1.7.9 and .11 will work; .10 and other early
versions will not. Get ld-so.1.7.11.tar.gz from
<url url="ftp://ftp.ods.com/linux/">;
Uncompress and untar it and run <em/instldso.sh/ which is
in the top level of the resulting hierarchy.
<p>
***Where can we got the ICE and SM libraries?***
</sect1>

<sect1> Do I need Netscape?  Can I use Netscape?
<p>
You don't need Netscape.  If you can run Java, you can build the HotJava
browser.
<p>
As of December 1995 only Netscape 2.0b3 is Java-aware.
It is available at ftp[1-7].netscape.com (i.e. at ftp1.netscape.com,
ftp2.netscape.com,... etc.)  The file to get is 
/2.0b3/unix/netscape-v20b3-export.i486-unknown-linux.tar.Z.
<p>
Note that Netscape 2.0b3 will run on an a.out system, so it is, in theory,
possible to write your java app, give it to someone else to compile (like
maybe the <url url="http://mars.blackstar.com" name="BlackStar Public
Compiler">), and see the output on your system.  If you want more than
that, get an ELF system.
</sect1>

<sect1> What mailing lists or newsgroups exist for supporting Java on Linux?
<p>
<itemize>
<item><em/java-linux/ (Maintained by karl@blackdown.org)
        Discussions and developments concerning the port of Java to the
        Linux operating system. Email to
	<htmlurl url="mailto:java-linux-request@java.blackdown.org"
		name="java-linux-request@java.blackdown.org">
	with the word `subscribe' in the subject to be added to the list.
<item><em/java-linux-announce/ (Maintained by karl@blackdown.org)             
	Moderated list for announcements concerning the Java-Linux           
	porting projects. Please send e-mail to
	<htmlurl url="mailto:java-linux-announce-request@java.blackdown.org"
		name="java-linux-announce-request@java.blackdown.org">
	with the word subscribe in the subject, to be added to the list.
<item><htmlurl url="news:comp.lang.java" name="comp.lang.java">
	Newsgroup for general Java discussion.
<item><htmlurl url="news:alt.www.hotjava" name="alt.www.hotjava">
	Newsgroup for discussion of the HotJava browser.
</itemize>
</sect1>
</sect>

<sect> Building the Linux Java port on stock Linuxes
<p>
In this section, we collect recipes sent to us for building Andy Chapman's
Java port on various current Linux distributions:

<sect1> Slackware distribution ELF kernel 1.2.13.
<p>
John Franks &lt;john@math.nwu.edu&gt; writes that he succeeded with the
following steps: 

<itemize>
	<item>Get linux-x86.jdk.pre2.static-motif.tar.gz  from 
		ftp://www.blackdown.org/pub/Java/linux/
		and uncompress it and untar it.

	<item>Get libc.5.2.16.bin.tar.gz  from
		ftp://tsx-11.mit.edu/pub/linux/packages/GCC/
		Uncompress and untar and copy the files in the lib subdirectory
		of the top level of the hierarchy to /lib.

	<item>Get ld-so.1.7.11.tar.gz from ftp://ftp.ods.com/linux/
		Uncompress and untar it and run "instldso.sh" which is
		in the top level of the resulting hierarchy.
</itemize>
You should now be able to compile and try the "hello world" program
and applet from Sun following the instructions at <url
url="http://java.sun.com/progGuide/index.html">.
</sect1>

<sect1> RedHat 2.x/Caldera Preview 2
<p>
Steve Greene &lt;sgreene@dcc12513.slip.digex.net&gt; reports success doing
the following steps.  I have edited the recipe slightly, so blame any
mistakes on me.  The `JDK' he refers to is the Chapman port.

<itemize>
	<item>From ftp.ods.com, get the rpm available for ld.so.1.7.11.  
		Check any RedHat mirror site for:

		/pub/mirrors/redhat-2.1/updates/RPMS/ld.so-1.7.11-i386.rpm

		I know it is available at ftp.pht.com, ftp.caldera.com. and is 
		probably at the other RedHat mirrors as well.  Grab it, and
		do `rpm -ivh ld.so-1.7.11-1.i386.rpm' on your system.

	<item> Get the tar file for the statically-linked pre2 JDK.
		Untar it from a convenient point.  I put mine in 
		/usr/local, so the untar creates /usr/local/java/....

	<item> Edit bin/.java_wrapper (file names/paths assume you are at
		the top of the java directory tree you created in the last
		step); change "/usr/bin/ksh" to "/bin/sh", change "whence"
		to "which".

	<item> So you can run java as someone other than root (this is a
		good idea!), do `chmod 666 /dev/zero'. 

	<item> I think bin/.java_wrapper establishes the correct environment 
		values for LD_LIBRARY_PATH and CLASS_PATH, but you can do
		this by hand as well:

		LD_LIBRARY_PATH=/usr/local/java/lib  (or wherever you put it)
		CLASS_PATH=/usr/local/java/classes  (or wherever you put it)
		export $LD_LIBRARY_PATH
		export $CLASS_PATH

	<item> If you haven't already, run ldconfig as root to load the new 
		libraries.  If you do "ldconfig -v"  you can verify you have 
		all the libraries loaded.  (At least we don't have to build
		an ELF system first!)

	<item> Make sure you're logged in as a user (e.g. non-root).  Start X-
		windows, open an X-Term, and try something!
</itemize>

Steve adds: If I understand the on-line notes correctly, bin/java is a script 
that calls the run-time Java interpreter (used to run Java 
applications), bin/javac is a script for the Java compiler for 
compiling applications and applets, and  bin/appletviewer is a 
script that allows you to look at an exisiting (compiled) applet.

A number of demonstration applets are in the demo directory.  The 
applet viewer requires a file name (and would probably work with a 
URL if you're connected to the Internet, I need to try this myself).

I haven't figured out the correct syntax to run bin/appletviewer 
directly, but I figured out an alternative by examining the script 
file.  To run a demo, I enter this command from the top of my Java 
directory tree, /usr/local/java on my system):

     bin/java sun.applet.AppletViewer demo/&lt;directory_name&gt;/exampleN.html

where &lt;directory name&gt; is the subdirectory off demo, and N is the 
number of the example file (some directories have more than 1).

The first time you run Java, a license screen (which reminds me of 
Netscape's) is displayed.

I've started the tutorials available from Sun's java site and the similar one
put out by the NTMUG.  I've discovered some problems with the syntax in Sun's 
tutorial, so I've been following the NYMUG tutorial instead for now.

I've been having problems with the 'dirname' call in the .java_wrapper
script.  I went ahead and "hard coded" the full pathname to the top of my
java directory tree into the script, and the problem appears solved (e.g. I
can now run bin/javac &lt;source file.java&gt; and bin/java
&lt;class_file_name&gt; successfully).

I haven't figured out how to run any of the demo applets on my system using
Netscape 2.0b3 - since I'm getting class file not found errors, I probably need
to move the class files around first or change one of Netscape's setting to
look in /usr/local/java/class as well.
</sect1>
</sect>

<sect> Notes on Known Problems
<p>
Steve Greene tells us: These are problems I ran into and how I fixed them
(e.g., this is my "Been There, Done That" troubleshooting list):

<sect1> Your shell says `File Not Found'
<p>
Either /usr/bin/ksh was not replaced with /bin/sh in bin/.java_wrapper, or
no symbolic link from /usr/bin/ksh to /bin/bash; or, which rpm not
installed, or `whence' was not replaced with `which' in the bin/.java_wrapper.
</sect1>

<sect1> An error message refers to /dev/zero
<p>
Go root and do `chmod 666 /dev/zero'.
</sect1>

<sect1> SEGFAULT
<p>
Occasionally, you may get a screen full of error messages, and the system 
cheerfully fills up your swap space and locks-up.

You're probably missing a library someplace.  Rerun ldconfig -v and 
see what's missing. Perhaps LD_LIBRARY_PATH or CLASS_PATH is not set.
Finally, some applets are buggy or lock up the Linux JDK.

(BTW, you can stop the lock-up by having another Xterm open 
with top running; use top to kill the java process BEFORE it 
fills up swap and hangs your system!)

Java seems to want lots of resources, so I'd keep the number of 
running/open apps on my desktop to a minimum.  It will load on 
a 486DX-2-75 with 8 Mbytes RAM and 16 Mbytes swap (it'll take a 
minute, though).  I was able to get two animation applets running 
simultaneously (sort of) before my system ran out of swap space 
and hung.
</sect1>

<sect1> bin/java, bin/javac, or bin/appletviewer gives you a help screen
<p>
You left out some command-line parameter.
</sect1>
</sect>

<sect> Acknowledgements
Grateful acknowledgement is made to all contributors, including
John Franks &lt;john@math.nwu.edu&gt;,
Zachary DeAquila &lt;zachary@zachs.place.org&gt;,
Steve Greene &lt;sgreene@dcc12513.slip.digex.net&gt;,
Dave Dittrich &lt;dittrich@cac.washington.edu&gt;, 
Dave Flanagan &lt;dave@ora.com&gt;.

This version incorporates Steve Greene's rumored but never-published
Red Hat/Caldera mini-HOWTO.
</sect>

</article>

<!--
The following sets edit modes for GNU EMACS
Local Variables:
fill-column:75
End:
-- >
------------------------------------------ CUT HERE --------------------------
--
								>>esr>>

