Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / March 2005

Tip: Looking for answers? Try searching our database.

class error on event dispatching thread?

Thread view: 
bonj - 01 Mar 2005 00:29 GMT
hi
I compiled a 'hello world' style java app using Swing's JFrame, and when
packaging it into a .jar file, I got 'error - no main class found' when
running it. I quickly solved this by adding a manifest file specifying
"Main-class = helloworld"
and including this in the jar.
However when I use the (preferred?) method of using the
javax.SwingUtilities.InvokeLater method to 'make the event dispatching
thread' handle the form (which sounds like a good idea coming from a C#
background) the application won't run - but only when compiled into a jar.

It just cites 'exception in sub main' on the line calling the InvokeLater
method, and I can't glean what the cause of the exception is at all.
However it works when I don't compile it into a jar archive, which
suggests that the code is correct. The code is just any standard hello
world example that uses the invokeLater method in its createAndShowGui.

It seems weird that it will work fine *either* as a jar but with the
code altered so that the main directly is showing the form, *or* with the
event-dispatching invokeLater thingy and no jar... but not both.

Any suggestions?
John McGrath - 01 Mar 2005 16:03 GMT
> However when I use the (preferred?) method of using the
> javax.SwingUtilities.InvokeLater method to 'make the event dispatching
[quoted text clipped - 4 lines]
> It just cites 'exception in sub main' on the line calling the InvokeLater
> method, and I can't glean what the cause of the exception is at all.

Hmmmmm... No source code.  No exception details.

Signature

Regards,

John McGrath

bonj - 03 Mar 2005 18:23 GMT
>> However when I use the (preferred?) method of using the
>> javax.SwingUtilities.InvokeLater method to 'make the event dispatching
[quoted text clipped - 6 lines]
>
> Hmmmmm... No source code.  No exception details.

Hmm... I just typed it out, and it now works. A phantom error. Must have
been something I was doing in the extra code I had previously, but if
that's the case then I can build it up from what works.

Thanks


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.