General Questions |
Java is a high-level, object-oriented
computer programming language. Java can be used to make Applets
that run over the Internet.
To learn more, read our What is Java Page.
|
Basically, the difference is that an Applet is meant to
be viewed on a web page, while an Application is run from the command
line.
For a more in depth explanation, see the What is an Applet page.
|
Applets can do just about anything that a Java application can
do. Of course, this may mean absolutely nothing to you if you
are not familiar with Java applications either. You can use applets
to make your websites interactive. Applets can be used for games,
animations, quizzes, tutorials, and millions of other things as
well.The best way to understand what applets are capable of is
to look at some examples.
Check out our Other Resources page
for a list of sites with good Applet examples.
|
Writing a webpage is easy. Websites are written in the
HyperText Markup
Language (HTML). HTML is quite simple and easy
to learn.
Just follow our simple Basic
HTML guide.
|
Once your website is written (in HTML), you just need
to add an applet tag within the body section of the HTML. The applet
tag looks like this
<applet code="myCompiledCode.class"
width="400px" height="400px"></applet>
For more complete instructions on adding your applet, see the Adding an Applet section of our Basic HTML guide.
|
Teach Yourself Java is designed to be easy to use. Basically,
you should follow these steps:
- Background - Check out our Background
Info Section. This will give you the general knowledge that
you need to understand the lessons.
- Lessons - Follow our Lesson
Plan. Start with the first lesson and work your way through
all of them.
- HELP - Whenever you need help, our Help
Section offers plenty of resources to you. If you don't
understand the terminology, check out the Java
Glossary. If you have a question, you have three options:
- Check out Frequently Asked
Questions.
- Post your question on our Message
Board or just look through answers to past questions.
- Use our list of Other Resources
if you can't find the answer on this site.
- Further Information - If you found this tutorial
interesting and would like to learn more about the Java language,
check out our Other Resources page.
This contains links to more tutorials that go beyond the material
covered here.
|
Compiling Errors |
Compiling is going to be the most frustrating part of computer
programming. There will be plenty of times that you believe you
have written a perfect program and it won’t work for hours because
the compiler will tell you that you have errors and that it can’t
run your program. When you compile your program, one of two things
will happen. Either the compiler will tell you compilation complete
or it will give you a list of errors. Each of the errors that
it lists will be associated with a line number which you can use
to find exactly where the error is. It will also tell you what
was wrong. A few of the common errors are listed below. However,
it is essential to look at exactly what the compiler says the
error is and try to figure out how it applies to the line that
it occurred on.
If necessary, you can post on our forum or check out this great
guide
to fixing common compiler errors.
|
This error message means that the computer cannot find the compiler.
Follow these steps:
- Make sure that Java has been properly installed - for
instructions see Installing
Java
- Check your PATH. []
|
This error message means that there is a semicolon missing
from the end of a line.
|
This error message means that you used a variable before
explicitly initializing it.
|
This error message means that you forgot to specify a
return type for your function.
|
This error message means that you saved your sourcecode
file as "class_name.java" but that file doesn't contain
the class definition for "class_name."
|
This error message means that you are probably trying
to assign a value to a variable when you originally declare it and
not doing it the right way. You might either be assigning a value
of the wrong type or assigning it using two equals signs instead
of one.
|
This error message means that you probably forgot to end
the previous line with a semicolon. It may also occur if you spell
a command wrong, such as if with a capital I instead of a lower
case i.
|
Applet Problems |
There may be a number of problems:
- First, you want to make sure that Java has been correctly
installed on your computer. See our Guide
to Installing Java.
- Second, you want to make sure that you
have compiled your program into a class and that the class has been
put on the web page you are attempting to view (check the Basic
HTML section again.
- Finally, you may have to check your code to ensure that you have written
the code properly and haven’t missed any steps (forgetting to set
the Content Pane is sometimes a problem).
If all of these problems are not causing the problem, you
may want to post on our forum or check our Other Resources page.
|
Most often, the reason that your changes have not taken place
is that you forgot to recompile your program before running it
again. If you open your web browser to run an Applet before that
program has been recompiled, it will not reflect the changes you
made. Another idea is to clear the cache associated with your
Java program – if you installed the Java version that we suggested,
there will be a window that pops up that has an option of pressing
‘x’ to clear the cache. If the changes still do not show up, check
your code to make sure you know exactly what the changes do, and
as a last resort, save everything, close all your directories
and internet browser, and then reopen them.
Again, if nothing works, post on thepost on our forum
or check our Other Resources page.
|