home *** CD-ROM | disk | FTP | other *** search
/ Java 1996 August / Java - Summer 1996.iso / Linux / HOWTO / java-linux-HOWTO.2.0.txt < prev    next >
Encoding:
Text File  |  1996-01-22  |  34.2 KB  |  793 lines

  1.   Java on Linux HOWTO
  2.   maintained by Eric S. Raymond, <esr@snark.thyrsus.com>
  3.   v.2.0, 20 Jan 1996
  4.  
  5.   This document describes how to get started with Java and HotJava under
  6.   Linux, as either a user or a programmer.
  7.  
  8.   11..  IInnttrroodduuccttiioonn
  9.  
  10.   This document is a Linux-centric introduction to the world of Java and
  11.   HotJava.  These technologies are rapidly evolving, and we welcome
  12.   contributions from anywhere.
  13.  
  14.   Places in this document that are in serious need of checking or
  15.   filling out are bracketed with *** ***.  Also see the ``To Be
  16.   Added...'' section below.  Please help us improve this HOWTO.  Send
  17.   updates and change requests to <esr@snark.thyrsus.com>.
  18.  
  19.   22..  GGeenneerraall QQuueessttiioonnss AAbboouutt JJaavvaa aanndd HHoottJJaavvaa
  20.  
  21.   This section is a general (non-Linux-specific) introduction to Java
  22.   and HotJava.
  23.  
  24.  
  25.   22..11..  WWhhaatt aarree aarree JJaavvaa aanndd HHoottJJaavvaa aanndd wwhhyy aarree tthheeyy iinntteerreessttiinngg??
  26.  
  27.   Java is a network-aware language superficially resembling C++, but
  28.   much smaller and more compact and cleanly designed.  It's an
  29.   unlimited-extent language with garbage collection like Lisp, but with
  30.   static type checking (it's been aptly described as "Smalltalk with
  31.   sane syntax").  It includes lightweight processes (threads) as a
  32.   native facility and has powerful network-security features.  So far,
  33.   its major application is the HotJava browser, but it holds
  34.   considerable promise as a general-purpose application language.
  35.  
  36.   HotJava is a WWW browser written in Java.  Its major advance over
  37.   other browsers is that it knows about a new HTML construct called an
  38.   APPLET, which is some Java class that executes on the client machine.
  39.   Thus, WWW documents written with Java in mind can have "live" code
  40.   objects embedded in them, as opposed to just data.
  41.  
  42.   The ability to safely pass around code objects probably represents the
  43.   most significant advance in WWW technology since the first release of
  44.   Mosaic.  At minimum, it delivers an extensible Web browser that won't
  45.   need perpetual upgrading to handle new image formats and tag types.
  46.  
  47.   22..22..  WWhheerree ddoo JJaavvaa aanndd HHoottJJaavvaa ccoommee ffrroomm??  WWhhoo ccaann uussee tthheemm??
  48.  
  49.   Java and HotJava were developed at Sun Microsystems by a team headed
  50.   by James Gosling (well known as the designer of Gosling Emacs and
  51.   NeWS).
  52.  
  53.   The last time Sun tried to set a major technical standard was NeWS,
  54.   its Network Window System.  Though NeWS was pretty universally
  55.   conceded to be technically superior to X, X won because its sources
  56.   were freely redistributable.  Sun learned from this mistake, and has
  57.   made Java/HotJava much more generally available; the sources can be
  58.   downloaded under a fairly relaxed license (see ``Java as Freely
  59.   Redistributable Software'').  Sun is encouraging ports to non-Sun
  60.   environments.
  61.  
  62.   Netscape now interprets Java.  Microsoft licensed the technology in
  63.   early December 1995.  So it appears that Java support will probably
  64.   become universal in 1996.
  65.  
  66.  
  67.   Java used to be called Oak.  HotJava was once known as WebRunner.
  68.  
  69.   22..33..  HHooww mmaattuurree iiss JJaavvaa??
  70.  
  71.   On December 12 1995 Sun released the `Beta 2' version of Java.  The
  72.   Java environment API defining its access to the host OS and windowing
  73.   system has allegedly been semi-frozen -- it may be extended, but won't
  74.   be incompatibly changed.
  75.  
  76.   The 1.0 version of this FAQ is being issued along with the beta 1.0
  77.   Java Developer's Kit (JDK) for Linux, ported by Randy Chapman.
  78.  
  79.   Significant holes are known to exist in the Java security
  80.   implementation.  It is not yet a good idea to use Java for sensitive
  81.   applications.  These problems are expected to be fixed in the
  82.   production (post-beta) releases.
  83.  
  84.   22..44..  WWhheerree ccaann II ffiinndd ddooccuummeennttaattiioonn oonn JJaavvaa aanndd HHoottJJaavvaa??
  85.  
  86.   Sun maintains an extensive HTML web of Java and HotJava-related
  87.   documents at  <hhttttpp::////jjaavvaa..ssuunn..ccoomm>.  These documents are mirrored at
  88.   <hhttttpp::////jjaavvaa..bbllaacckkddoowwnn..ccoomm> and elsewhere; see Sun's list of mirror
  89.   sites.
  90.  
  91.   22..55..  YYeess,, bbuutt wwhheerree ccaann II ffiinndd ppaappeerr ddooccuummeennttaattiioonn??
  92.  
  93.   SunSoft Press's official series of Java books is in the production
  94.   pipeline at Addison-Wesley.  Some details about these can be found in
  95.   the comp.lang.java FAQ <hhttttpp::////wwwwww..cciittyy--nneett..ccoomm//~~kkrroomm//jjaavvaa--ffaaqq..hhttmmll>.
  96.  
  97.   Several Java early-adopters have recommended "Hooked on Java" by the
  98.   members of the Java team.  "Well written, though I'd appreciate
  99.   something less basic" was one comment.
  100.  
  101.   O'Reilly Associates is working on its own series of Java books in
  102.   cooperation with Sun.  These will include (at least) a "Nutshell Guide
  103.   To Java", a language reference, a class library reference, and a book
  104.   on the underlying byte-code virtual machine.  (Full-disclosure
  105.   statement: Your HOWTO editor has been invited by O'Reilly Associates
  106.   to serve as primary technical reviewer for this series, and is being
  107.   paid for that work.)
  108.  
  109.   SAMS has a book called "Learning Java in 21 Days".  No revieww yet.
  110.  
  111.   One of our contributors, browsing his local Bookstop/Barnes &
  112.   Noble/Borders, came up with 3 books already out:
  113.  
  114.   +o  One called 'Java in 60 minutes' that looked like a pretty strict
  115.      syntactic description (about $20).
  116.  
  117.   +o  One from SamsNet called just `Java' (about $20).
  118.  
  119.   +o  One by Tim Ritchey called `Java!' that includes a CD-ROM (about
  120.      $35).
  121.  
  122.      Our informant continues: "I bought the 3rd one (by Tim Ritchey).
  123.      Paper leadtimes being what they are, the CD-ROM only has alpha
  124.      stuff, though it mentions that the beta version might be out by the
  125.      time you read it and suggests java.sun.com as a place to get more
  126.      recent information.  Other than that, it's pretty good, even to
  127.      pointing out that `well, it's pointless for me to spam you with
  128.      pages and pages of API descriptions because 1) it would quadruple
  129.      the size of the book and 20 they're still ch anging and 2) you can
  130.      get that info online at ...etc'"
  131.  
  132.  
  133.   Dave Dittrich writes: I'd say that "Java in 60 minutes" may take you
  134.   60 minutes to read, but won't teach you how to program in Java in 60
  135.   minutes (surprise, surprise!)  It looks to me like "Java in 60
  136.   minutes" is one of the many attempts be first to market with a book on
  137.   a hot topic.  It didn't seem to include much more than you can find
  138.   right now on the Web, including lots of text that looks like it was
  139.   lifted straight out of the Java Language Specification
  140.   (http://java.sun.com/JDK-beta2/psfiles/javaspec.ps).
  141.  
  142.   Dave continues: Same thing with "Java!", only the latter goes into
  143.   much more detail on object oriented programming concepts, etc.
  144.   Someone pointed me to another text book that is equally as good at
  145.   covering data/method abstraction and other object oriented programming
  146.   concepts, which is "Structure and Interpretation of Computer Programs"
  147.   by Abelson, Sussman and Sussman (MIT Press).
  148.  
  149.   Final caveat: at this point (January 1996), it is probly a good idea
  150.   to stay away from the Ritchey book or anything else based on the alpha
  151.   API.  The beta API is substantially different, and the soon-to-be-
  152.   released Java 1.0 will have its own differences.
  153.  
  154.   22..66..  WWhheerree ccaann II ffiinndd oonn--lliinnee ccoolllleeccttiioonnss ooff JJaavvaa ccooddee??
  155.  
  156.   WWW archives of applets are available at the following locations:
  157.  
  158.   +o  <hhttttpp::////jjaavvaa..ssuunn..ccoomm//>
  159.  
  160.   +o  <hhttttpp::////wwwwww..aapppplleettss..ccoomm//>
  161.  
  162.   +o  <hhttttpp::////wwwwww..ggaammeellaann..ccoomm//>
  163.  
  164.   +o  <hhttttpp::////wwwwww..jjaavvaassoofftt..ccoomm//aapppplleettss//aapppplleettss..hhttmmll>
  165.  
  166.      Most of the applets on these pages come with source code, and
  167.      programmers are invited to use them.
  168.  
  169.   Pointers to others may be available in the comp.lang.java FAQ
  170.   <hhttttpp::////wwwwww..cciittyy--nneett..ccoomm//~~kkrroomm//jjaavvaa--ffaaqq..hhttmmll>.
  171.  
  172.   33..  JJaavvaa aass FFrreeeellyy RReeddiissttrriibbuuttaabbllee SSooffttwwaarree
  173.  
  174.   Many Linux programmers are attached to producing freely
  175.   redistributable software (FRS), and try to avoid committing a lot of
  176.   time to tools for which sources are not generally available.  In this
  177.   section, we discuss Sun's and Java's relationship with the FRS world.
  178.  
  179.   (Warning: I am not a lawyer.  I am neither employed by, nor an agent
  180.   of, nor a stockholder in, Sun Microsystems.  This section is based on
  181.   my interpretation of the current copyright law and the Sun licensing
  182.   language.  Treat this as an introduction; the Sun licensing page,
  183.   <hhttttpp::////wwwwww..bbllaacckkddoowwnn..oorrgg//JJaavvaa//lliicceennssiinngg..hhttmmll> is definitive. If you
  184.   are in serious doubt about what it means, consult an attorney.)
  185.  
  186.  
  187.   33..11..  AArree JJaavvaa pprrooggrraammss aanndd aapppplleettss ffrreeeellyy rreeddiissttrriibbuuttaabbllee??
  188.  
  189.   They are if you write them and choose to make them FRS through some
  190.   mechanism (such as the GPL, or a BSD-style license, or declaring them
  191.   public domain).
  192.  
  193.  
  194.   33..22..  WWhhaatt ccaann II ddoo wwiitthh JJaavvaa iimmpplleemmeennttaattiioonn bbiinnaarriieess??
  195.  
  196.   The Sun licensing page has this to say:
  197.  
  198.  
  199.   The unmodified Java and HotJava binary releases may be
  200.   redistributed free of charge in both commercial and non-
  201.   commercial applications.
  202.  
  203.  
  204.   Also:
  205.  
  206.        Companies or individuals who wish to create a new port of
  207.        the Java language have the right under this agreement to
  208.        post the binaries of that port to the Internet for use by
  209.        others, as long as the port is free of charge and passes the
  210.        publicly available test suites. (Test suites will be avail-
  211.        able sometime in the first half of 1996.) The "diffs" may
  212.        also be posted on the web as long as the underlying source
  213.        code is not posted. The Java source code is
  214.  
  215.  
  216.   So if you've got a working Java or HotJava binary, you can give it to
  217.   your buddies.  Or put it on a CD-ROM.  Or do anything except patch it
  218.   and represent the patched version as Java.  (This is reasonable.  Sun
  219.   obviously can't leave itself without recourse against Trojan horses
  220.   sailing under the Java banner.)  Binaries are FRS.
  221.  
  222.   33..33..  WWhhiicchh ppaarrttss ooff tthhee JJaavvaa ssoouurrcceess aarree ffrreeeellyy rreeddiissttrriibbuuttaabbllee??
  223.  
  224.   According to Sun's licensing page, none of it is.  But that sounds
  225.   harsher than it is.  In practice, anyone can get the Java and HotJava
  226.   sources for educational, porting, and non-commercial purposes by
  227.   filling out a Web form which obligates them not to redistribute the
  228.   sources.  And the agreement _d_o_e_s permit redistribution of diffs
  229.   against the sources.
  230.  
  231.   The only circumstance that requires you to sign a commercial license
  232.   with Sun and pay them money is if you want to use the sources in a
  233.   commercial product.  In particular, the way the language is written,
  234.   it's within the letter and spirit of the agreement for you to sign
  235.   Sun's noncommercial source license, snarf the source, port it, and
  236.   give away the resulting binaries as completely unencumbered freeware!
  237.  
  238.   Sun says that its primary purpose in keeping as much control as it has
  239.   is to keep the language from mutating into incompatible dialects.  The
  240.   license language supports this; it seems to have been designed to
  241.   allow hackers to play for free.
  242.  
  243.   33..44..  WWhhaatt iiss SSuunn''ss aattttiittuuddee ttoowwaarrddss FFRRSS JJaavvaa iimmpplleemmeennttaattiioonnss aanndd
  244.   ttoooollss??
  245.  
  246.   The Sun licensing page says:
  247.  
  248.        The specifications for the Java Language and the Java Vir-
  249.        tual Machine are OPEN and are copyrighted by Sun Microsys-
  250.        tems, Inc.
  251.  
  252.  
  253.  
  254.        Reimplementations of the Java Compiler or the Java Runtime
  255.        Interpreter are permitted without requiring a license from
  256.        Sun provided such implementations are created directly from
  257.        the published specifications and without the direct or indi-
  258.        rect use of Sun's own implementations or other intellectual
  259.        property rights, including trademarks.
  260.  
  261.  
  262.   So if you want to go to the effort of creating a Java clone from the
  263.   published specifications that is FRS, Sun won't stop you.
  264.  
  265.   Sun people use the term "rogue port" for Java implementations that
  266.   either (a) are performed outside Sun, or (b) don't rely on Sun-
  267.   licensed code (sometimes the term seems to mean one thing, sometimes
  268.   the other).  They seem to think some of these already exist, but we
  269.   don't know where they are, nor if they are FRS.  They're pretty
  270.   relaxed about the situation.
  271.  
  272.   Sun has a Java validation suite.  They have said they'll certify any
  273.   Java port that passes it.  (Whether this validation will cost money is
  274.   unknown, but Sun says in writing that the suite wil be "publicly
  275.   available" in 1996, which at least hints that it will not.) They're
  276.   prepared to certify rogue ports, though this apparently hasn't
  277.   happened yet.
  278.  
  279.   33..55..  IIss aannyyoonnee cclloonniinngg JJaavvaa iinn ffrreeeellyy rreeddiissttrriibbuuttaabbllee ssoouurrccee??
  280.  
  281.   There is a clone of the Java compiler in early development.  It's
  282.   called guavac.  You can find more information at
  283.   <hhttttpp::////hhttttpp..ccss..bbeerrkkeelleeyy..eedduu//~~eennggbbeerrgg//gguuaavvaacc>
  284.  
  285.   There is a rumor afloat that Cygnus Software's GROW project has plans
  286.   for a Java byte code interpreter to be issued under GPL.  However,
  287.   they haven't yet responded to a query about this.  You can get details
  288.   on the GROW project at <hhttttpp::////wwwwww..ccyyggnnuuss..ccoomm//ttiieemmaannnn//ggrrooww//>.
  289.  
  290.   Erik Troan of Red Hat is attempting to put together a development
  291.   group to do the rest of the job.  Right now it looks like Erik will do
  292.   the class library and your humble editor will do the byte-code
  293.   interpreter (if Cygnus hasn't gotten there first).  This project has
  294.   been tentatively named "Mr. Coffee".  Your editor would now prefer to
  295.   call it "joe" (for Java Open to Everyone) but that name is taken.
  296.  
  297.  
  298.   33..66..  AArree tthheerree aannyy FFRRSS JJaavvaa TToooollss??
  299.  
  300.   There is a GNU Emacs mode for editing Java.  You can fetch it from
  301.   <ffttpp::////jjaavvaa..ssuunn..ccoomm//ppuubb//jjaavvaa//ccoonnttrriibb//eemmaaccss>.  Note: this mode assumes
  302.   you're using c++-mode.el, and won't work with the cc-mode.el
  303.   distributed with Emacs 19.
  304.  
  305.   44..  JJaavvaa OOnn LLiinnuuxx QQuueessttiioonnss
  306.  
  307.   Here you can learn the nuts and bolts of getting Java running on your
  308.   Linux.
  309.  
  310.  
  311.   44..11..  AArree JJaavvaa aanndd HHoottJJaavvaa iinncclluuddeedd iinn aannyy ooff tthhee LLiinnuuxx ddiissttrriibbuuttiioonnss??
  312.  
  313.   No, not yet, but expect it any week now.
  314.  
  315.   44..22..  HHooww ccaann II ggeett tthhee llaatteesstt JJaavvaa ddiissttrriibbuuttiioonn ffoorr LLiinnuuxx??
  316.  
  317.   Look in  <ffttpp::////jjaavvaa..bbllaacckkddoowwnn..oorrgg//ppuubb//JJaavvaa//lliinnuuxx>.  The latest Java-
  318.   for-Linux can be downloaded from there.  You should browse the
  319.   <ffttpp::////jjaavvaa..bbllaacckkddoowwnn..oorrgg//ppuubb//JJaavvaa//lliinnuuxx//RREEAADDMMEE> first.
  320.  
  321.   The files you'll need are linux.jdk.common.tar.gz and one of either
  322.   linux.jdk.x86-static-motif-bin.tar.gz ot linux.jdk.x86-shared-motif-
  323.   bin.tar.gz, depending on whether you have Motif shared libraries on
  324.   your system.
  325.  
  326.   This port (from the Sun sources by Randy Chapman) is the one that's
  327.   referred to (as the JDK) elsewhere in this HOWTO.
  328.  
  329.  
  330.  
  331.   44..33..  WWhhaatt eennvviirroonnmmeenntt wwiillll II nneeeedd ttoo rruunn JJaavvaa??
  332.  
  333.   For starters, you need an ELF-based Linux.  There is no a.out support,
  334.   and at the speed the Linux world is switching over to ELF there is not
  335.   likely to be any in the future.
  336.  
  337.   You need a 1.2.13 or later kernel.  Kernels 1.2.12 and older seem to
  338.   have a bug in getcwd(3) that tanks bin/javac because it doesn't check
  339.   the getcwd(3) return code.
  340.  
  341.   You'll need these pieces:
  342.  
  343.  
  344.   +o  libc.so.5 => /lib/libc.so.5.2.16
  345.  
  346.   +o  libX11.so.6 => /usr/X11/lib/libX11.so.6.0
  347.  
  348.   +o  libXt.so.6 => /usr/X11/lib/libXt.so.6.0
  349.  
  350.   +o  libXext.so.6 => /usr/X11/lib/libXext.so.6.0
  351.  
  352.   +o  libXpm.so.4 => /usr/X11/lib/libXpm.so.4.3
  353.  
  354.   +o  libdl.so.1 => /lib/libdl.so.1.7.9
  355.  
  356.      The C and X support libraries may be in your Linux already.
  357.  
  358.   If you don't already have it, get libc.5.2.16.bin.tar.gz from
  359.   <ffttpp::////ttssxx--1111..mmiitt..eedduu//ppuubb//lliinnuuxx//ppaacckkaaggeess//GGCCCC//>.  Uncompress and untar
  360.   and copy the files in the lib subdirectory of the top level of the
  361.   hierarchy to /lib.
  362.  
  363.   If you don't have a current version of ld.so (or libdl.so.1.7.*) you
  364.   will need to update. ld.so.1.7.9 and .11 will work; .10 and other
  365.   early versions will not. Get ld-so.1.7.11.tar.gz from
  366.   <ffttpp::////ffttpp..ooddss..ccoomm//lliinnuuxx//>; Uncompress and untar it and run
  367.   _i_n_s_t_l_d_s_o_._s_h which is in the top level of the resulting hierarchy.
  368.  
  369.   You can get an Xpm library that will work from
  370.   <ffttpp::////ssuunnssiittee..uunncc..eedduu//ppuubb//LLiinnuuxx//lliibbss//XX//lliibbXXppmm..33..44ff--EELLFF..ttaarr..ggzz>.
  371.  
  372.   44..44..  DDoo II nneeeedd NNeettssccaappee??  CCaann II uussee NNeettssccaappee??
  373.  
  374.   Yes, you need Netscape.  HotJava isn't yet available for the beta
  375.   release.  Randy Chapman says:
  376.  
  377.        Sun massively changed the awt interface when they shipped
  378.        the beta JDK and have not yet converted HotJava to it.  They
  379.        have promised they will, and it should work great with
  380.        linux-jdk when they release it.
  381.  
  382.  
  383.   It's unknown when this will happen.
  384.  
  385.   Netscape versions starting from 2.0b3 is Java-aware.  It is available
  386.   at ftp1-7.netscape.com (i.e. at ftp1.netscape.com,
  387.   ftp2.netscape.com,... etc.)  Version 2.0b4 will allow you to read
  388.   applets from file: URLs, 2.0b3 didn't.  This should be a big help for
  389.   folks with small-memory machines (they don't need an httpd running).
  390.  
  391.   The file to get is /2.0b4/unix/netscape-v20b4-export.i486-unknown-
  392.   linux.tar.Z.
  393.  
  394.   Note that Netscape 2.0b3 or 4 will run on an a.out system, so it is,
  395.   in theory, possible to write your java app, give it to someone else to
  396.   compile (like maybe the BlackStar Public Compiler
  397.   <hhttttpp::////mmaarrss..bbllaacckkssttaarr..ccoomm>), and see the output on your system.  If
  398.   you want more than that, get an ELF system.
  399.  
  400.   Make sure CLASSPATH is _n_o_t set before running netscape; having it set
  401.   seems to crash Netscape, and if you follow the directions below it
  402.   won't need tweaking.
  403.  
  404.   The Linux Netscape port has a few known problems.  It doesn't do
  405.   sound.  Only 8-bit displays work; 16bpp displays yield crashes.  The
  406.   2.0b3 version occasionally yields bus errors when caling the dispose
  407.   method for frames.  While it's pretty robust otherwise, Gamelan's
  408.   `Impressionism' applet is known to crash it.
  409.  
  410.   44..55..  WWhhaatt mmaaiilliinngg lliissttss oorr nneewwssggrroouuppss eexxiisstt ffoorr ssuuppppoorrttiinngg JJaavvaa oonn
  411.   LLiinnuuxx??
  412.  
  413.  
  414.   +o  _j_a_v_a_-_l_i_n_u_x (Maintained by karl@blackdown.org) Discussions and
  415.      developments concerning the port of Java to the Linux operating
  416.      system. Email to java-linux-request@java.blackdown.org with the
  417.      word `subscribe' in the subject to be added to the list.
  418.  
  419.   +o  _j_a_v_a_-_l_i_n_u_x_-_a_n_n_o_u_n_c_e (Maintained by karl@blackdown.org) Moderated
  420.      list for announcements concerning the Java-Linux porting projects.
  421.      Please send e-mail to java-linux-announce-
  422.      request@java.blackdown.org with the word subscribe in the subject,
  423.      to be added to the list.
  424.  
  425.   +o  comp.lang.java Newsgroup for general Java discussion.
  426.  
  427.   +o  alt.www.hotjava Newsgroup for discussion of the HotJava browser.
  428.  
  429.   55..  BBuuiillddiinngg tthhee LLiinnuuxx JJaavvaa ppoorrtt oonn ssttoocckk LLiinnuuxxeess
  430.  
  431.   In this section, we collect recipes sent to us for building Randy
  432.   Chapman's Java port on various current Linux distributions:
  433.  
  434.  
  435.   55..11..  SSllaacckkwwaarree ddiissttrriibbuuttiioonn EELLFF kkeerrnneell 11..22..1133..
  436.  
  437.   John Franks <john@math.nwu.edu> writes that he succeeded with the
  438.   following steps:
  439.  
  440.  
  441.   +o  Get linux-x86.jdk.pre2.static-motif.tar.gz from
  442.      <ffttpp::////wwwwww..bbllaacckkddoowwnn..oorrgg//ppuubb//JJaavvaa//lliinnuuxx//> and uncompress it and
  443.      untar it.  (The filenames you must fetch have changes for the 1.0
  444.      beta JDK.)
  445.  
  446.   +o  Get libc.5.2.16.bin.tar.gz (binary distribution, not source) from
  447.      <ffttpp::////ttssxx--1111..mmiitt..eedduu//ppuubb//lliinnuuxx//ppaacckkaaggeess//GGCCCC//> Uncompress and untar
  448.      and copy the files in the lib subdirectory of the top level of the
  449.      hierarchy to /lib.  Make sure that /lib/libc.so.5 is a symlink to
  450.      this file.
  451.  
  452.   +o  Get ld-so.1.7.11.tar.gz from ftp://ftp.ods.com/linux/ Uncompress
  453.      and untar it and run "instldso.sh" which is in the top level of the
  454.      resulting hierarchy.
  455.  
  456.      You should now be able to compile and try the "hello world" program
  457.      and applet from Sun following the instructions at
  458.      <hhttttpp::////jjaavvaa..ssuunn..ccoomm//pprrooggGGuuiiddee//iinnddeexx..hhttmmll>.
  459.  
  460.  
  461.  
  462.  
  463.   55..22..  RReeddHHaatt 22..11//CCaallddeerraa PPrreevviieeww 22
  464.  
  465.   Steve Greene <sgreene@access.digex.net> reports success doing the
  466.   following steps.  I have edited the recipe slightly, so blame any
  467.   mistakes on me.  The `JDK' he refers to is the Chapman port of the
  468.   Java Developer's Kit.
  469.  
  470.  
  471.   +o  From a Red Hat mirror site, get the rpm available for ld.so.1.7.11.
  472.      To find it, check any RedHat mirror site for:
  473.  
  474.      /pub/mirrors/redhat-2.1/updates/RPMS/ld.so-1.7.11-i386.rpm
  475.  
  476.      I know it is available at ftp.pht.com, ftp.caldera.com. and is
  477.      probably at the other RedHat mirrors as well.  Grab it, and do `rpm
  478.      -Uvh ld.so-1.7.11-1.i386.rpm' on your system.
  479.  
  480.   +o  Red Hat 2.0 and Caldera Preview 2 users may need the `which'
  481.      program (it's called by some of the scripts in the JDK).  An rpm
  482.      file for `which' is available at the usual Red Hat mirror sites as
  483.      part of the Red Hat 2.1 distribution files.  Get and install
  484.      which-1.0.i386.rpm.  RedHat 2.1 users should already have which on
  485.      their system or available within their original distribution.
  486.  
  487.   +o  Get the tar file(s) for the statically-linked JDK.  Untar it from a
  488.      convenient point.  I put mine in /usr/local, so the untar creates
  489.      /usr/local/java/....
  490.  
  491.   +o  So you can run java as someone other than root (this is a good
  492.      idea!), do `chmod 666 /dev/zero'.   Red Hat and Caldera have the
  493.      wrong permissions set on this device out of the box.
  494.  
  495.   +o  If you haven't already, run ldconfig as root to load the new
  496.      libraries.  If you do "ldconfig -v"  you can verify you have all
  497.      the libraries loaded.  (At least we don't have to build an ELF
  498.      system first!)
  499.  
  500.   +o  Make sure you're logged in as a user (e.g. non-root).  Start X-
  501.      windows, open an X-Term, and try something!
  502.  
  503.   55..33..  UUnniiffiixx
  504.  
  505.   Stefan Middendorf writes: Unifix is a popular German-language Linux
  506.   distribution. There are a few distributions based on it: Linux
  507.   Universe, sold in USA, Linux 4U, currently only distributed in Germany
  508.   and Linux FT in Britain.  This recipe is known to work for Unifix 1.7,
  509.   Linux 4U 1st Edition, Linux Universe 2nd Edition, and Linux FT 1.1.
  510.  
  511.  
  512.   +o  Put linux-x86.jdk.pre2.static-motif.tar.gz from
  513.      <ffttpp::////wwwwww..bbllaacckkddoowwnn..oorrgg//ppuubb//JJaavvaa//lliinnuuxx//> in /usr/local and
  514.      uncompress it and untar it.
  515.  
  516.   +o  Change the first line of the script .java_wrapper from PRG=`which
  517.      $0` >/dev/null 2>&1 to
  518.  
  519.      PRG=`type $0 | cut -d ' ' -f 3` >/dev/null 2>&1
  520.  
  521.   +o  Get libc-5.2.18.bin.tar.gz (I succeeded with
  522.      libc-5.2.16.bin.tar.gz, too), extract and uncompress it in the /
  523.      drectory.
  524.  
  525.   +o  Get ld-so.1.7.12.tar.gz from tsx-11.mit.edu (or any mirror site)
  526.      and uncompress and untar it, e.g. in /usr/local.  Change to the
  527.      resulting directory and run instldso.sh. This will also run
  528.      ldconfig.  Probably newer versions of ld-so will work too.
  529.   +o  Add /usr/local/java/bin to the PATH environment variable.
  530.  
  531.   +o  Get netscape-v20b4-export.i486-unknown-linux.tar.Z, extract and
  532.      uncompress it in /usr/local/<yourNetscapeDir>.
  533.  
  534.   +o  Create a Link in /usr/local/bin to ../<yourNetscapeDir>/netscape.
  535.  
  536.   +o  Put /usr/local/<yourNetscapeDir>/moz2_0.zip in
  537.      /usr/local/lib/netscape/.
  538.  
  539.   As an alternative to changing your PATH, Ralf Strobel suggests:
  540.  
  541.  
  542.   +o  Copy the scripts .java_wrapper and appletviewer and the links @java
  543.      @javac, @javadoc, @javap, and @jdb from /usr/local/java/bin to
  544.      /usr/local/bin and you can use them wherever you are.
  545.  
  546.   +o  In /java/bin/i586 you can add a script called `javadoc`
  547.  
  548.      #!/bin/sh `dirname $0`/java sun.tools.javadoc.Main -d <yourhtmldir>
  549.      $*
  550.  
  551.      where if you are user jrandom, <yourhtmldir> would be
  552.      jrandom/.java-html.
  553.  
  554.   66..  VViieewwiinngg AApppplleettss
  555.  
  556.   To run a demo without going through the applet viewer, you can enter
  557.   this command from the top of my Java directory tree (/usr/local/java
  558.   on most systems):
  559.  
  560.   bin/java sun.applet.AppletViewer demo/<directory_name>/exampleN.html
  561.  
  562.   where <directory name> is the subdirectory off demo, and N is the
  563.   number of the example file (some directories have more than one).
  564.  
  565.   Steve Greene says: I've started the tutorials available from Sun's
  566.   java site and the similar one put out by the NTMUG.  I've discovered
  567.   some problems with the syntax in Sun's tutorial, so I've been
  568.   following the NYMUG tutorial instead for now.
  569.  
  570.   The appletviewer expects as an argument, an html file with an APPLET
  571.   tag inside it.
  572.  
  573.   For example, if your html file Hello.html looks like:
  574.  
  575.  
  576.  
  577.           <HTML>
  578.           <HEAD>
  579.           <TITLE> Hello test program </TITLE>
  580.           < /HEAD>
  581.           <BODY>
  582.           This is an appletviewer test
  583.           <APPLET CODE="Hello1.class" WIDTH=150 HEIGHT=25>
  584.           < /APPLET>
  585.           < /BODY>
  586.           < /HTML>
  587.  
  588.  
  589.  
  590.  
  591.   (If you see "< /" in the above, ignore the space.  It's a workaround
  592.   for a formatter bug.)
  593.  
  594.  
  595.   Running "appletviewer Hello.html" will show you the applet. One
  596.   advantage of using the appletviewer is that events sent to the applet
  597.   (start(), init(), etc) are in compliance with Sun specs as opposed to
  598.   Netscape 2.0b4 (probably a bug in Netscape).
  599.  
  600.   A disadvantage of using the appletviewer is that it is much more
  601.   slower than Netscape.
  602.  
  603.   The first time you run Java, a license screen resembling Netscape's
  604.   will be displayed.
  605.  
  606.   77..  NNootteess oonn KKnnoowwnn PPrroobblleemmss
  607.  
  608.  
  609.   77..11..  GGNNUU MMaakkee bbrreeaakkss aafftteerr II iinnssttaallll JJaavvaa
  610.  
  611.   Recent versions of libc fix a bug which masked a bug in GNU Make (the
  612.   symptom is that make doesn't look in Makefile for rules).  The libc
  613.   5.2.8 release notes give a patch to make that fixes the problem.
  614.  
  615.   77..22..  YYoouu ggeett ``ddiirrnnaammee:: ttoooo mmaannyy aarrgguummeennttss'' eerrrroorrss
  616.  
  617.   Your CLASSPATH variable is not correctly initialized.  In
  618.   .java_wrapper, there is code akin to the follwing:
  619.  
  620.  
  621.  
  622.           PRG=`which $0`
  623.           J_HOME=`dirname $PRG`/..
  624.  
  625.  
  626.  
  627.  
  628.   Unfortunately, linux's standalone which command is hideously broken,
  629.   and certain shells will set $0 to the full pathname.  Randy Chapman
  630.   says the fix is either to use:
  631.  
  632.  
  633.  
  634.            J_HOME=`dirname $0`/..
  635.  
  636.  
  637.  
  638.  
  639.   Or, safer:
  640.  
  641.  
  642.  
  643.            J_HOME=/usr/local/java
  644.  
  645.  
  646.  
  647.  
  648.   An alternate fix from Dave Dittrich is:
  649.  
  650.  
  651.  
  652.            PRG=`csh -c "which $0"`
  653.  
  654.  
  655.  
  656.  
  657.   And another one from Tim Farnum is to change the PRG=`which $0` line
  658.   to
  659.  
  660.  
  661.            PRG=$0
  662.  
  663.  
  664.  
  665.  
  666.   Lutz Behnke suggests:
  667.  
  668.  
  669.  
  670.            PRG=`type -path $0` >/dev/null 2>&1
  671.  
  672.  
  673.  
  674.  
  675.   A similar change also needs to be made to the appletviewer script.
  676.  
  677.   77..33..  YYoouu ggeett ``ccaannnnoott ffiinndd ccllaassss jjaavvaa//llaanngg//TThhrreeaadd'' eerrrroorrss
  678.  
  679.   Your CLASSPATH variable is not correctly initialized.  See above.
  680.  
  681.   77..44..  AAnn eerrrroorr mmeessssaaggee rreeffeerrss ttoo //ddeevv//zzeerroo
  682.  
  683.   Go root and do `chmod 666 /dev/zero'.
  684.  
  685.   77..55..  SSEEGGFFAAUULLTT
  686.  
  687.   Occasionally, you may get a screen full of error messages, and the
  688.   system cheerfully fills up your swap space and locks-up.
  689.  
  690.   You're probably missing a library someplace.  Rerun ldconfig -v and
  691.   see what's missing. Perhaps LD_LIBRARY_PATH or CLASS_PATH is not set.
  692.   Finally, some applets are buggy or lock up the Linux JDK.
  693.  
  694.   (BTW, you can stop the lock-up by having another Xterm open with top
  695.   running; use top to kill the java process BEFORE it fills up swap and
  696.   hangs your system!)
  697.  
  698.   Java seems to want lots of resources, so I'd keep the number of
  699.   running/open apps on my desktop to a minimum.  It will load on a
  700.   486DX-2-75 with 8 Mbytes RAM and 16 Mbytes swap (it'll take a minute,
  701.   though).  I was able to get two animation applets running
  702.   simultaneously (sort of) before my system ran out of swap space and
  703.   hung.
  704.  
  705.   77..66..  bbiinn//jjaavvaa,, bbiinn//jjaavvaacc,, oorr bbiinn//aapppplleettvviieewweerr ggiivveess yyoouu aa hheellpp ssccrreeeenn
  706.  
  707.   You left out some command-line parameter.
  708.  
  709.   77..77..  AApppplleettss sshhooww iinn tthhee vviieewweerr bbuutt nnoott wwhheenn ppuutt oonn aa wweebb sseerrvveerr
  710.  
  711.   A common error which causes these results is failing to get the MIME
  712.   type of the applet correct.  Your server should send a header with the
  713.   applet indicating that its MIME type is "text/plain",
  714.   "application/octet-stream", or some other type that doesn't have a
  715.   defined special handler on the client side.  How you arrange this
  716.   depends on which server you are using. (John Franks)
  717.  
  718.   It's also been alleged that tinyhttpd, an HTTP server written in Perl,
  719.   returns a bad content type.  Apache, OTOH, is pretty reliable.
  720.  
  721.   77..88..  PPrroobblleemm LLooggggiinngg
  722.  
  723.   Joey Oravec tells us that HotJava keeps a log of what it does and any
  724.   problems in encounters. If you're up to diagnosing something yourself,
  725.   look at $HOME/.hotjava/weblog in the user's home directory.  That file
  726.   will make it more obvious if you're perhaps missing a library or
  727.   something.
  728.  
  729.   88..  RReellaatteedd RReessoouurrcceess
  730.  
  731.   For general information on Java, there is a FAQ maintained on the
  732.   comp.lang.java newsgroup; it is available at <hhttttpp::////wwwwww..cciittyy--
  733.   nneett..ccoomm//~~kkrroomm//jjaavvaa--ffaaqq..hhttmmll>.
  734.  
  735.   There is an older FAQ-style document by Joey Oravec
  736.   joey@sun.science.wayne.edu <mmaaiillttoo::jjooeeyy@@ssuunn..sscciieennccee..wwaayynnee..eedduu> which
  737.   primarily refers to the alpha release.  You can find it at
  738.   <hhttttpp::////wwwwww..sscciieennccee..wwaayynnee..eedduu//~~jjooeeyy//jjaavvaa//lliinnuuxx..hhttmmll>.  At some point
  739.   these documents may merge.
  740.  
  741.   Here are some Java-related pages:
  742.  
  743.  
  744.   +o  Karl Asha's General Linux Java Page
  745.      <hhttttpp::////ssuubbssttaannccee..bbllaacckkddoowwnn..oorrgg//jjaavvaa--lliinnuuxx..hhttmmll> LinuxJava Mailing
  746.      List <hhttttpp::////hhoommeerr..nnccmm..ccoomm//jjaavvaa--lliinnuuxx//> Netrek for Java
  747.      <hhttttpp::////wwwwww..ccss..uutteexxaass..eedduu//uusseerrss//hhiieepp//nneettjjaavv..hhttmmll> Blue-Skies for
  748.      Java <hhttttpp::////cciirrrruuss..sspprrll..uummiicchh..eedduu//jjaavvaawweeaatthheerr//> Java Hints Page
  749.      <hhttttpp::////wwwwww..ppaarrnnaassssee..ccoomm//jjaavvaa..sshhttmmll>
  750.  
  751.   99..  TToo BBee AAddddeedd......
  752.  
  753.  
  754.   +o  More recipes for specific Linux variants.
  755.  
  756.  
  757.   1100..  AAcckknnoowwlleeddggeemmeennttss
  758.  
  759.   Grateful acknowledgement is made to all contributors, including:
  760.  
  761.   +o  John Franks <john@math.nwu.edu>
  762.  
  763.   +o  Zachary DeAquila <zachary@zachs.place.org>
  764.  
  765.   +o  Steve Greene <sgreene@access.digex.net>
  766.  
  767.   +o  Dave Dittrich <dittrich@cac.washington.edu>
  768.  
  769.   +o  Dave Flanagan <dave@ora.com>
  770.  
  771.   +o  Joey Oravec <mailto:joey@sun.science.wayne.edu>
  772.  
  773.   +o  Adam Smith <aws@cs.brown.edu>
  774.  
  775.   +o  Joe Buck <jbuck@Synopsys.COM>
  776.  
  777.   +o  Omar Loggiodice <ologgio@netdepot.com>
  778.  
  779.   +o  Stefan Middendorf <mdorf@stud.fh-heilbronn.de<
  780.  
  781.   This version incorporates Steve Greene's rumored but never-published
  782.   Red Hat/Caldera mini-HOWTO.  I've also swiped some stuff I consider
  783.   useful off Joey Oravec's page -- special thanks to him.
  784.  
  785.   For other HOWTOs and FAQs I maintain, see my home page at
  786.   <hhttttpp::////wwwwww..lloocckkee..cccciill..oorrgg//~~eessrr//hhoommee..hhttmmll>.
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.