Article View: borland.public.jbuilder.java.language
Article #8256Re: Exception in thread "main"
From: PeterH
Date: Mon, 02 Apr 2001 19:51
Date: Mon, 02 Apr 2001 19:51
101 lines
2950 bytes
2950 bytes
Hello.
I'm relatively new too, but I thought I might take a stab at this one.
I think the proble might be in your main.
Instead of the line:
new uebung_3();
Try this:
uebung_3 app = new uebung_3();
This way you have a new object called app which is instantiated from the
uebung_3 class.
"Mike" <mike.k@bluewin.ch> wrote in message
news:3AC8CE1A.CFD3E0CE@bluewin.ch...
> Hi there, im a newbie and i`ve a question.
> Im writing my first lessons of java in jbuilder 4.0
>
> I`ve done this little script here:
>
>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""
>
> // Einbinden aller AWT-Klassen
> import java.awt.*;
>
> // Einbinden aller Event-Klassen des AWT-Systems
> import java.awt.event.*;
>
> class uebung_3 extends Frame {
>
> /**
> * Der Konstruktor dient dazu, die Klasse nach dem Aufruf
> * zu initialisieren und muss den gleichen Namen wie
> * die Klasse haben.
> */
> public uebung_3() {
>
> // Ueberschrift fuer das Fenster festlegen
> setTitle("uebung_3.java");
>
> // WindowListener
> addWindowListener( new WindowAdapter() {
> public void windowClosing(WindowEvent e) {
> System.exit(0);
> }
> });
>
> // einen Label definieren,
> // der Text soll mittig sein
> Label Anzeige = new Label("Dies ist ein Text", Label.CENTER);
>
> // Label zum Fenster hinzufuegen
> add(Anzeige);
>
> // Groesse des Fensters festlegen
> setSize(300,80);
>
> // Fenster sichtbar machen (anzeigen)
> setVisible(true);
> }
>
> /**
> * Die Hauptmethode main() wird fuer den Start benoetigt
> */
> public static void main( String[] args ) {
>
> new uebung_3();
> }
> }
>
>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""
>
> if i try to run this script, jbuilder returns with
> "Could not find the main class. Program will exit."
>
> I`ve specified the "Default runnable file" in the project-properties,
> the java file is uebung_3.java
>
> Thank you for answering!
>
> cya
>
> mike
>
>
Technical Details
Message-ID:
<3ac8d851_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!156.27.64.143References:
<3AC8CE1A.CFD3E0CE@bluewin.ch>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,eff8c91282e89dda X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-04-02 12:56:07 PST From: "PeterH" <!PleaseRemoveThisBeforeSending!Peter.Henry@NetManage.com> Newsgroups: borland.public.jbuilder.java.language References: <3AC8CE1A.CFD3E0CE@bluewin.ch> Subject: Re: Exception in thread "main" Date: Mon, 2 Apr 2001 15:51:43 -0400 Lines: 103 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 156.27.64.143 Message-ID: <3ac8d851_1@dnews> X-Trace: 2 Apr 2001 12:51:45 -0800, 156.27.64.143 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!156.27.64.143