| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| Hi. I need that, in some circumstances, my Java application restarts itself. In a first moment I thought it was as easy as: Runtime.getRuntime().exec("/usr/bin/open " + app); System.exit(0); where app contains the full path of the application .app file. Indeed it doesn't work. After some tryings I discovered that this works: File file = File.createTempFile("blueMarine-restart-", ".sh"); PrintWriter pw = new PrintWriter(new FileWriter(file)); pw.println("sleep 1"); pw.println("open " + app); pw.close(); Runtime.getRuntime().exec("/bin/sh " + file.getAbsolutePath()); System.exit(0); Basically it looks like the sleep 1 is fundamental - I think because if I try to relaunch the application itself while it's still alive, Mac OS X doesn't nothing. Can you confirm this? Does somebody have a simpler working code? Thanks. -- Fabrizio Giudici, Ph.D. - Java Architect, Project Manager Tidalwave s.a.s. - "We make Java work. Everywhere." mobile: +39 348.150.6941 - fax: +39 027.005.105.36 |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.