[fedora-java] Re: [JPackage-discuss] extension directories
Thomas Fitzsimmons
fitzsim at redhat.com
Mon Jan 16 17:06:06 UTC 2006
Hi,
On Sun, 2006-01-15 at 15:55 -0800, Anthony Green wrote:
> On Sun, 2006-01-15 at 18:07 -0500, David Walluck wrote:
> > > If we also want it to look
> > > in /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/lib/ext then we should
> > > probably do this has a java-gcj-compat hack.
> >
> > It seems we have to add this to be consistent.
>
> Ok, here's my proposed patch. Tom - what do you think?
>
>
> --- java.c~ 2006-01-15 15:51:43.000000000 -0800
> +++ java.c 2006-01-15 15:51:49.000000000 -0800
> @@ -1,5 +1,5 @@
> -/* java.c -- set LD_LIBRARY_PATH, LD_PRELOAD and exec gij
> - Copyright (C) 2005 Red Hat
> +/* java.c -- set LD_LIBRARY_PATH, LD_PRELOAD, java.ext.dirs and exec gij
> + Copyright (C) 2005, 2006 Red Hat
>
> This file is part of java-gcj-compat.
>
> @@ -40,6 +40,31 @@
> #include <string.h>
> #include <unistd.h>
>
> +/* Return argv with -Djava.ext.dirs set properly, however, don't
> + change argv if -Djava.ext.dirs is already on the command line. */
> +char **
> +set_java_ext_dir (int argc, char *argv[])
> +{
> + char **nargv;
> + int i = 1;
> +
> + while (i < argc && *argv[i] == '-')
> + {
> + if (strncmp ("-Djava.ext.dirs=", argv[i], 16) == 0)
> + return argv;
> + else
> + i++;
> + }
> +
> + nargv = (char **) malloc ((argc + 2) * sizeof(char *));
> + nargv[0] = argv[0];
> + nargv[1] = "-Djava.ext.dirs=" JAVA_HOME "/jre/lib/ext:/usr/share/java-ext";
Should we still include /usr/share/java-ext? That seems incompatible
since no proprietary JVM would include that directory.
> + for (i = 2; i <= argc; i++)
> + nargv[i] = argv[i-1];
> + nargv[i] = 0;
> + return nargv;
> +}
> +
> int
> main (int argc, char* argv[])
> {
> @@ -111,7 +136,7 @@
>
> free (newpath);
>
> - error_code = execv (GCJ_BIN_DIR "/gij", argv);
> + error_code = execv (GCJ_BIN_DIR "/gij", set_java_ext_dir (argc, argv));
>
> fprintf (stderr, "error spawning gij\n");
>
>
>
Do we need a similar change in javac?
Tom
More information about the java-devel
mailing list