File.exists() does not work on mac for non-English characters on Java 7 on Mac
Scott Kovatch
scott.kovatch at oracle.com
Thu Oct 11 08:13:28 PDT 2012
That's not a bad solution for the short term. I'm not aware of any way to set an environment variable in a JNLP file. Does your application ask for all-permissions? If so you could use a native library to set it.
We need to set this in javaws. I'll make sure I file a bug and fix it, since it's easy to do in the javaws native launcher.
-- Scott K.
On Oct 11, 2012, at 5:05 AM, Þorvaldur Blöndal <thorvaldur at sidelinesports.com> wrote:
> Thanks Scott.
>
> The LC_TYPE makes all the difference. The problem is that I don't know how to pass it to a webstarted program. Do you know how?
>
> The only thing I've come up with is to have a tiny webstarted program that calls javaws (with LC_TYPE in the environment) that starts the real jnlp. Something like this dirty dirty hack:
>
> public static void main(String[] args) throws Exception
> {
> String wsUrl = null;
> for (String arg : args)
> if (arg.startsWith("wsUrl="))
> wsUrl = arg.substring("wsUrl=".length());
>
> final ProcessBuilder pb = new ProcessBuilder("/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/javaws", wsUrl);
> pb.environment().put("LC_CTYPE", "UTF-8");
>
> Thread t = new Thread()
> {
> public void run()
> {
> try
> {
> pb.start();
> }
> catch (Throwable e)
> {
> e.printStackTrace();
> }
> finally
> {
> System.exit(0);
> }
> }
> };
> t.setDaemon(false);
> t.start();
> }
>
>
> ----- Original Message ----- From: "Scott Kovatch" <scott.kovatch at oracle.com>
> To: "David Kocher" <dkocher at sudo.ch>
> Cc: "Thorkelsson" <thorkelsson at sidelinesports.com>; "Þorvaldur Blöndal" <thorvaldur at sidelinesports.com>; <macosx-port-dev at openjdk.java.net>
> Sent: Wednesday, October 10, 2012 3:58 PM
> Subject: Re: File.exists() does not work on mac for non-English characters on Java 7 on Mac
>
>
> We fixed/worked around this in the plugin by setting the environment variable LC_CTYPE to UTF-8. Given that file names are in UTF-8 by default on OS X this seems unnecessary to me, but there you go.
>
> -- Scott K.
More information about the macosx-port-dev
mailing list