 |
 |
Keep JVM open?
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Location: Edinburgh, Scotland
Status:
Offline
|
|
Anyone know how to, or even if it's possible, to keep the Java Virtual Machine running?
My uni course is now concentrating on Java and I much prefer Project Builder to Solaris with a text editor, but the JVM takes AGES to launch everytime I make a change and rebuild/relaunch.
Cheers
------------------
Just face it - some days you're the pigeon, some days you're the statue!
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2000
Status:
Offline
|
|
Write something that'll load your stuff up with a click of a button that stays open all the time. I did it on OS9...
I used a wrapper. I could launch the first app (the wrapper), it looked through my dev folder and launched the second app(real deal) with a modified classpath so I could just say "new Foo();"* and it would just work. Then, I could make changes to Foo and drop it in my dev folder and run the modified version without having to restart the JVM.
That's about the only way I know of. You could probably get all fancy with it and use a custom ClassLoader instead of setting up the classpath ahead of time but if you do that it'll just take longer to do.
* I can't remember if I got away with "new Foo()" exactly. I think I had to use the class Class to do loading with forName(?) or something. It's been too long since that project and it was a bit more complicated than I made it out to be here.
Good luck!
[edit: goofed]
[This message has been edited by IamBob (edited 05-01-2001).]
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Apr 1999
Location: MA
Status:
Offline
|
|
IamBob --
How did you get the class to reload without a custom classloader? Once you loaded foo, it should've stayed around, right?
Just slightly puzzled...
------------------
dennis
|
|
dennis
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Apr 1999
Location: MA
Status:
Offline
|
|
IamBob --
How did you get the class to reload without a custom classloader? Once you loaded foo, it should've stayed around, right?
Just slightly puzzled...
------------------
dennis
|
|
dennis
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2000
Status:
Offline
|
|
I think I mis-explained. I was replying in Mail and here. sorry.
What I used the "fake" class loader for was an mp3 player (using Quicktime for Java  ). I needed a way to see if there were any new plug-ins so I could add them to my list. The first wrapper looked in the plug-in folder for new plug-ins and launched the player with the right classpath so I didn't have to use a custom class loader.
So, in the main app all you're doing is creating any old class (everything you need is in the classpath). The wrapper was there to set the classpath for you. That could be done by hand if you wanted. You couldn't just add new stuff to the plugin folder and have it accesible in the app - the only draw back to a fake custom class loader.
Since you were just creating "any old class" you don't have to keep a reference (handle) to it in the class that spawned it. I did keep a handle because I had to. I was passing info to it twice a second so it could do some visuals. I had a "must be implemented" method to make it clean itself up (as best is possible) so I could get rid of it. I was calling currentPlugin.die(); and then System.gc(); ..basically.
Let me see if I can find it. I'm sure I had it backed up to disk at some point. If nothing else I know I have the binary around here somewhere.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2000
Status:
Offline
|
|
You can install the Forte Community Edition for Solaris and it will take care of all that for you. Open a project via the GUI, double click files to open in the editor and single button compile/run/debug. Because Forte is Java as long as you don't close it the JVM stays open. I've had it open as long as three or four days at a crack.
If you don't need the Mac Java Bridge API's, Forte should work fine.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |