🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.java.help
9 messages
9 total messages Started by Peter Sat, 07 Aug 1999 00:00
Help: This simple applet won't run.
#22
Author: Peter
Date: Sat, 07 Aug 1999 00:00
39 lines
1702 bytes
Hi, i have installed jdk1.2 that comes with the
book " Just Java 2" on WIN95. I run java
from MS-Dos prompt.

I can run the demo code myframe.java but when i
try to execute the simple code graf.java from p.561
of " Just Java 2", i got the following error message
( compilation is OK):

c:\jdk1.2\bin\java graf

Exception in thread " main " java.lang.NosuchMethod Error: main

#####

Anyone has a clue of what's wrong or is there something
wrong with my Window system ?

The following is the code of graf.java

import java.awt.*;
import java.applet.*;
public class graf extends Applet {

    public void paint(Graphics g) {
         g.drawRect(25,30,60,40);
         g.drawRect(125,30,100,100);

         g.setColor(Color.cyan);
         g.drawOval(25,30,60,40);
         g.drawOval(125,30,100,100);
    }

}

Thanks for any help

Sam
Re: Help: This simple applet won't run.
#27
Author: syng
Date: Fri, 06 Aug 1999 00:00
2 lines
988 bytes
Hi,
Where is you init() method?
Re: Help: This simple applet won't run.
#28
Author: syng
Date: Fri, 06 Aug 1999 00:00
8 lines
1146 bytes
sorry, please disregard:


syng <syng.l@worldnet.att.net> wrote in message
news:7og7th$ns2$1@bgtnsc01.worldnet.att.net...
> Hi,
> Where is you init() method?
 >
Re: Help: This simple applet won't run.
#29
Author: syng
Date: Fri, 06 Aug 1999 00:00
13 lines
1230 bytes
Hi again,
 I'm just curious. Did you write an html file to run graf.java?
 You must have that to run an applet.

--
syng
Peter <peter52@tnetnz.com> wrote in message
news:37AB9ED7.B0213FC6@tnetnz.com...
>

> Exception in thread " main " java.lang.NosuchMethod Error: main
>
> #####
Re: Help: This simple applet won't run.
#30
Author: syng
Date: Fri, 06 Aug 1999 00:00
10 lines
1183 bytes


C. K. So <ckso@hkid.com> wrote

> You should create a html file, eg. graf.html:
> <applet code = "graf" width = 300 height = 200>


You mean, <applet code = "graf.class" width = 300 height = 200>
Re: Help: This simple applet won't run.
#23
Author: C. K. So
Date: Sat, 07 Aug 1999 00:00
63 lines
2147 bytes
You should create a html file, eg. graf.html:
<applet code = "graf" width = 300 height = 200>
</applet>
and run:
appletviewer graf.html

OR

add the comments to graf.java
/*
<applet code = "graf" width = 300 height = 200>
</applet>
*/
and run:
appletviewer graf.java

ps. "java" is used to run java program and "appletviewer" is used to run
java applet.
--
C. K. So
Homepage : http://members.xoom.com/ckso
Peter <peter52@tnetnz.com> wrote in message
news:37AB9ED7.B0213FC6@tnetnz.com...
>
> Hi, i have installed jdk1.2 that comes with the
> book " Just Java 2" on WIN95. I run java
> from MS-Dos prompt.
>
> I can run the demo code myframe.java but when i
> try to execute the simple code graf.java from p.561
> of " Just Java 2", i got the following error message
> ( compilation is OK):
>
> c:\jdk1.2\bin\java graf
>
> Exception in thread " main " java.lang.NosuchMethod Error: main
>
> #####
>
> Anyone has a clue of what's wrong or is there something
> wrong with my Window system ?
>
> The following is the code of graf.java
>
> import java.awt.*;
> import java.applet.*;
> public class graf extends Applet {
>
>     public void paint(Graphics g) {
>          g.drawRect(25,30,60,40);
>          g.drawRect(125,30,100,100);
>
>          g.setColor(Color.cyan);
>          g.drawOval(25,30,60,40);
>          g.drawOval(125,30,100,100);
>     }
>
> }
>
> Thanks for any help
>
> Sam
>
Re: Help: This simple applet won't run.
#24
Author: C. K. So
Date: Sat, 07 Aug 1999 00:00
21 lines
1215 bytes
Don't need ".class". But I think it also works...

--
C. K. So
Homepage : http://members.xoom.com/ckso
syng <syng.l@worldnet.att.net> wrote in message
news:7ogjs8$pkj$1@bgtnsc02.worldnet.att.net...
>
>
>
> C. K. So <ckso@hkid.com> wrote
>
> > You should create a html file, eg. graf.html:
> > <applet code = "graf" width = 300 height = 200>
>
>
> You mean, <applet code = "graf.class" width = 300 height = 200>
>
>
>
>
Re: Help: This simple applet won't run.
#25
Author: syng
Date: Sat, 07 Aug 1999 00:00
7 lines
1185 bytes
Wow! I didn't know that.
Thanks.

 syng

C. K. So <ckso@hkid.com> wrote
> Don't need ".class". But I think it also works...
Re: Help: This simple applet won't run.
#26
Author: Mr. Tines
Date: Sat, 07 Aug 1999 00:00
33 lines
2060 bytes
###

On Sat, 07 Aug 1999 14:50:00 +1200, in <37AB9ED7.B0213FC6@tnetnz.com>
          Peter <peter52@tnetnz.com> wrote.....

>
> Hi, i have installed jdk1.2 that comes with the
> book " Just Java 2" on WIN95. I run java
> from MS-Dos prompt.
>
> I can run the demo code myframe.java but when i
> try to execute the simple code graf.java from p.561
> of " Just Java 2", i got the following error message
> ( compilation is OK):
>
> c:\jdk1.2\bin\java graf
>
> Exception in thread " main " java.lang.NosuchMethod Error: main

You are trying to run you applet as if it were an
application.  Applications have a public static void main(String[] args)
method where execution starts.  Applets are embedded in
HTML pages and invoked through the browser.

-- PGPfingerprint: BC01 5527 B493 7C9B  3C54 D1B7 248C 08BC --
 _______ {pegwit v8 public key =581cbf05be9899262ab4bb6a08470}
/_  __(_)__  ___ ___     {69c10bcfbca894a5bf8d208d001b829d4d0}
 / / / / _ \/ -_|_-<             http://www.ravnaandtines.com/
/_/ /_/_//_/\__/___/@ravnaandtines.com         PGP key on page

### end pegwit v8 signed text
31ad593d6b29606a8d7d04f35f10eb0c31346952b869e69911f52656bf90
14f3b75c14f40ad7b1089654008f547afd428eae4d1db18d50700450826c
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads