• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Launch Main from current class scope.

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem : Class A needs to call Class B with a main function in it. I need to close down class A before Class B runs.

Situation: A has control over a couple of documents I need it to release for B to be able to use. Because of its set up and what I am trying ot do I need to close and launch B. There I do have a batch file for B but I am trying to refrain from using it.

Any ideas on how to do this?

Thanks,
Randy
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without more technical descriptions than "close down", "runs", "release" and "launch", we won't be able to help.

Note that any code can run a main() method in another class -- it's just a method, and you can go ahead and call it. If there's something you need to do because calling B.main(), can you just do it explicitly in code in A (closing windows? closing files?)
 
Tempora Telora
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have B.Main being called in A.function but, Class A has control over ALOT of files and other items that I need to mess around with in class B.

I need to close A.
A MUST BE CLOSED TO LAUNCH B

Then Launch B.

That is all I need to do though I do not know how to do this. I am sure there is a simple solution I just cannot think of it.

Thanks,
Randy
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In other words, "A" is a tangled mess that exits with a lot of open files and depends on the OS to clean up after it? I would consider fixing A, rather than trying to come up with new hacks to pile on top of it. It's good practice for a program to clean up after itself. Rewriting A cleanly would be good experience.
 
Tempora Telora
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with you but this is for a Rapid Release Prototype for a Customer. Functional will be fixed later for right now I need it to just work.
reply
    Bookmark Topic Watch Topic
  • New Topic