Re: java help!

Marianne Mueller (mrm@eng.sun.com)
Tue, 11 Feb 1997 17:46:08 -0800

Date: Tue, 11 Feb 1997 17:46:08 -0800
Message-Id: <199702120146.RAA24044@puffin.eng.sun.com>
From: Marianne Mueller <mrm@eng.sun.com>
To: unicorn@csd.uwm.edu
Subject: Re: java help!

> 1) I have my own email account where I write files for the website I
> have. So, I am assuming JAVA works in the same manner. I use the editor
> emacs to accomplish this. So, I just write the JAVA code in one of my
> files, and I should be able to view them, right?

Have you written other computer programs before? It's just like
writing any other computer program. You can use any editor to create
the Java source files. then, you use the Java compiler to compile the
Java source files into Java bytecodes. The Java compiler, which is a
program named javac, takes as input .java files, and creates as output
.class files, which contain the Java bytecodes.

Finally, you invoke the interpreter to interpret the bytecodes. The
interpreter is another name for the Java virtual machine. The JVM
(Java virtual machine) is embedded in Netscape Navigator and in
Microsoft Internet Explorer. To have them interpret (run) some Java
code, you need to create an HTML file that contains the <applet> tag.
The applet tag tells the browser where to find the .class file.

This is explained in the "Teach Yourself Java in 21 Days" book -- I
suggest going through some simple examples from the book.

>
> 2) I don't use Netscape or any other browsers at home; I only use
> Netscape at school. So, am I suppose to use the CD at school? I really
> wouldn't want to be loading files into their terminals though... Can't I
> do it without the CD???

Netscape has the JVM embedded in the browser, so you load applets
without installing any new software. To develop new Java code,
however, you do need to be able to use the Java compiler, and it's
a good idea to use the appletviewer to debug your program. Ask
the system administrator at your school to install Java for you.

>
> 3) I am very confused on compiling a program. If I wanted to compile a
> program, its written, for example, to type: javac aprogram.java
> But this doesn't work for programs where I use certain functions such as
> "drawLine." Why??

You need to be sure to import java.awt.* if you are invoking methods
that are in the awt class library.

>
> 4) Also, if I wanted to use some of the functions like "drawLine" and
> "fillRect," would I have to load something also from the CD??

These functions are contained in the java.awt class library, and
the set of base Java classes are embedded in Navigator and in
Explorer.

So, you do need to install the complete JDK on your school system so
you can develop code, but once the code is ready to use, at that
point, it can find the Java class libraries inside the browser.

Hope that makes sense. You might want to spend more time with
a Java intro book - try "Hooked on Java" if you can find it,
by Sami Shaio, Arthur van Hoff and Orca Starbuck.

Marianne

usually answering about security but I have a soft spot for students :-)