Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show GUI but not launch #6

Closed
davidsteinsland opened this issue Jun 5, 2014 · 7 comments
Closed

Show GUI but not launch #6

davidsteinsland opened this issue Jun 5, 2014 · 7 comments

Comments

@davidsteinsland
Copy link

Is it possible to show the GUI, but not launch the application?
In a worst-case scenario I guess I can import getdown.jar into my classpath, and extend the StatusPanel to create my own GUI, but that sounds like a lot of work ...

@samskivert
Copy link
Member

There's no configuration for doing this in the code, but depending on what you're trying to accomplish, maybe some hackery can get you there.

Is your intent to download code/resources that are presumably not yet downloaded and then just stop?

@davidsteinsland
Copy link
Author

The main reason is that I need to stop a service before getdown, and start
it After. *then * I start the main application.
5. juni 2014 18:36 skrev "Michael Bayne" notifications@github.com
følgende:

There's no configuration for doing this in the code, but depending on what
you're trying to accomplish, maybe some hackery can get you there.

Is your intent to download code/resources that are presumably not yet
downloaded and then just stop?


Reply to this email directly or view it on GitHub
#6 (comment).

@samskivert
Copy link
Member

On Thu, Jun 5, 2014 at 11:37 AM, David Steinsland notifications@github.com
wrote:

The main reason is that I need to stop a service before getdown, and start
it After. *then * I start the main application.

OK, then I think the approach I had in mind may be useful.

You can pass system properties to the Getdown app which are passed through
to your app. So you could do:

java -jar getdown.jar -Dapp.update-only=true appdir

which will then pass -Dupdate-only=true to your app when it is run. Your
app can check for update-only first thing and if it sees that, then it can
just exit immediately.

That way, whatever is running Getdown will cause it to do its natural
updating, and then "run" the app, which will just exit immediately. Then
you can run your app however you like, without the -Dupdate-only system
property, which will cause it to run as normal. That could be by reinvoking
Getdown (which will see that everything is up to date and just run your
app), or by whatever other means you like.

-- mdb@samskivert.com

@davidsteinsland
Copy link
Author

yeah, thank you. much simpler!

on a side note.. is it possible to update getdown by specifying it as a resource, or will this completely break the classloader?

@samskivert
Copy link
Member

On Fri, Jun 6, 2014 at 6:37 AM, David Steinsland notifications@github.com
wrote:

on a side note.. is it possible to update getdown by specifying it as a
resource, or will this completely break the classloader?

I was going to point you to the wiki page on updating Getdown, but I
haven't written it yet! Ha!

You can update Getdown, but you have to jump through hoops, because as you
suspect, if you update the getdown.jar that is actually running Getdown, it
will crash and burn.

What we do is to add:

resource = getdown-new.jar

to our apps, and then there's a helper class in Getdown called LaunchUtil
which defines:

/**
 * Upgrades Getdown by moving an installation managed copy of the

Getdown jar file over the
* non-managed copy (which would be used to run Getdown itself).
*
*

If the upgrade fails for a variety of reasons, warnings are
logged but no other actions
* are taken. There's not much else one can do other than try again
next time around.
*/
public static void upgradeGetdown (File oldgd, File curgd, File newgd)

The way to use it is to put getdown.jar in your app's classpath, and then
call LaunchUtil.upgradeGetdown() during your apps startup phase.
upgradeGetdown() does the following:

delete oldgd
move curgd to oldgd
move newgd to curgd
copy curgd back to newgd

This three way shuffle is to avoid conflicts if Getdown is still running
for any reason and has curgd open (which on Windows will prevent it from
being deleted or copied over, but not renamed), and also to avoid issues if
the user's disk happens to reach 100% full during this process.

Also upgradeGetdown() does nothing if curgd and newgd are the same size
(which it uses as a proxy for tracking whether it already did the upgrade).

-- mdb@samskivert.com

@davidsteinsland
Copy link
Author

Aha, so something like this then:

...
public static void main(...) {
    com.threerings.getdown.util.LaunchUtil.upgradeGetdown(new File("getdown-old.jar"), 
        new File("getdown.jar"), 
        new File("getdown-new.jar"));
}
java -cp getdown.jar:app.jar com.myapp

@samskivert
Copy link
Member

Exactly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants