Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Mac Launcher



Cool...I think I have the concept down. Let me give it a shot and i'll post
more to the list. This could solve a whole slew of headaches that i've been
having with the class-loader locking the .jar files...i actually solved it
with a separate launch class but the launch class was launching a separate
java vm for the main class and that simply took too long. Also, i've
written native apps on both systems but those have their own problems and
i'm pretty much pulling my hair out over a "clean" solution to this
problem...

Thanks again for the suggestion.

-bryanw

-----Original Message-----
From: Kyle Downey [mailto:email@hidden]
Sent: Monday, April 26, 2004 4:10 PM
To: Bryan Waters
Cc: Java-Dev
Subject: Re: Mac Launcher


If you create a very simple bootstrap client with a custom ClassLoader
you could do this entirely in Java and not worry about replacing the
JAR at runtime. If you change your app to return control to the
bootstrapper you might even be able to create the equivalent of a
"reboot with new code" without ever exiting the original VM. Just
destroy and re-create the application ClassLoader.

To do it you'd make a launch.jar that has a single class with a main()
method that does nothing more than put up a splash screen, copy in the
latest JARs, and then launches your application. If the code is
minimal the response should be fairly quick. I found one heavy hit in
Swing app start-up is class loading; this mechanism would postpone the
loading of your app's classes until after the splash screen goes up.

You might want to take a look at the code behind the "uberjar"
mechanism (the class is called Bootstrap) in ClassWorlds. It's not
quite what you want but might provide some good sample code.

http://classworlds.codehaus.org/index.html

Of course if it's still not fast enough then native code may be your
only choice. You might consider a portable C++ windowing framework like
WxWindows in the interest of creating a launcher that's as portable as
the Java code. That has overhead, though, and if you just want to
support one or two platforms then straight native APIs may be better.

Finally, it's worth asking whether Java Web Start is an option. After
all, it does all of the above for you and exists on all JDK 1.4
platforms.

Hope that helps.

--kd

On Apr 26, 2004, at 5:35 PM, Bryan Waters wrote:

> I'm trying to build an auto-upgrade system for a java app that i built
> that
> runs on the mac. I have the system working but the problem is
> replacing the
> .jar file of the app itself while the app is running...also, there is a
> signficant issue with launch speed, so what i want to do is build a
> native
> app that moves the upgrade files into place (after they have already
> been
> downloaded of course) and puts up a splash screen while doing it...
>
> I have a shell script that is designed to do just that but i have to
> be able
> to launch the shell script from a native app. 2 questions: first, any
> comments or thoughts about how i'm going about this...second, how do i
> run a
> mac osx shell script as a child process of another app and then launch
> my
> java application after all that is done.
>
> TIA
> _______________________________________________
> java-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/java-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Mac Launcher (From: Kyle Downey <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.