🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: be.comp.programming
4 messages
4 total messages Started by Gaston Verhulst Thu, 30 Oct 2008 18:00
Exception in thread "main"
#313
Author: Gaston Verhulst
Date: Thu, 30 Oct 2008 18:00
37 lines
2124 bytes
Hallo,
Heb een en ander als inleiding over java gelezen en wil dit ook graag 
proberen in Linux.

1ste eenvoudige test lukte:
[gastonv@telenetPC Java-beginners]$ cat jhello.java
class hello {
         public static void main(String args[]){
                 System.out.println("Hello World!");
         }
}
[gastonv@telenetPC Java-beginners]$ javac jhello.java
[gastonv@telenetPC Java-beginners]$ java hello
Hello World!

2de test, uit een cursus, lukt niet:
[gastonv@telenetPC Java-beginners]$ cat Hallo.java
/*
  *     Een eenvoudig programma in Java,
  *         dat "Hallo Wereld" schrijft
  *         */
import java.applet.*;
import java.awt.*;
public class Hallo extends Applet {
     public void paint (Graphics g) {
         g.drawString ("Hallo Wereld",60,30);
     }
}
[gastonv@telenetPC Java-beginners]$ javac Hallo.java
[gastonv@telenetPC Java-beginners]$ java Hallo
Exception in thread "main" java.lang.NoSuchMethodError: main
Error: A JNI error has occurred, please check your installation and try 
again

Wat zou hier fout zijn?
Dank bij voorbaat voor een helpende tip.
Gaston Verhulst.
Re: Exception in thread "main"
#314
Author: Philip Paeps
Date: Thu, 30 Oct 2008 19:54
51 lines
2722 bytes
Gaston Verhulst <gaston.verhulst@pandora.be> wrote:
> Hallo,
> Heb een en ander als inleiding over java gelezen en wil dit ook graag 
> proberen in Linux.
>
> 1ste eenvoudige test lukte:
> [gastonv@telenetPC Java-beginners]$ cat jhello.java
> class hello {
>          public static void main(String args[]){
>                  System.out.println("Hello World!");
>          }
> }
> [gastonv@telenetPC Java-beginners]$ javac jhello.java
> [gastonv@telenetPC Java-beginners]$ java hello
> Hello World!
>
> 2de test, uit een cursus, lukt niet:
> [gastonv@telenetPC Java-beginners]$ cat Hallo.java
> /*
>   *     Een eenvoudig programma in Java,
>   *         dat "Hallo Wereld" schrijft
>   *         */
> import java.applet.*;
> import java.awt.*;
> public class Hallo extends Applet {
>      public void paint (Graphics g) {
>          g.drawString ("Hallo Wereld",60,30);
>      }
> }
> [gastonv@telenetPC Java-beginners]$ javac Hallo.java
> [gastonv@telenetPC Java-beginners]$ java Hallo
> Exception in thread "main" java.lang.NoSuchMethodError: main
> Error: A JNI error has occurred, please check your installation and try 
> again
>
> Wat zou hier fout zijn?
> Dank bij voorbaat voor een helpende tip.
> Gaston Verhulst.

Iets dat Applet extend draai je niet onder een shell.  Iets moet Applet
providen.  Meestal is dat een webbrowser.

 - Philip


-- 
Philip Paeps                                    Please don't email any replies
philip@paeps.cx                                     I follow the newsgroup.

  The hand that rocks the craddle usually is attached
  to someone who isn't getting enough sleep.
Re: Exception in thread "main"
#315
Author: Gaston Verhulst
Date: Fri, 31 Oct 2008 08:01
52 lines
2932 bytes
Philip Paeps schreef:
> Gaston Verhulst <gaston.verhulst@pandora.be> wrote:
>> Hallo,
>> Heb een en ander als inleiding over java gelezen en wil dit ook graag 
>> proberen in Linux.
>>
>> 1ste eenvoudige test lukte:
>> [gastonv@telenetPC Java-beginners]$ cat jhello.java
>> class hello {
>>          public static void main(String args[]){
>>                  System.out.println("Hello World!");
>>          }
>> }
>> [gastonv@telenetPC Java-beginners]$ javac jhello.java
>> [gastonv@telenetPC Java-beginners]$ java hello
>> Hello World!
>>
>> 2de test, uit een cursus, lukt niet:
>> [gastonv@telenetPC Java-beginners]$ cat Hallo.java
>> /*
>>   *     Een eenvoudig programma in Java,
>>   *         dat "Hallo Wereld" schrijft
>>   *         */
>> import java.applet.*;
>> import java.awt.*;
>> public class Hallo extends Applet {
>>      public void paint (Graphics g) {
>>          g.drawString ("Hallo Wereld",60,30);
>>      }
>> }
>> [gastonv@telenetPC Java-beginners]$ javac Hallo.java
>> [gastonv@telenetPC Java-beginners]$ java Hallo
>> Exception in thread "main" java.lang.NoSuchMethodError: main
>> Error: A JNI error has occurred, please check your installation and try 
>> again
>>
>> Wat zou hier fout zijn?
>> Dank bij voorbaat voor een helpende tip.
>> Gaston Verhulst.
> 
> Iets dat Applet extend draai je niet onder een shell.  Iets moet Applet
> providen.  Meestal is dat een webbrowser.
> 
>  - Philip
> 
> 
Dat is me nu ook gelukt, zoals bvb.
[gastonv@telenetPC Java-beginners]$ appletviewer CirkelDoorMidden.html
[gastonv@telenetPC Java-beginners]$ java hello
Hello World!
Bedankt voor het antwoord.
Gaston.
Re: Exception in thread "main"
#319
Author: Slike
Date: Sun, 23 Nov 2008 23:16
23 lines
1768 bytes
Gaston Verhulst wrote:
> Hallo,
> Heb een en ander als inleiding over java gelezen en wil dit ook graag 
> proberen in Linux.
> 
> 1ste eenvoudige test lukte:
> [gastonv@telenetPC Java-beginners]$ cat jhello.java
> class hello {
>         public static void main(String args[]){
>                 System.out.println("Hello World!");
>         }
> }
> [gastonv@telenetPC Java-beginners]$ javac jhello.java
> [gastonv@telenetPC Java-beginners]$ java hello
> Hello World!
> 

Namen van Java-klassen schrijf je conventioneel met een hoofdletter. De 
bestandsnaam van de klasse is normaal de naam van de klasse (met 
hoofdletter, gevolgd door .java).

Mvg,
Slike
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