Newsgroups: comp.lang.java.programmer,comp.lang.java.help, comp.lang.java.gui,comp.answers,news.answers
Approved: news-answers-request@MIT.EDU
Subject: Java Programmers FAQ
Followup-To: poster
Summary: This posting answers frequently-asked questions by Java programmers
Supersedes: <6l4gts$psh$1@shell15.ba.best.com>

Archive-name: computer-lang/java/programmers/faq
Posting-Frequency: weekly
Last-modified: 1998/6/11
URL: http://www.afu.com/javafaq.html
Copyright: (c) 1997,1998 Peter van der Linden
Maintainer: Peter van der Linden

Frequently Asked Questions (with answers) for Java programmers

           _____________________________________________________
  ________|                                                     |________
  \       |   Java Programmers FAQ        http://www.afu.com    |       /
   \      |      Copyright (c) 1997-98 Peter van der Linden     |      /
   /      |_____________________________________________________|      \
  /___________)                                              (__________\

The Java FAQs here are intended for people who already have some programming experience, though maybe not in Java.

Go to the FAQ home page at http://www.afu.com for other Java information and downloads, and the most up-to-date copy of the FAQ. Report FAQ updates to faqme at the address afu.com.


Please support Java Portability.

The biggest value of Java is its portability.

Microsoft's strategic objective: "Kill cross-platform Java"
Microsoft does not want users to easily move software to different platforms and is actively trying to undermine Java. The Department of Justice's lawsuit quoted a Microsoft memo describing the strategic objective to "kill cross-platform Java by grow[ing] the polluted Java market". See http://www.usdoj.gov/atr/cases/f1700/1762.htm.
Microsoft is being sued because of unauthorized changes it made Java. A Federal judge issued a preliminary injunction against Microsoft in March 1998, prohibiting them from labelling their incompatible J++ product as Java.

Speak to your management chain -- how comfortable do they feel using a Microsoft product that is embroiled in a legal dispute, that introduces deliberate incompatibilities, and whose stated goal is to lock you in to one platform? It is a safer choice to get standard Java from any other source than Microsoft. You can use these facts to move your company to standard Java.

The best way for programmers to support portable Java is to reject "polluted" non-standard tools from the only company pushing them: Microsoft. As a Java programmer please join the Java Lobby, an independent organization dedicated to representing non-vendor interests in Java. It's free, and you can sign up by visiting http://www.javalobby.org for details. Other ways to encourage portable java:

Free standard Java compilers and Java Plug-In can be downloaded from http://java.sun.com.
Free standard Java Virtual Machines can be downloaded from http://www.kaffe.org. and http://www.oryxsoft.com/projects/gvm and http://www.redhat.com/linux-info/jolt
Free Java AWT software can be downloaded from http://www.biss-net.com/biss-awt.html and the files are all at ftp.java-linux.org (the linux site) too.
Free Java software can be downloaded from http://www.gnu.org/software/java/java.html

Just for the record, the May 1998 Federal case against Microsoft has nothing to do with innovation, or product design. Microsoft is charged with

Many people think that contracts prohibiting the distribution of a third party's products are somewhat sleazy. Such contracts are also in restraint of competition and illegal when used by a monopoly. This is why Microsoft is facing mounting legal problems in the United States, in Japan, in Brazil, and in the European Union.


0. A WORD FROM OUR SPONSOR


1. LOOKING FOR INFORMATION


2. COMPILERS, ETC.


3. LANGUAGE ISSUES



4. AWT and Related Topics

5. CORE LIBRARIES
6. I/O
7. NETWORKING & DISTRIBUTED OBJECTS
8. MULTI-MEDIA
9. SECURITY
10. Java IDIOMS
11. FOR C and C++ AFFICIONADOS
12. FURTHER RESOURCES
13. MOST COMMON JAVA NOVICE PROBLEMS
14. FOR WINDOWS USERS
15. Java GOTCHA'S

-------------------------------------------------------------------------

0. A WORD FROM OUR SPONSOR

Learning Java

This Java FAQ is maintained as a service to the Java community. Please consider these books from the FAQ author when you are looking for a programming text.

Sample chapters are on Sun Microsystems webpage at http://www.sun.com/971124/cover-linden/.


1. Looking For Information


2. COMPILERS, ETC.


3.LANGUAGE ISSUES

T.java:96: Can't access protected method clone in 
class java.lang.Object.  OtherT is not a subclass of 
the current class.


4.AWT and Related Topics

4.1 APPLETS

4.2BROWSERS

4.3 SWING


5.CORE LIBRARIES


6. I/O

//class that opens the printer as a file and writes "Hello World" to it
import java.io.*;
public class lpt {
    public static void main (String[] argv) {
        try {
                FileOutputStream os = new FileOutputStream("LPT1");
                            //wrap stream in "friendly" PrintStream
                PrintStream ps = new PrintStream(os);

                            //print text here
                ps.println("Hello world!");

                            //form feed -- this is important
                            //Without the form feed, the text
                            //will simply sit in the print
                            //buffer until something else
                            //gets printed.
                ps.print("\f");
                            //flush buffer and close
                ps.close();
          } catch (Exception e) {
                System.out.println("Exception occurred: " + e);
          }
     }
}

7.NETWORKING & DISTRIBUTED OBJECTS

8.MULTI-MEDIA

9.SECURITY

10.Java IDIOMS


11.FOR C and C++ AFFICIONADOS


12.FURTHER RESOURCES



13. MOST COMMON JAVA NOVICE PROBLEMS



14. FOR WINDOWS USERS



15. Java GOTCHA'S

http://www.javasoft.com/products/jdk/1.1/docs/guide/serialization/spec/serial-arch.doc.html#4176


Acknowledgements

FAQ copyright 1997, 1998 by Peter van der Linden. Contributions and help from:

Matt Kennel, Patric Jonsson, Brad Van Tighem, Tony Hursh , Glenn L Vanderburg, Peter Jones, John McDowall, Jim Driscoll, Uday, Dave Harris, Bill Wilkinson, Tom Valesky, Dan Drake, Giles Thomas, Mitch Baltuch, Guy Ruth Hammond, Gordon Keith, Jason Brome, Shani Kerr, Steve Chapel, Timothy Wolters, Robert Lynch, Jake Cormier, Sean C Sullivan, Joseph A. Millar, Jim Frost, Jim Balter, Jeff Bauer, John Kochmar, Carl Burke, William Stubbs, Mark Smith, Volker Turau, Real Gagnon, Russell Gold, Max Hailperin, Bill Tschumy, Marco Nijdam, Marc Pawlowsky, Laurence Vanhelsuwe,Ian Macgregor, Mike Faulkner, Rich Koch, Will Clark, Govind Seshadri, Rich Simkin, Ian Stiles, Kieren, Darren Christie, Tom Lane, Michael Jungmann, Rob Mayoff, George Ruban, Tom McCann, David Hopwood, Thomas Phan, Kai Stuke, Rolf Howarth, Derek Snider, David Boydston, Andy Godwin, John F. Dumas, Doug Bell, David J. Biesack, Tiger Quimpo, Martin Hugh Rogers, Brian Krahmer, Ian Burrell, Nikki Locke, Bin Li, Jackson Thompson, Steve Odendahl, Greg Smith, Jeffrey C. Ollie, Mark Halvin, Jeremy Cook, Lak Ming Lam, Peter S. Morris, Mark Halvin, Juergen Keil, Alex Stewart, Mike Abney, Rodney Stephenson Mark Gritter, Satish Talim, Tamminen Eero, Alexander Gridnev, Eric Hodges, Jamey Graham, Will Lockhart, Scott Plante, Tom Sanfilippo, Jan Newmarch, Sean Breslin, Stuart D. Gathman, rhino@wwdc.com, C Matthew Curtin, Tor Iver Wilhelmsen, A.N.Pryke, Phil Race, David Holmes, David Rodal, Dominique Plante, Trent Jarvi, Ingrid Biery, Gopal Unni Krishnan, Grant Lewis, Tov Are Jacobsen, Gary McGath, Marty Hall, Will Forster, Colin Mummery, Darin McBride, Mayank Shah, Jens Alfke, Glen Stampoultzis, Philip Brown, Peter Steiner, Kurt Spaugh, Rasmus Ekman, Jonathan Revusky, Ken Kalish, Dave Sanders, Bill Hyden, James Cloughley, Philip "diodes" Gustafson, Paul Kinnucan, Juan Valdéz, Antranig Basman, Felix Pahl, David N. Still, Simon Arthur, Mark Hammond, Dan Kegel, Thomas Weidenfeller, Pavel Shvartsman, Christen Monberg, George Reese, Ian Macgregor, John Sublett, David Zimmerman, Tony Dahlman, Druid, Chris Kelly, Patricia Shanahan, Paul Hill, Lyne Lamoureux, Don Kennedy, Alec Muffett, Andrew Mickish, Pavel Shvartsman, Neil of Parkway Consultants, Chris Thiessen, David Michaels, Bob Sutherland, Michael Allen Latta


I am maintaining a FAQ list to address specifically programming issues
(not a general tutorial on Java). Please mail suggested FAQ entries including answer to me at pvdl on the site best.com.
Question with answer gets you a credit in the FAQ.
Peter van der Linden, Sun Certified Java Programmer.

-- end --