You can get 'Just Java' at Amazon.com You can get 'Not Just Java' at Amazon.com
Go to the Index


1. Java Book Information

  1. (sect. 1) How do I choose a JavaTM technology book?

    * There is no one right answer to "which is the right book for me?"
    Here's a list of popular Java technology books.
    A lot depends on what you already know, and how you like to learn.
    If you already know how to program in another language, and Just want to learn the Java programming language, consider Just Java 1.2 from the FAQ author.

    Everything in one handy volume (language basics, Swing, networking, I/O, database access, etc) and it comes with a CD with tons of applets, games, applications, compiler tools, complete with source. Includes Java technology-enabled compilers for Microsoft Windows, the Mac, Linux, and SolarisTM (SPARCTM and x86). look at http://www.amazon.com/ for details

    If you or your manager instead want a briefing on Java technology, thin clients, CORBA, TCP/IP, JavaBeansTM, etc., take a look at Not Just Java from the FAQ author.

    This book doesn't teach you how to program in Java; it tells you why you might want to, and what kind of systems are most suited to Java. It describes E-Commerce and XML. look at http://www.amazon.com/ for details

    Here are the points to check when evaluating a programming book.

    Most people buy one book to begin with, then four or five more as they wish to learn more, and about more specialized topics. The FAQ author has purchased and read probably 80 Java technology books in the last four years.

  2. (sect. 1) Where can I find a some lists of Java technology books and book reviews?

    * Here are some good ones:

    http://www.afu.com/jbooks.html

    http://www.hszk.bme.hu/~werner/Java2BookReviewBETA.html
    http://www.geocities.com/RainForest/Canopy/4774/Java/education.html

    http://www.flathill.com/languages/java/
    http://www.fastgraph.com/books/java.html
    http://teamjava.com/links/tj-srv.cgi?MUF=0,tj-booklist.muf
    http://www.javaworld.com/javaworld/books/jw-books-index.html


2. Getting Started

  1. (Sect. 2) What is the easiest way to get started with the Java programming language?

    * Follow these steps.

    1. Look at the books section of the FAQ to see what kind of book will suit you. There is no one perfect book. The right book depends on the style, pace, and detail that you are comfortable with.

    2. Download a free compiler from http://java.sun.com/ Service packs for Solaris (if any are needed) can be found at: http://www.sun.com/software/solaris/java/download.html

    3. Read the free Java programming language tutorial, at http://java.sun.com/docs/books/tutorial/index.html
      (bookmark it, so you will easily find it again).

    4. Avoid Microsoft's J++ product, which is in the words of Microsoft's own employees "polluted Java". It is designed to undermine the standard Java programming language, and has many deliberate platform-specific incompatibilities, including different keywords in the language. Microsoft dropped J++ in July 2000, leaving in the lurch any developers using it. See http://www.javacoffeebreak.com/articles/microsoftjava/

      For more information about the way Microsoft has been manipulating the computer industry and misusing its monopoly power, see Microsoft FAQ.

    5. To get some tips on getting started with a programming homework assignment, look at http://www.concentric.net/~pats/beginner.html.

    6. Search this FAQ when something in Java technology confuses you. Many people have trodden this path before you, and the FAQ contains the accumulated knowledge and pointers to other references.

  2. (Sect. 2) Why doesn't my "Hello World!" program compile?

    * There are three basic possibilities:

    1. Are you successfully running the javac compiler?
      Try
      javac -garbage
      to see if it prints out a message about correct usage. If not, invoke javac using the full pathname, or set your PATH variable to include the directory that contains javac.
    2. Is the CLASSPATH environment variable used correctly?
      In JDK 1.0.2, beginners had to set CLASSPATH, and it had to include both system libraries and your programs.
      In JDK 1.2, CLASSPATH is no longer needed for system libraries. You do want CLASSPATH to point to the directories containing any "user classes" you're using.
      Getting started, you will probably want at a minimum "." (the current directory) in your CLASSPATH.
      When CLASSPATH is wrong, javac will tell you it can't find definitions for classes you reference in the source file. For information on setting up the CLASSPATH, see Question 1.3
    3. Is the source correct?
      Here javac will emit error and warning messages. See the questions on compiler messages in the next section.

  3. (Sect. 2) Why doesn't my "Hello World!" program run?

    * There are several common mistakes that cause your VM (java or browser) to be unable to execute your classes

    1. First, did you write an applet or an application? If an applet, you must make sure that you did extend the java.applet.Applet class. Your starting code should be in the init routine.
      If you wrote an application, your starting code should be in a routine called main(). Don't mix applets with applications until you have a bit more experience.
    2. You must declare your main class as "public". If you don't, unfortunately some systems will still run the code, while others won't. The main class is either the one with the main() method in, or in the case of an Applet, the class that extends Applet.
    3. Your class name and the file name must match exactly, even letter case. If your class is HelloWorld, your source file must be HelloWorld.java and your class file will be "HelloWorld.class".
    4. Typing "java MyClass.class" is another very common error -- the argument to the java command should be the name of the Java class, not the name of the .class file. Type "java MyClass".
    5. If an Applet, and you used ftp to transfer the classes to the server, you must ftp all the classes, and you must use BINARY transfer not ASCII.
    6. Errors in setting the CLASSPATH (and/or codebase in an applet).
      Even seasoned programmers do this, pointing inside a package or mistyping a path delimiter. For information on setting up the CLASSPATH and codebase, see Question 1.3

    If you are running an applet, you should check the following further points:

    1. If your class isn't loading, recheck the HTML applet tag.
    2. If you are writing to System.out, the results are displayed in the browser's java console. You'll have to create a window if you want one.
    3. Make sure your browser is compatible with the language features you are using. Internet Explorer and older versions of NetscapeTM's browsers have omitted some support for JDK 1.1. Try your applet in the JDK's appletviewer first.

  4. How do I set the CLASSPATH?

    * The CLASSPATH environment variable tells the VM's class loader where to find classes that are directly or indirectly invoked, including system classes. The CLASSPATH variable should

    Also remember that

    From JDK 1.1.2 on, it is generally an error if the user sets the CLASSPATH to include classes.zip. But CLASSPATH will need to be set to

    For the sake of consistency, the minimal classpath setting should be: " set CLASSPATH=. "
    Below you'll find examples for Microsoft Windows (basic application class), Solaris (package class), javac (multiple packages), and browsers (applet codebase).



    Here's some Microsoft Windows examples, assuming the application class is
    D:\src\tries\HelloWorld.class
    
    
            ## JDK 1.1,  no CLASSPATH set
    
            > cd D:\src\tries\
    
            > D:\jdk11\bin\java HelloWorld
    
              # OK: 1.1 implicitly adds classes.zip and current dir
    
    
    
            > D:\jdk11\bin\jre HelloWorld
    
              # FAILS: jre does not automatically add . to CLASSPATH
    
    
    
            > cd D:\
    
            > D:\jdk11\bin\jre -cp D:\src\tries HelloWorld
    
              # OK: jre adds classes.zip, -cp adds class directory
    
    
    
            ## JDK 1.1,  CLASSPATH set
    
            > set CLASSPATH=D:\src\tries
    
            > D:\jdk11\bin\java HelloWorld
    
              # OK: java using CLASSPATH
    
    
    
            > D:\jdk11\bin\jre HelloWorld
    
              # FAILS: jre does not use CLASSPATH (on Windows)
    
    
    
            ## JDK 1.0.2,  CLASSPATH set
    
            > set CLASSPATH=D:\jdk102\lib\classes.zip;D:\src\tries
    
            > D:\jdk102\bin\java HelloWorld 
    
              # OK:
    
    
    
            > set CLASSPATH=D:\jdk102\lib\classes.zip;D:\src\tries
    
            > D:\jdk11\bin\java HelloWorld 
    
              # FAILS: exception in thread NULL - wrong system classes
    
            


    Here's some Solaris examples, assuming the application class is
    /usr/src/com/devjoes/killer/App.class
    and it is in package com.devjoes.killer:
    
    
            # JDK 1.1, no CLASSPATH set
    
            $ /usr/bin/jdk11/bin/jre  -cp /usr/src   com.devjoes.killer.App
    
              # OK:
    
    
    
            $ cd /usr/src/com/devjoes/killer/
    
            $ /usr/bin/jdk11/bin/java App
    
              # fails: class name and path are wrong
    
    
    
            $ CLASSPATH=/usr/src/ 
    
            $ /usr/bin/jdk11/bin/java App
    
              # fails: class name is com.devjoes.killer.App 
    
    
    
            $ /usr/bin/jdk11/bin/java com.devjoes.killer.App 
    
              # OK:
    
            


    Here's some javac examples, for both Solaris and Microsoft Windows, based on the following:
    Source files package Makes the call
    /usr/src/pack/Minimal.java package pack pack.sub.Try.run()
    /usr/src/pack/sub/Try.java package pack.sub (nothing)
    
    
            $ CLASSPATH=""
    
            $ /usr/bin/jdk11/bin/javac /usr/src/pack/sub/Try.java
    
              # OK: works fine
    
    
    
            $ /usr/bin/jdk11/bin/javac /usr/src/pack/Minimal.java
    
              # FAILS: can't find pack.sub.Try
    
    
    
            $ cd /usr/src
    
            $ /usr/bin/jdk10/bin/javac pack/Minimal.java
    
              # OK: finds pack.sub.Try based on . as package root
    
    
    
            $ cd /usr/src/pack
    
            $ CLASSPATH=/usr/src
    
            $ /usr/bin/jdk11/bin/javac Minimal.java
    
              # OK: finds pack.sub.Try based on CLASSPATH
    
            
    Now assume the killer application class
    /usr/src/com/devjoes/killer/FastApp.java
    (in package com.devjoes.killer) uses a third-party package in a jar file
    /usr/jars/JShapes.jar
    but makes no other reference to other classes. The following works fine:
    
    
            $ CLASSPATH=/usr/jars/JShapes.jar
    
            $ cd /usr/src/com/devjoes
    
            $ /usr/bin/jdk11/bin/javac killer/FastApp.java
    
            

    Finally, some applet examples. Many applets only use one class, in the same directory as the html file:
    <applet code=ArcTest.class height=400 width=400>
    
            
    To use classes in subdirectory, use the codebase parameter:
    <applet codebase="mysubdir/" code=ArcTest.class ..
    
            
    To use classes in an archive, use the archive parameter:
    <applet archive="applets.jar" code=ArcTest.class ..
    
            
    See also: JDK 1.1 ReadMe
    Solaris JDK 1.1 tool documentation
    Win32 JDK 1.1 tool documentation

  5. (Sect. 2) How do I do keyboard (interactive) I/O?

    * Interactive I/O in the Java programming language is very poorly supported. Programmers must piece together several library classes in non-obvious ways to get the required functionality. See the answer to Question 7.1.

  6. (Sect. 2) How do I do file I/O in an applet?

    * By default, an applet can read files on the server, but not write them, and has no access to the client. This is for reasons of security. It would be very unsafe to let any old applet that you downloaded from an unknown origin on the Internet read/write your files. It would be as unwise as allowing this kind of access to an ActiveX control (which is one reason ActiveX is dead on the Internet).

    There are several different ways to relax the default rules. See the answer to Question 7.8.

  7. (Sect. 2) How do I do I/O to the serial port on my computer?

    * Java 1.0 and 1.1 do not have a serial port API. There are several commercially-available libraries that supply the needed functionality. JDK 1.2 introduces access to the serial and parallel ports as an extension (optional extra) library. See also the answer to Question 6.3.

  8. (Sect. 2) How do I do formatted I/O like printf and scanf in C/C++?

    * The java.text package introduced with Java 1.1 supports formatted I/O. See also the answer to questions 7.11, 7.12, and 17.7.

  9. (Sect. 2) I have spent more debugging time finding case (upper vs lower) typos than everything else put together and squared!

    * Do not forget that your remark must be phrased in the form of a question to win on FAQ Jeopardy. In any event, it bears repetition that letter case really matters in the Java programming language, and that the names of public classes should exactly match (including case) the names of the files they live in. See also the answer to Question 1.1.2

  10. (Sect. 2) Why do I get this compiler error: "Can't make static reference to method..."?

    * Your code probably looks something like this:

    class myclass {
    
                public static void main(String args[]) {
    
                    myMethod();
    
                }
    
    
    
                public void myMethod() {
    
                    //some code
    
                }
    
            }
    
        

    The issue is this: a static method means it belongs to the class, not each individual object. If you leave the static keyword off (the usual case) as is done here with the method "myMethod()", it means that method can only be invoked on an object. But your call from main() has not told myMethod() which object it is to be invoked on. Inside a non-static method, you don't have to provide this information, as it assumes you mean the same object on which it was invoked. But when calling from a static method, you must provide the information, and you haven't - hence the error message.

    A common fix is to instantiate a member of the class, on which to invoke myMethod(), like this:

    
            public static void main(String args[]) {
    
                myclass m = new myclass();
    
                m.myMethod();
    
            }
    
        

    This problem is especially common when you are writing code that you want to run as an applet and as an application. Naturally, you call init() and start() from main. What you really need to do is:

    
            public static void main(String[] args) {
    
                Applet ma = new myApplet();
    
                ma.init();
    
                ma.start();
    
            }
    
        

  11. (Sect. 2) Why can't I do myArray.length() ? Arrays are just objects, right?

    * Yes, the specification says that arrays are object references [JLS 10.2] just like classes are. You can even invoke the methods of Object such as toString() and hashCode() on an array. However, length is a data item of an array and not a method. So you have to use myArray.length.

  12. (Sect. 2) How do I close a window by using the icon in the upper right hand corner of a window?

    * Create an event handler class to extend WindowAdapter. Then override WindowAdapter's windowClosing() to do the actions you want when a window's "close" action is clicked. Then add that to the listeners for that window.

    
    import java.awt.*;
    
    import java.awt.event.*;
    
    
    
    public class MyFrame extends Frame {
    
        public MyFrame(String s) {super(s);}
    
    
    
        public class WL extends WindowAdapter {
    
            public void windowClosing(WindowEvent e) {System.exit(0);}
    
        }
    
    
    
        // do your other Frame stuff
    
    
    
    }
    
        

    Somewhere in your initialization code, put:

    
            f1.addWindowListener( f1. new WL()  );
    
        

    This last syntax is not commonly known to many people yet, it's another wacky artifact of inner classes.

    Alternatively, combining the inner class and setting the handler in one go, you could do this:

    
            MyFrame f1 = new f("wave");
    
    
    
            f1.addWindowListener( new WindowAdapter() {
    
                public void windowClosing(WindowEvent e) {
    
                    // and/or setVisible(false) and/or dispose()
    
                    System.exit(0); }
    
            });
    
        

    See also the answer to questions 1.0.19, 1.0.30 and 19.7.

  13. (Sect. 2) Why is b+=100; OK, but b = b+100; fails to compile?

    * You have code like this

    
      byte b = 0;
    
      Incompatible type for =. Explicit cast needed to convert int to byte.
    
      b = b + 100;    // compiler error message
    
        ^
    
      b += 100;       // works OK
    
    

    The reason is "promotion". Arithmetic expressions are promoted to the type of the longest, floatiest operand in them, or at least to int. The first statement involves the assignment of an expression. The expression is promoted to 32 bits, and must be cast back down to 8 bits, like this "b = (byte) (b+100);". The second is an operator assignment, and the cast back to byte takes place automatically. The Java Specification says:

    The compile-time narrowing of constants means that code such as:

    byte theAnswer = 42;
    is allowed, with no cast necessary. [JLS 5.2]

  14. (Sect. 2) How do I add two Float objects together?

    * You want to write code like this

    
            Float One;
    
            Float Two;
    
            Float Hard = One + Two;
    
        

    but the compiler does not allow it.

    The Java programming language has two separate ways of representing a 32 bit floating point number, Float and float. The difference in letter case is significant. Float is a class, that whose sole purpose is to "wrap" a floating point number so it can be treated as an object. The class does not support floating point arithmetic, because the performance would be too slow. float is a primitive type (like int) that is used for floating point arithmetic.

    You choose one or the other depending on your predominant use. If all you need of your floating point numbers is arithmetic, declare them to be "float". If you need to use them as objects, for example to place them in a Vector, declare them as "Float".

    If you need both, tough. You have to declare them one way and convert whenever you need the capabilities of the other. Your specific code can be written as:

    
            Float One = new Float(1.0);
    
            Float Two = new Float(2.0);
    
            Float Hard = new Float(One.floatValue() + Two.floatValue());
    
        

    See also questions 6.n , 5.1, and 10.1.

  15. (Sect. 2) How can I put all my classes and resources into one file and run it?

    * Use a JAR file. Put all the files in a JAR, then run the app like this:

    
            java -jar [-options] jarfile [args...]
    
        

  16. (Sect. 2) How can I see line numbers in a stack trace using JDK 1.1.6?

    * From JDK 1.1.5 on (i.e. JDK 1.1.6, JDK 1.2) the stack trace of an uncaught exception no longer has source code line numbers. It only says "(Compiled Code)".

    To see the line numbers where your program throws an exception, use the command line argument in JDK 1.2:

    
         java -Djava.compiler=NONE myapp
    
    or
         java -nojit  myapp
    or
         java -Xint   myapp
    


    Please support Portability.

    The biggest value of Java technology is its portability.

    Software portability is very much in the interest of most software developers and customers. Even if you only use Microsoft Windows 95, portability matters to you. If your software was all written in Java, it would all just run when you moved from MS-DOS to Windows 3.1 to Windows 95 to Windows 98 to Windows NT, and even on Windows CE. Instead, you typically need to buy new applications software all over again when Windows changes.

    Mac-Specific

  17. (Sect. 2) Where can I get more info on Java for the Mac?

    * The Apple site is the place to start. See http://www.apple.com/java/ .

    Apple computers (since MacOS 8) come with the runtime component of Java, i.e. the JVM and class libraries. Instead of calling it the JRE or even "the JVM and class libraries", Apple introduces a lot of unnecessary confusion by calling it "MRJ" (Macintosh Runtime for Java). You can download the latest MRJ from http://asu.info.apple.com/swupdates.nsf/artnum/n11572

    But to compile Java code on your Mac, you will also need to download and install the Java compiler (the JDK) for your Mac. Apple seem to hide their Java compiler on their site. Worse still, Apple chose to call their version of the JDK by the name "MRJ SDK". Obviously people confuse this with the straight MRJ, and they are not sure what the MRJ is in the first place. You can download the latest MRJ SDK from http://developer.apple.com/java/text/download.html#sdk
    MRJ SDK 2.2 is essentially JDK 1.1.8.
    Apple has announced that it will introduce Java 2 support with MacOS X. It's going to be great!

    An alternative to the free Apple JDK (known as MRJ SDK) is the shareware ($15) MacJikes compiler (a good compiler written in C++) at http://www.stg.com/employees/sbytnar/projects/MacJikes/
    Another alternative is the Codewarrior product "Discover Programming for the Macintosh" which includes the compiler, and some online books and tutorials. It retails at $79, but is available a bit cheaper if you look.

    The Apple Developer Java site with many links is at http://developer.apple.com/java/index.html

    There's a not-very-good tutorial on developing Java for the Mac at (lengthy URL at developer.apple.com)
    There is another Java on the Mac tutorial with info about Mac specific things (like changing icons - these are determined by a set of Mac resources that are bundled with the app at creation) at http://developer.apple.com/java/javatutorial/index.html

  18. Where is the MRJFAQ?

    * There is a great Mac-specific Java FAQ at: http://www.outlawcafe.org/MRJ-FAQ/

  19. How do I execute Java programs on the Mac?

    * MacOS does not provide a command line interface, so you have to make your application "double-clickable". The Apple JBindery tool which comes with the Apple SDK enables this. Information about JBindery is at: http://devworld.apple.com/java/javatutorial/doubleclick.html There is an add-on product called MPW that provides a command line interface, and which can be downloaded from the developer part of the Apple site.

  20. What version of Java is in Netscape for the Mac?

    * Mac Netscape (April 2000) has only a partial implementation of 1.1.5. So lots of later things don't work. There's a plugin that lets Mac Netscape users use Apple's MRJ; it requires using an "embed" tag. That takes you to JDK 1.1.8.

    The Mozilla team is, reportedly, also working on getting Mozilla to use MRJ. No info on their release schedule.

    Your Mac browser choices are to:
    1) Write 1.0 code
    2) Write 1.1.x code and write an HTML script that checks for Mac Netscape and uses the "embed" tag, and handles the error condition where the user doesn't have the plugin, or that tells people to run it with Apple Applet Runner or another browser.

  21. When will the Mac get Java 2?

    * Apple announced at Macworld in January 2000, that MacOS X will have Java 2. See JavaWorld's article

    MacOS X is planned to ship summer 2000, so it will be out by Dec 2000. Apple will decide whether to ship MacOS with Java 1.2.2, or take the schedule hit and switch to the more current (and feature rich) Java 1.3.


    Windows-Specific

  22. Is there a Java technology implementation for Windows 3.1?

    * Yes. See Question 1.6 It's not that great though because Windows 3.1 has inadequate features to support great software.

  23. (Sect. 2) I'm using Win95, and my DOS window won't accept filenames longer than 8.3.
    "This program cannot be run in DOS mode"

    * Both these problems are resolved by the same process. Assuming you're running the Win95/98 command.com, then you've changed the MS-DOS Prompt options under the "Properties" menu item. In the Properties dialog, Program->Advanced gets you a dialog. Here, make sure the "Prevent MS-DOS-based programs from detecting Windows" checkbox is UNCHECKED.

    If the option is checked you get exactly the kind of behavior you're seeing. The option is unchecked by default, so it must have been selected at some time in the past. Change it back to unchecked.

  24. (Sect. 2) I'm using Notepad to edit my files, and how can I save them with the extension ".java"? Also, in notepad some source files have all the characters on one line. Why is that?

    * First answer: put the entire filename in quotes in the save dialog. Once you have created your first source file, double click on it in Explorer, select "Notepad" from the "Open with" box, and Notepad will stop adding the spurious ".txt" to your .java files.

    Second answer: Notepad expects to see a "carriage return/line feed" pair at the end of each line, rather than just the "newline" (line-feed) commonly used on Unix. Use this program to expand all newlines,

    /*
    
     * Usage: jre crlf file1.java file2.java ... fileN.java
    
      */
    
    
    
    import java.io.*;
    
    class crlf {
    
        public static void main(String s[]){
    
            byte b[]; byte p;
    
            FileInputStream is;
    
            BufferedOutputStream os;
    
            File f;
    
            for (int i=0; i < s.length;i++){
    
                try{
    
                    f=new File(s[i]);
    
                    b=new byte[(int)f.length()];
    
                    is = new FileInputStream(f);
    
                    is.read(b); is.close();
    
                    os = new BufferedOutputStream(
    
                    new FileOutputStream(s[i]),b.length);
    
                    p='?';
    
                    for(int j=0; j < b.length; j++){
    
                        if((p!='\r')&&(b[j]=='\n')) os.write('\r');
    
                        p=b[j]; os.write(p);
    
                    }
    
                    os.flush(); os.close();
    
                }catch(IOException e){
    
                    System.err.println(e.toString());
    
                }
    
            }
    
        }
    
    }
    
        
    The source code is to show new users a way to make a simple program which can read a file and write it out buffered.

    Compile with "javac crlf.java" and run with
    java crlf outfile.txt
    or just use Wordpad instead of Notepad. Wordpad is under Start->Programs->Accessories->WordPad

  25. (Sect. 2) How do I fix the message about "out of environment space"?

    * This occurs under Windows when you have long CLASSPATH names. You need to increase the environment space. On Windows 95,8 put this in your c:\windows\system.ini

    
            [NonWindowsApp]
    
            CommandEnvSize=4096
    
        
    On NT you can right-click on My Computer, select System Properties then go to the Environment tab and then increase COMSPEC to the value you want.

    The previous suggestion to put this in your config.sys:

    
            shell=command /e:4096
    
        
    apparently causes you to create two copies of command.com which wastes memory.


3. General Information

  1. (Sect. 3) Is Java technology "Open" or "Proprietary"?

    * The specifications are publicly available, and anyone is free to do clean-room implementations of the JVM and core Java API's. Sun includes a perpetual, irrevocable, free and royalty-free license in the front of the Addison-Wesley books containing the specification.

    Sun also provides free access to the Java technology source code. See http://java.sun.com/communitysource/

    Using the Java trademark does requires licensing from Sun. It is not clear if the Embedded or Personal Java specifications are open, as it is not clear if a clean-room implementation may be done without licensing from Sun.

    The relative openness of Java technology contrasts with systems that are only available from one vendor, whose interfaces are developed in secret, without an open process for others to participate, whose owners do not allow competing implementations of the same API, and whose owners change the APIs as a strategic weapon against competitors. Typically, such systems also feature "private" APIs that are published late or not published at all, to allow the single vendor to gain a competitive advantage for their other products. Typically such proprietary systems do not make the source code available for inspection by all.

  2. (Sect. 3) What is the best way to refer someone to the FAQ when they ask a question I know is answered there?

    * The Java Programmers FAQ (at http://www.afu.com/) answers your question in section N.n. ...

    This gives them the answer, and shows them where to go for future questions. It also demonstrates that the FAQ can answer their questions, supplying an incentive to go there next time. It's regarded as elementary politeness to look for the FAQ of a newsgroup and read it before posting any questions.

    In general, FAQs for any newsgroup are available by looking at past postings in a group, or by searching Deja News (see Q 1.4), or via anonymous FTP at directories under ftp://rtfm.mit.edu. The pathnames are called things like /pub/usenet-by-group/comp.lang.java.programmer/Java_Programmers_FAQ which may help you get to the right one directly, as it takes some time to get a directory listing there. Alternatively, you can look for newsgroup names on the same ftp site by going to the same site and looking under /pub/usenet-by-hierarchy/. That has subdirectories such as alt/, ba/, ca/, comp/, and subdirectories under them such as /pub/usenet-by-hierarchy/comp/lang/ and so on. This helps you explore the world of newsgroups with FAQs.

    If you do not have anonymous FTP access, you can access the rtfm.mit.edu archives by mail server as well. Send an E-mail message to mail-server@rtfm.mit.edu with "help" in the body for more information. "RTFM" stands for "Read The effing Manual" - you must expect to put in some time and effort to master a new area of study.

    If you want to look at the definition of Internet standards like FTP, telnet, visit the IETF site at http://www.ietf.org/ where all the RFC's (Request For Comments) can be found.

  3. (Sect. 3) What if my question is not answered in this FAQ?

    * Go to http://www.dejanews.com/home_ps.shtml
    In May 1999, Dejanews changed their name to Deja.com, and their web design to a truly horrible garish interface, covered with ads and harder to search. Consider using these search sites instead:
    http://www.exit109.com/~jeremy/news/deja.html
    http://www.dogpile.com/
    http://www.google.com
    http://www.hotbot.com/
    http://www.mamma.com

    The chances are that you will find several answers to your question. Some may not be complete or completely accurate however. That is the nature of Usenet, and free information. If you still don't have an answer, then post your question on the most appropriate of the newsgroups. Don't spam the newsgroups by posting to multiple groups. Knowledgeable posters tend to ignore questions like that.

    Also look at http://sunsite.unc.edu/java/cgi-bin/query
    and look at http://asknpac.npac.syr.edu/ for a Java newsgroup search.

    http://www.javaworld.com/search.html can search the Javaworld newspaper.

  4. (Sect. 3) What mailing lists are there?

    * There are quite a few Java technology mailing lists. http://java.miningco.com/msub7.htm has a comprehensive list of lists.

  5. (Sect. 3) Where can I look at the definitive Java Language Specification?

    * This is available online at: http://java.sun.com/docs/books/jls/index.html
    and the Java technology API is at:

    It is also available as a book in printed form (details at website). Also see the "Clarifications and Amendments" http://java.sun.com/docs/books/jls/clarify.html.

    You can also see the virtual machine (execution environment) specification at http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html

  6. (Sect. 3) Where can I find information about future APIs?

    * The Java Software Division of Sun Microsystems has followed a policy of creating new APIs in consultation with leading industry participants, then posting the draft specification for public review and comments. Check the roadmap of new APIs and products at http://java.sun.com:80/products/api-overview/index.html
    Also, some APIs that are under consideration, possibly for JDK 1.2 are at:

  7. (Sect. 3) I'm looking for a style guide on naming conventions.

    * Check out the section "Naming Conventions" in the language specification

    See Sun's Java Code Conventions:

    Also take a look at Doug Lea's draft coding standard -

    See also naming conventions for some basic rules of thumb.

  8. (Sect. 3) How do I check on known bugs in the JDK?

    * Look at the Java Developer ConnectionSM at http://java.sun.com/jdc/.

    All the Java bugs that Sun knows about are listed there, with the exception of security-related bugs. After you have checked that the bug is not already listed, you can submit a bug report through:
    http://java.sun.com:80/cgi-bin/bugreport.cgi
    You should check that the bug doesn't already exist for two reasons: first, you might find the bug with a workaround listed. Second, you don't want to waste everyone's time with a duplicate bug report.

    You can also send in an RFE (Request For Enhancement) or ease-of-use issue there. You can even vote on the priority you would assign to a particular bug fix! Join the Java Developer ConnectionTM (it's free) by going to http://java.sun.com/jdc/. Then browse http://developer.javasoft.com/developer/bugParade/#votes

  9. (Sect. 3) What computers have Java technology-enabled ports? Is there a port to Win 3.1?

    * A partial list of JDK ports is available from http://java.sun.com/cgi-bin/java-ports.cgi
    An (impressive) list of the systems that the GPL Kaffe JVM runs on is at http://www.transvirtual.com/ports.html

    A list of the software updates you should install to run Java on Solaris is at http://java.sun.com/products/jdk/1.2/install-solaris-patches.html#2.6

    There are several ports to Win 3.1. IBM's ADK1.02 is available at the following location:

    IBM offers a port to Linux, as do others. The IBM Jikes port is at http://www.alphaworks.ibm.com/ There is a large amount of useful software there, including a profiling tool called jinsight.

    Netscape Navigator for Win3.1 has support. Java technology will never be well-supported under Win3.1 because Win3.1 lacks the basic features expected of a modern OS (primarily lengthy filenames and multithreading support).

    Also take a look at Sun's JavaPC kit that can switch a PC into a thin client Java technology-enabled system (and back to Win3.1/DOS when you want). It's meant for software OEMs and large corporations running lots of older PCs, but you can use it on the latest Pentium II too. Details are at http://java.sun.com/products/javapc/index.html. JavaPC is available now for $100, runs on 486's with 8Mb or more Unlike the 16-bit versions of Netscape Navigator and Microsoft Internet Explorer, which provide a Java Virtual Machine that is only compliant with the JDK 1.0.2 API, the JavaPC software allows IS managers to deploy JDK 1.1-compatible Java applications on PCs running DOS and Windows 3.x.

  10. (Sect. 3) Where can I find information on Java 3DTM?

    * The Java 3DTM FAQ at http://www.j3d.org/faq/ may have the answers you're looking for. It contains general information about Java 3D, as well as programming tips.

  11. (Sect. 3) Where can I find information about Java Certification?

    * Sun is sponsoring an examination which programmers worldwide can take. Those passing can use the designation "Sun Certified Java Programmer". There is also a second-level test, involving writing a program to spec, and taking a further test. That results in the qualification "Sun Certified Java Developer". You can find out all about the exam at:

    and then search for "sun certified java". It costs $150 to sit the Java Programmer exam. It is not trivial to pass the Java certification exam. It requires understanding the objectives of the test, and the material that is tested for. These are given, along with sample questions, at the URL mentioned above.

    There is a Java certification FAQ at: http://www.marcusgreen.co.uk/

  12. (Sect. 3) How can I find links to recent news?

    *
    A good Java technology news source is http://www.nikos.com/javatoys.

    This site is a fine site for programmers who want to be well-informed about computer industry topics. It has a lot of coverage of Linux as well as more general news. http://slashdot.org/

    This site is a source of independent news and commentary on the computer industry, including Java. http://www.pjprimer.com/media.html. You have to subscribe ($10/year, 30 day free trial).

  13. (Sect. 3) What are Open Source initiatives with Java technology?

    * First note that the URLs in this section change quickly, and soon become outdated. If you have an update, send it in. There is a Gnu Java technology page at http://www.gnu.org/software/java/java.html
    Guava (a GPL'd Java compiler) can be found by a websearch.
    Work is progressing on the Cygnus Java technology frontend to gcc. See http://sourceware.cygnus.com/java/

    The LaTTe virtual machine has been released. It is a freely available JIT virtual machine intended to execute Java classes. It can be obtained from http://latte.snu.ac.kr/.

    Kaffe (another JVM) can be found at

    Classpath is a free implementation of Sun's core Java programming language libraries (v1.1), being developed for the GNU Project ( http://www.gnu.org). Information regarding classpath is at http://www.classpath.org/ They aim to develop a 100% free drop in replacement for Sun's class libraries, targeting first the Japhar JVM (below). They are always looking for help, so feel free to stop by and volunteer.

    See also http://www.japhar.org/ This is the Hungry Programmer's JVM. Currently it is development grade only.

  14. (Sect. 3) What is "San Francisco"?

    * San Francisco is the code name for a very large Java technology project led by IBM, and involving other companies. The project is to provide a Java framework for data processing applications. A large number of classes are provided for general ledger, sales order, inventory management, etc., and these classes can be extended and customized for particular industries (vertical markets). It is a large and ambitious software project.

    IBM's SF project competes with products from companies like SAP and Baan. Of course, the SF project is multi-platform and uses Java beans and GUI interfaces. More information on SF is available at http://www.ibm.com/Java/Sanfrancisco/

  15. (Sect. 3) What large Office-style or other applications have been written in Java technology?

    * Well, the first one to consider is IBM's San Francisco project, mentioned above.

    Another office suite written in the Java programming language is Applix Anyware at http://www.applix.com/anyware/index.htm. Applix became available in downloadable demo form in April 1998.

    Yet another is Star Division's Client/Server Office. It is an office suite with the client part written in the Java language and able to run on JavaStations. The server part will run on Solaris, NT, OS/390, and AS/400. The older (non-Java technology) version is bundled with all Sun workstations sold in Germany. The Linux version is freely downloadable from http://www.stardivision.com/.

    Another is Digital Harbor's Wav word processor. It supports component software, and it runs in 1MB, not the 114Mb of the latest MS Word. A free trial is available. See: http://www.digitalharbor.com/

    Another Java technology application is Formula One for Java, an Excel-compatible spreadsheet written in 100% pure Java, and available for all systems. It runs as a JavaBean, so can easily be assembled as one component of a larger system. It also runs as an application, and as an applet! Formula One is a product of Visual Components, Inc. See http://www.f1j.com/.

    Another one is Ncode Research Inc. who write viewers for office suites. They are file-format specialists. Their mission is to make all popular file formats available for the Java platform. They write 100% Pure Java viewers for Word, Excel and PowerPoint (including Office 95 and 97 formats). See http://www.ncode.com/
    Another company operating in the same space is JSoft, at http://www.jsoftinc.com/

    Intentia, the 8th largest ERP vendor (annual sales of $320 million), has moved their entire suite of applications (Movex - covering 8 markets) from RPG to the Java programming language - 20 million lines worth. See their press release.

    However, the industry is seeing few new office productivity applications written in any language. The niche for single-user office productivity applications is already dominated by Microsoft products, and it is unrealistic to think that software will unseat shrink-wrapped software simply because it is written in the Java programming language. This is why Corel replanned its Java rewrite of Corel Office before taking it to FCS. When Corel did that, it also increased its investment in Java technology from 33% of R&D budget to 50%, at the expense of Microsoft Windows. This is also why Lotus's e-suite - a suite of applets and components including a spreadsheet and a word processor - was dropped in September 1999.

    Most development in Java is taking place for custom applications internal to a company. Most programmers of any kind have never worked on MS Office, but work on internal applications, and so it is with Java technology. These projects don't have the high profile of major vendors' products, but they are the mainstay of the industry. A number of companies are working on beans, like http://www.quadbase.com/ who have graphing software (see also GraphMaker mentioned later in this document). EspressChart is a JavaBean that gives you the ability to add 2D and 3D graphs in your applications/applets. This bean is easy to use, runs anywhere, and meets the 100% Pure Java certification standards.

    There are some excellent games applets at http://www.microprizes.com http://www.gameplay.com/webgames
    http://www.javagame.net/
    http://www.javaarcade.com/ Check out the pinball -- dig that crazy rhythm, man.
    There are more good Java technology-enabled games applets at http://www.frontiernet.net/~imaging/java_games.html
    and at http://www.gamesdomain.co.uk/GamesArena/
    If you want to use Java technology to learn math & computer graphics, visit http://www.frontiernet.net/~imaging/math_is_a_game.html

    ObjectDesign Inc., has an ODBMS written in 100% Pure Java. The product is named PSE Pro for Java. See http://www.objectdesign.com/
    Another database written in Java is available from http://www.cloudscape.com/.
    Another database written in Java is available from http://www.instantdb.co.uk/. InstantDB is available free to non-commercial organizations, and is very well documented and maintained. (Recommended!)
    Finally, note that Sun's Java compiler is written in the Java programming language. This is a really big application in widespread use on millions of platforms. The compile command "javac test.java" is equivalent to

    
        java sun.tools.javac.Main test.java
    
        
    javac has a script wrapper just to set the heap size as a command line argument, as you can do in your own programs.

  16. (Sect 3.) What User Groups are there?

    * There are scores of Java Technology User groups around the world, mostly in urban areas, and centers of software technology development. A partial list with contact information can be found at http://sunsite.unc.edu/javafaq/usergroups.html.

    If you can't find a user group in your area/school, it's easy and satisfying to start one.

  17. (Sect 3.) What is a Java Bean?

    * A JavaBean is a Java class that follows some simple conventions including conventions on the names of certain methods to get and set state. Because it follows conventions, it can easily be processed by a software tool that connects Beans together at runtime. JavaBeans are reusable software components.

    Think of JavaBeans as being the software equivalent of Lego[tm] bricks. Instead of plugging together plastic bricks, you can easily plug together classes, and have them fit and work with each other. See http://www.jc100.org/
    See the JavaBean FAQ at http://java.sun.com/beans/faq/faq.general.html

    Note that some people have reported the BDK 1.1 demo's don't work on Windows. This problem has been tracked down to a problem when the bdk is installed into a directory with spaces in the name like "program files".

    Try reinstalling using a path containing no spaces if this is the case for your installation.

  18. (Sect 3.) What is a Servlet?

    * A Java Servlet is some code behind a URL, similar to CGI. When you browse the URL, it invokes the Java servlet code. A servlet typically does stuff like read/write a database, and then spits out HTML to send back to the browser.

  19. (Sect 3.) What is a JSP?

    * A Java Server Page (JSP) is some code behind a URL, similar to an open version of Microsoft's "Active Server Pages" (ASP).^M

    When you browse the URL, it dynamically generates Java source, compiles and invokes it on the fly to generate the HTML which is sent back to the browser.

    JSP files use the servlet framework and invoke Java beans. See http://www.klomp.org/gnujsp/ for the GNUJsp open source project, a free JSP implementation.

  20. (Sect 3.) Where can I find examples of the use of the Java class libraries?

    * The two volumes of "Java Class Libraries" by Chan, Lee and Krama published by Addison Wesley, have extensive examples of how to use the standard libraries. One programmer comments "When I need to use an unfamiliar area of the class libraries one of the first things I do is read their examples." You can see them online at http://java.sun.com/docs/books/chanlee/second_edition/vol1/examples.html and http://java.sun.com/docs/books/chanlee/second_edition/examples.html

  21. (Sect 3.) How can I find out exactly what version I have on my system?

    * On a Solaris system, you can use the pkginfo command, like this:

    
       pkginfo -l SUNWjvrt
    
    
    It will give a reply like this:
    
       PKGINST:  SUNWjvrt
    
          NAME:  JavaVM run time environment
    
      CATEGORY:  system
    
          ARCH:  sparc
    
       VERSION:  1.1.6,REV=1998.07.30.16.21
    
       BASEDIR:  /
    
        VENDOR:  Sun Microsystems, Inc.
    
     ...etc
    
    
    You may also try
    
       java -fullversion
    
    
    Although that's not an officially-supported command option, and has gone away in JDK 1.2. Try also
    
       java -version
    
    

  22. (Sect 3.) What newsgroups are there?

    * There are these Java technology newsgroups:

         
         comp.lang.java.beans
    
         comp.lang.java.corba
    
         comp.lang.java.databases
    
         comp.lang.java.gui
    
         comp.lang.java.help (it renamed comp.lang.java.setup)
    
         comp.lang.java.machine (it renamed comp.lang.java.tech)
    
         comp.lang.java.programmer (it renamed c.l.j.api and c.l.j.misc)
    
         comp.lang.java.advocacy (argue all day with anonymous shills)
    
         comp.lang.java.softwaretools
    
         alt.comp.lang.java-games
    
    
    New Java newsgroups are added every so often. Try not to crosspost.


Go to the Index