Home » Archived » Visual Editor (VE) » NEWBIE: Compiling VE-generated classes
NEWBIE: Compiling VE-generated classes [message #20218] |
Fri, 20 February 2004 12:43  |
Eclipse User |
|
|
|
Originally posted by: ntipping.sencon.co.uk
Hi Folks,
Apologies for this query, but having looked through a lot of the
documentation, I'm kind of falling between general purpose docs and VE
specific docs, and not coming up with a solution. First of all, I have to
stress that I'm a complete beginner as far as JAVA goes, and even more so in
the Eclipse environment. I'm playing around with VE and taking my first few
steps, but struggling to do a couple of things:-
1) I can run/debug, say, a JPanel class as a Java Bean and up it pops -
Fine. However, if I try to run/debug it as an application, it doesn't
appear.
2) I can't find out how to compile to a jar file.
Yes, all horribly basic questions, I know.
I'm running Eclipse 2.1.2, Sun JRE 1.3.1_10, NO JDK installed, VE 0.5.0
Thanks in advance.
Best Regards,
Nick Tipping.
|
|
| |
Re: NEWBIE: Compiling VE-generated classes [message #20647 is a reply to message #20223] |
Tue, 24 February 2004 03:46   |
Eclipse User |
|
|
|
Originally posted by: ntipping.sencon.co.uk
Hi,
"R.U. Deranged" <yes_this_is_a_real_address@earthlink.net> wrote in message
news:opr3okoizgbc47nv@news.eclipse.org...
> On Fri, 20 Feb 2004 17:43:18 -0000, Nick Tipping <ntipping@sencon.co.uk>
> wrote:
>
> > 1) I can run/debug, say, a JPanel class as a Java Bean and up it pops -
> > Fine. However, if I try to run/debug it as an application, it doesn't
> > appear.
>
>
> Did you add a static void main() method in your JPanel class? You should,
> and instantiate the class in it, otherwise you won't be able to run it as
> a standalone app.
I did check the 'public static void main(String[] args)' checkbox on the
'create class' dialog box.
>
>
> > 2) I can't find out how to compile to a jar file.
>
>
> File --> Export... --> JAR file
That's the last place I thought of looking - thanks.
>
>
> Cheers.
Best Regards,
Nick Tipping.
|
|
|
Re: NEWBIE: Compiling VE-generated classes [message #20719 is a reply to message #20647] |
Thu, 26 February 2004 04:14  |
Eclipse User |
|
|
|
Nick,
> >
> > Did you add a static void main() method in your JPanel class? You
should,
> > and instantiate the class in it, otherwise you won't be able to run it
as
> > a standalone app.
>
> I did check the 'public static void main(String[] args)' checkbox on the
> 'create class' dialog box.
>
Actually, you need to write some code in it, because the VE won't generate
anything (not in this case anyway).
For example, if your class is called MyPanel, the code should look like :
public static void main(String[] args) {
try {
JFrame aFrame = new JFrame("My Application"); // Create a Frame
for your application
MyPanel aMyPanel = new MyPanel(); // Instatiate the panel
aFrame.setContentPane(aMyPanel); // Set the panel as the JFrame's
content pane
aFrame.pack(); // Resize the JFrame to its preferred size (an
alternate way would be to set the size explicitely)
aFrame.setVisible(true); // Display the Frame
} catch (Throwable t) {
t.printStackTrace(); // Just in case anything happens so you'll
know about it
}
}
Hope that helps,
Sebastien.
|
|
|
Re: NEWBIE: Compiling VE-generated classes [message #582116 is a reply to message #20218] |
Fri, 20 February 2004 13:08  |
Eclipse User |
|
|
|
On Fri, 20 Feb 2004 17:43:18 -0000, Nick Tipping <ntipping@sencon.co.uk>
wrote:
> 1) I can run/debug, say, a JPanel class as a Java Bean and up it pops -
> Fine. However, if I try to run/debug it as an application, it doesn't
> appear.
Did you add a static void main() method in your JPanel class? You should,
and instantiate the class in it, otherwise you won't be able to run it as
a standalone app.
> 2) I can't find out how to compile to a jar file.
File --> Export... --> JAR file
Cheers.
|
|
|
Re: NEWBIE: Compiling VE-generated classes [message #582289 is a reply to message #20223] |
Tue, 24 February 2004 03:46  |
Eclipse User |
|
|
|
Originally posted by: ntipping.sencon.co.uk
Hi,
"R.U. Deranged" <yes_this_is_a_real_address@earthlink.net> wrote in message
news:opr3okoizgbc47nv@news.eclipse.org...
> On Fri, 20 Feb 2004 17:43:18 -0000, Nick Tipping <ntipping@sencon.co.uk>
> wrote:
>
> > 1) I can run/debug, say, a JPanel class as a Java Bean and up it pops -
> > Fine. However, if I try to run/debug it as an application, it doesn't
> > appear.
>
>
> Did you add a static void main() method in your JPanel class? You should,
> and instantiate the class in it, otherwise you won't be able to run it as
> a standalone app.
I did check the 'public static void main(String[] args)' checkbox on the
'create class' dialog box.
>
>
> > 2) I can't find out how to compile to a jar file.
>
>
> File --> Export... --> JAR file
That's the last place I thought of looking - thanks.
>
>
> Cheers.
Best Regards,
Nick Tipping.
|
|
|
Re: NEWBIE: Compiling VE-generated classes [message #582406 is a reply to message #20647] |
Thu, 26 February 2004 04:14  |
Eclipse User |
|
|
|
Nick,
> >
> > Did you add a static void main() method in your JPanel class? You
should,
> > and instantiate the class in it, otherwise you won't be able to run it
as
> > a standalone app.
>
> I did check the 'public static void main(String[] args)' checkbox on the
> 'create class' dialog box.
>
Actually, you need to write some code in it, because the VE won't generate
anything (not in this case anyway).
For example, if your class is called MyPanel, the code should look like :
public static void main(String[] args) {
try {
JFrame aFrame = new JFrame("My Application"); // Create a Frame
for your application
MyPanel aMyPanel = new MyPanel(); // Instatiate the panel
aFrame.setContentPane(aMyPanel); // Set the panel as the JFrame's
content pane
aFrame.pack(); // Resize the JFrame to its preferred size (an
alternate way would be to set the size explicitely)
aFrame.setVisible(true); // Display the Frame
} catch (Throwable t) {
t.printStackTrace(); // Just in case anything happens so you'll
know about it
}
}
Hope that helps,
Sebastien.
|
|
|
Goto Forum:
Current Time: Sun Jun 08 11:27:58 EDT 2025
Powered by FUDForum. Page generated in 0.12420 seconds
|