Re: beginner's question
- From: "TideRider" <4me2know@xxxxxxxx>
- Date: Sat, 14 Apr 2007 14:08:45 GMT
Eclipse can either link to Javadocs on the internet or to downloaded local copies. For either,
you go into the Java Build Path properties for that library (starting with rt.jar!) and set the Javadoc
location. For a Java 5 rt.jar, you can set the Javadoc location to http://java.sun.com/j2se/1.5.0/docs/api/
..
You can also download the documentation from sun.java,com and unzip it into a location on your
computer. I do that for the APIs I use most, because I sometimes work on code when I don't
have Internet connectivity.
--
TideRider
"Jacky Luk" <jl@xxxxxxxxxx> wrote in message news:451248fa@xxxxxxxxxxxx
|
| "Ian Shef" <invalid@xxxxxxxxxxxxx> ¼¶¼g©ó¶l¥ó·s»D:Xns984485A746F71vaj4088ianshef@xxxxxxxxxxxxxxxxxx
| > "Jacky Luk" <jl@xxxxxxxxxx> wrote in news:45116ca0$1@xxxxxxxxx:
| >
| >> import java.awt.Graphics;
| >>
| >> public class printtest extends java.applet.Applet
| >> {
| >> public void init()
| >> {
| >> }
| >>
| >> public void paint (Graphics g)
| >> {
| >> g.drawString ("Hello from java!", 60, 30);
| >> }
| >>
| >> public static void main (String args)
| >> {
| >>
| >> }
| >> }
| >> ===============================
| >> java.lang.NoSuchMethodError: main
| >> Exception in thread "main"
| >>
| >> What happened?
| >> Thanks
| >> Jack
| >
| > 1)
| > The main method must be declared public and static. Good!
| > It must not return any value. Good!
| > It must accept a String array as a parameter. Oops! You have a String,
| > not
| > a String array.
| >
| > The method declaration must look like the following:
| >
| > public static void main(String args[])
| >
| > The above has been partially copied out of the javadocs for "java".
| > Get the javadocs and use them. They are your friend.
| >
| > 2)
| > Note for the future: When java tells you that it cannot find a method, it
| > is vital to remeber that the method must match both in name and in
| > signature. Method definitions don't match method calls unless a method of
| > the correct name can be found that has a parameter list that also matches
| > the one used for the call.
| >
| > 3)
| > If I saw an experienced java programmer writing this program, I might
| > figure that they are writing a mixed application/applet or otherwise doing
| > something clever -- maybe providing a way to test an applet without
| > requiring an applet viewer. However, when someone who describes themself
| > as a beginner writes this way, I get concerned.
| >
| > Your class extends Applet, indicating that you intend this program to be
| > an
| > Applet. However, you have a method "main", indicating that you intend
| > this
| > program to be an application. Furthermore, you used "java" to run it,
| > again indicating that your intent was for an application.
| >
| > If your intent was cleverness or a mixed application/applet, please
| > forgive
| > me. Otherwise, you need to re-think what you are doing and decide whether
| > you want an application or an applet. Then rethink your design.
| >
| > Best wishes!
| >
| >
| >
| > --
| > Ian Shef 805/F6 * These are my personal opinions
| > Raytheon Company * and not those of my employer.
| > PO Box 11337 *
| > Tucson, AZ 85734-1337 *
|
| How do I download java documentation directly from eclipse? I couldn't find
| my way out at java.sun.com
| Thanks
| Jack
|
|
.
- Prev by Date: enum and EnumMap as parameters?
- Next by Date: Re: newbie: popular web servers for Windows?
- Previous by thread: enum and EnumMap as parameters?
- Next by thread: Re: newbie: popular web servers for Windows?
- Index(es):
Relevant Pages
|