hide random home http://java.sun.com/faq2.html (Einblicke ins Internet, 10/1995)



Frequently Asked Questions

Note: This FAQ provides answers to the more frequently asked questions about Java and HotJava. You will find more complete information on many of these questions by following the links on the HotJava home page (http://java.sun.com).

Error Messages

General Information

The HotJava Browser

Note: Another good source of information on the browser is the HotJava User's Guide.

The Java Language

Error Messages



General Information

Who is that little guy with the red nose on some of your Web pages?
That is Duke, the HotJava mascot. He's very good at demonstrating executable content. He is not a penguin, he is not a tooth, he is ... just Duke. His hobby is surfing. He was designed by an artist named Joe Palrang.

What are HotJava and Java?
HotJava is a a World-Wide Web browser than can execute applets, programs written in the Java programming language and included (like images) in HTML pages. Java is the programming language that makes HotJava possible. It is an object-oriented programming language optimized for the creation of distributed, executable applications. Because Java is compiled into machine independent bytecodes, applications written in Java can migrate transparently over the Internet accessible by anyone using the HotJava browser.

What stage of development are they in?
Sun has done a technology release of alpha versions of the software. Future releases are targeted to include a redesign of the browser UI, a WYSIWYG HTML editor and modifications to the abstract window toolkit, among other enhancements.

What is the distribution model?
The HotJava/Java binaries (runtime) are distributed freely. Licensing fees may apply to redistribution for commercial purposes. See Copyright and License Information.

What OS/hardware configurations are currently supported?
Two alpha versions are available. One is for SPARC-based Solaris machines, and the other is for Microsoft Windows NT. See the Releases section of our home page for details.

Didn't the browser used to be called WebRunner? Wasn't the language called Oak at one time?
Yes. Those were working titles.

The HotJava Browser

Why do I sometimes get a red box when I try to fetch an image?
HotJava starts up with a default heap size of 3 MB. If you are fetching a lot of images, or very large images, it will eventually run out of memory. If you restart HotJava, you will be able to view most of the images. Really large ones still may not display. You can also start HotJava using a larger heap size, if this is something you are familiar with.

How do I stop fetching a URL once the process has started?
Click on any button (such as the "Back" button) or on any other link to terminate the current link access. Or, if you're using the 1.0Alpha3 release, press the Stop button.

What differentiates HotJava from the other Internet browsers?
The most compelling difference is that HotJava recognizes the APP HTML tag and can display the interactive content those Java applets contain. Once an applet is downloaded to the client, the connection to the server is closed. The program executes locally on your machine. HotJava has built-in security. See Security.

How do I open a URL in HotJava?
Type the URL directly into the field labeled "Document URL."

Are there some WWW protocols that the alpha release of HotJava does not recognize?
Yes. See the Frequently Requested Features document for details.

Does HotJava recognize the NetScape extensions to HTML?
Most of them. HotJava does not support the center tag. The beta release is focusing on support for HTML 3.

What version of X Windows does HotJava use? Is it provided with the release?
For the alpha release, the window interface works only with version 3 of the Motif library (libXm.so.3). To build HotJava from the source release, the Motif header files you use must be consistent with the library version you are using or random crashes may ensue.

The best course would be to get a consistent set of header files and the libraries that go with them. If you are an internal Sun user the header files and libraries are availble as an installable package in

/net/cde-rental/motif/BUILD_SPARC_CDE1.0/cdesrc/packages.fcs-b/SUNWmfrun

You need to get this package installed on the machine where you will be doing builds.

Why can't I run imagetool after starting HotJava?
This is a known bug. imagetool will work if you start it up before you start HotJava.

Is HotJava extensible?
HotJava can be extended in three ways: by writing applets, by supporting new protocols (e.g., WAIS, GOPHER, FTP), and by supporting new content types (e.g., JPEG, GIF, MPEG).

How do I read news from inside HotJava?
Make sure your NNTPSERVER environment variable is set. Type "news:" in the Document URL window. Add this URL to your HotJava Goto list.

The Java Language

Why has Sun created the Java programming language?
Java is a programming language and an environment. It was designed to solve a number of problems in modern programming practice.

A bit of history. Java began life as part of a larger project to develop advanced software for consumer electronics. When we started the project, we intended to use C++, but we encountered a number of problems. Initially these were just compiler technology problems, but as time passed we encountered a set of problems that were best solved by changing the language.

A quick summary is that Java is a simple, object oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high performance, multithreaded, dynamic language.

Why are Java programs compiled into bytecodes?
Java was designed to support applications running on networks. A bytecode format is compact, making it relatively faster to transport over a network.

The Java compiler generates an architecture-neutral object file format to enable it to run applications on a variety of CPUs and operating systems. Applications compiled into Java bytecodes can run on any system that has the Java runtime. The runtime interprets the bytecodes.

A future release of Java is likely to include a bytecode compiler which compiles bytecodes into machine code.

How do I write my own applications?
HotJava is distributed with the complete Java API documented in hypertext. Users create their own classes by subclassing from the public API. To teach users to write applets in Java, we provide a tutorial called Writing and Using HotJava Applets.

What's in the class library?
The class library contains all of the public API for HotJava and Java.

Is the API documentation available in PostScript?
No, not at this time. It is generated directly from source code to HTML.

Is the language extensible?
Yes. To extend Java you subclass the classes in the public API.

What is the canonical "Hello World" program in Java?
Here is the code for an applet that generates "Hello World":
 import HotJava.Applet;    
          import awt.Graphics; 
          class HelloWorld extends Applet {
              public void init() {
                  resize(150, 25);
              }
              public void paint(Graphics g) {
                  g.drawString("Hello world!", 50, 25);
              }
          }

Do case statements in Java fall through as they do in C, requiring a break?
Yes they do.

Is there a problem returning numeric constants of type "short" and "byte" with the ternary operator?
There is a known bug when attempting to return a numeric constant, especially zero, as a result of the ternary operator, when the function is declared as returning a 'short' or a 'byte'. for example, the following class makes Javac warn of a possible loss of precision:
     class test {
 	short handicap() {
 	    short hcp = (short) (0.9 * (200.0 - average()));
 	    return (hcp > 0) ? hcp :  0;
 	}
     }
Casting zero to be a short in the return statement stops the warning.

The error in example above occurs because the type of the ?: expression works out to be an integer, which is wrong in this case.

Can I link in my own libraries if they are written in C code?
Yes, if you're writing a full-fledged Java application (and not an applet, for example). Libraries can be written in Java or C. Documentation for linking in C code is available from the HotJava documentation home page. See Implementing Native Methods.

How do I convert the contents of an ASCII file into built-in types, such as integers?
You can use the class Java.io.DataInputStream to read one line at a time. You can the use Java.lang.Integer.valueOf() to convert it to an actual number.

Is the class hierarchy of an Java app preserved after it is compiled into bytecode?
Yes. Each class knows where it fits into the hierarchy. The result of loading a class causes the hierarchy it requires to be built.

Here's an example. If you have your own package hierarchy: package foo.bar, and a class called MyClass, and that class is loaded across the network into a runtime that has never heard of foo.bar, your class will successfully be loaded into the foo.bar package by creating packages foo and foo.bar first.

Normally, compiled classes are shipped across the network from other machines. When those shipped classes are pulled across the network, they can be (and often are) pulled into the running system, without any need to "restart" the system. Classes are just loaded as they are needed, whether it be from the local file system or from an ftp or http connection.


Error Messages

Out of heap space
This means the allocator has run out of enough garbage collected heap space to allocate the space you need.

It might be that your heap has gradually filled up with stuff that garbage collection isn't able to reclaim. Or, you might be trying to load a huge HTML page or image, and despite there being free memory for normal use you can't do this one thing.

In the first case you might continue but probably won't get far. In the second you might not be able to do this one thing, but smaller tasks will work just fine. It may be that the thing you are trying to do takes so much memory that it won't complete even on a fresh system. In that case you would need to restart HotJava with a bigger heap to do the operation. That is not supported in the alpha release.

Restarting HotJava is a safe fallback.If you still can't do the operation then you could assume you are trying to allocate something huge.

OUT OF HEAP SPACE
You need to restart HotJava. When this message is in all caps it means that Java is trying to signal an error but can't get enough memory to do so.

Out of handle space
Restart HotJava.

Can't find foo.bar
You need to explicitly import the class that the Java interpreter can't find.

Can't initialize threads
This usually means that the Java interpreter (javai) can't find the classes it needs to start up. To see where the Java interpreter is trying to locate these classes, run javai with the -v option. Also check your CLASSPATH environment variable. It specifies the path for user-defined classes.

Send your comments or questions to the appropriate mailing list. If you need to communicate directly and privately with the java development team, send mail to java@java.sun.com.