|
From: Aiman Y. <wr...@co...> - 2004-01-06 15:24:16
|
Hi. Just joined the mailing list today (just started using the software last week). I've run into a problem where I get the error: jvm 1 | WrapperSimpleApp: Unable to locate a static main method in class com.my.class.Bla: java.lang.NoSuchMethodException: com.my.class.Bla.main([Ljava.lang.String;) I looked in the code of Bla (not my code), and there was no main class, however Bla extended BlaParent which does have a main class. So when Bla is run from the command line, it works. So does anybody know how to have WrapperSimpleApp launch Bla even though it uses BlaParent's main function to start? And one more (non-related) question. Is there a way to search the mailing list archives? I went through all the subjects of the archives on the web looking for the word "main" hoping to find this question already asked. I didn't find anything though, so I apologize if this is a repeat question. Thanks, Aiman |
|
From: Leif M. <le...@ta...> - 2004-01-06 16:20:05
|
Aiman,
The WrapperSimpleApp and WrapperStartStopApp classes currently only
look for a
static main method in the class specified as the main class. It does
not recurse up and
look at the parent classes looking for a main method. I had not
actually known that
was legal. I'll do some testing here and get this fixed for a future
version.
For now, you can work around this by creating a dummy class whose
main method
simply calls the main method that you want.
Thinking about this as I write however, I am confused as to why you
do not just specify
BlaParent as your main class? The main class is static so there is no
reason to be calling
the main method using the child class name.
As for searching the list, go to the following page:
http://sourceforge.net/mailarchive/forum.php?forum_id=11948
Use the search box in the upper left of the screen. It is a bit
confusing as it is the same
search box as the SF site. But if you look closely you will see the
list box over the field
says "This Mailing List".
Cheers,
Leif
Aiman Younis wrote:
>Hi.
>Just joined the mailing list today (just started using the software last
>week).
>
>I've run into a problem where I get the error:
>jvm 1 | WrapperSimpleApp: Unable to locate a static main method in class
>com.my.class.Bla: java.lang.NoSuchMethodException:
>com.my.class.Bla.main([Ljava.lang.String;)
>
>I looked in the code of Bla (not my code), and there was no main class,
>however Bla extended BlaParent which does have a main class. So when Bla is
>run from the command line, it works.
>
>So does anybody know how to have WrapperSimpleApp launch Bla even though it
>uses BlaParent's main function to start?
>
>And one more (non-related) question. Is there a way to search the mailing
>list archives? I went through all the subjects of the archives on the web
>looking for the word "main" hoping to find this question already asked. I
>didn't find anything though, so I apologize if this is a repeat question.
>
>Thanks,
>Aiman
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: IBM Linux Tutorials.
>Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
>Free Linux Tutorials. Learn everything from the bash shell to sys admin.
>Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
>_______________________________________________
>Wrapper-user mailing list
>Wra...@li...
>https://lists.sourceforge.net/lists/listinfo/wrapper-user
>
>
>
|
|
From: Aiman Y. <wr...@co...> - 2004-01-06 19:34:36
|
Thanks for the quick response, Leif. I also hadn't known it was possible that it could work without its own main function until I started getting that error and investigated. The reason the child is launched from the command line is because the parent is an abstract class. The child(ren) statically sets a variable (among other things, but I didn't look into it very deeply) which is used in the Parent's main class to identify what kind of child it is. So for different children objects to be instantiated (they are different types of servers), the children have to be run to identify themselves. I would have replied sooner but I was trying to get that dummy class written and compiled. It became somewhat confusing...as confusing as the above paragraph, and for the same reasons :) But its working for now. And any idea about if/when a new version that can call the parent's main would be available? I'm not looking for anything specific...just a "next month" or "within 2 years" type of answer. Thanks again, Aiman ----- Original Message ----- From: "Leif Mortenson" <le...@ta...> To: <wra...@li...> Sent: Tuesday, January 06, 2004 11:19 AM Subject: Re: [Wrapper-user] cant access main function in parent class > Aiman, > The WrapperSimpleApp and WrapperStartStopApp classes currently only > look for a > static main method in the class specified as the main class. It does > not recurse up and > look at the parent classes looking for a main method. I had not > actually known that > was legal. I'll do some testing here and get this fixed for a future > version. > > For now, you can work around this by creating a dummy class whose > main method > simply calls the main method that you want. > > Thinking about this as I write however, I am confused as to why you > do not just specify > BlaParent as your main class? The main class is static so there is no > reason to be calling > the main method using the child class name. > > As for searching the list, go to the following page: > http://sourceforge.net/mailarchive/forum.php?forum_id=11948 > > Use the search box in the upper left of the screen. It is a bit > confusing as it is the same > search box as the SF site. But if you look closely you will see the > list box over the field > says "This Mailing List". > > Cheers, > Leif > > Aiman Younis wrote: > > >Hi. > >Just joined the mailing list today (just started using the software last > >week). > > > >I've run into a problem where I get the error: > >jvm 1 | WrapperSimpleApp: Unable to locate a static main method in class > >com.my.class.Bla: java.lang.NoSuchMethodException: > >com.my.class.Bla.main([Ljava.lang.String;) > > > >I looked in the code of Bla (not my code), and there was no main class, > >however Bla extended BlaParent which does have a main class. So when Bla is > >run from the command line, it works. > > > >So does anybody know how to have WrapperSimpleApp launch Bla even though it > >uses BlaParent's main function to start? > > > >And one more (non-related) question. Is there a way to search the mailing > >list archives? I went through all the subjects of the archives on the web > >looking for the word "main" hoping to find this question already asked. I > >didn't find anything though, so I apologize if this is a repeat question. > > > >Thanks, > >Aiman > > > > > > > >------------------------------------------------------- > >This SF.net email is sponsored by: IBM Linux Tutorials. > >Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > >Free Linux Tutorials. Learn everything from the bash shell to sys admin. > >Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > >_______________________________________________ > >Wrapper-user mailing list > >Wra...@li... > >https://lists.sourceforge.net/lists/listinfo/wrapper-user > > > > > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > Wrapper-user mailing list > Wra...@li... > https://lists.sourceforge.net/lists/listinfo/wrapper-user |