Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Launch Main from current class scope.

 
Tempora Telora
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • 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
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic