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: Setting environment variables



"Don Clark" <email@hidden> wrote:

>I need to set an environment variable for a double-clickable Java
>application,

Then you want a prelude shell-script in the application's app-bundle, as
described here:
<http://www.amug.org/~glguerin/howto/More-open-files.html>

Ignore the specific about raising limits, and instead concentrate on the
generalization of a prelude shell-script. This leads to the following, for
/bin/sh:
export YOUR_ENV_VAR=valueYouWantItToHave

The same approach also applies to Erich Roth's remarkably similar question.
In that case, the prelude must be put into the app-bundle AFTER Jar Bundler
has created it. There is no way to tell Jar Bundler to bundle a
shell-script and a jar into an application.


>that takes effect in the shell that runs java.exe (and
>subsequently my app).

In a double-clicked app, there isn't usually a shell. And there isn't any
".exe" suffix on the 'java' command either. And it isn't actually
executing the 'java' command, but a native launcher which creates a JVM,
reads Info.plist, and acts accordingly. Mac OS X isn't Windows.


>This is necessary to get around a bug that crashes my
>app when launching a browser from within the app, given specific
>circumstances that are out of my control. Is there any way to either a)
>package up the double-clickable app so that the environment variable is set
>at the outset; or b) set an envrionement variable within the parent shell
>from within the Java application?

The prelude shell-script will do (a).

A prelude shell-script will only work on 10.2 and up. If you need to set
env-vars on 10.1 or 10.0, the simplest way I can think of to do it is
described here:
<http://developer.apple.com/qa/qa2001/qa1067.html>

-- GG
_______________________________________________
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.




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.