On Tue, Jun 07, 2005 at 01:08:27PM +0900, Ito Kazumitsu wrote:
> > Kaffe invoked with -jar option failes if the environment variable
>                                  fails
> > CLASSPATH is set.  Please see the following test case.
> 
> How about this?
> 
> --- kaffe/kaffe/main.c.orig   Tue May 31 06:16:02 2005
> +++ kaffe/kaffe/main.c        Tue Jun  7 13:00:52 2005
> @@ -130,6 +130,17 @@
>               }
>  #endif
>       }
> +     /* classpath may be changed later, so we copy it to a newly allocated
> +        area so that the memory can be freed. */
> +     if (cp != NULL) {
> +             char* newcp;
> +             if ((newcp = malloc(strlen(cp) + 1)) == NULL) {
> +                     fprintf(stderr,  _("Error: out of memory.\n"));
> +                     exit(1);
> +             }
> +             strcpy(newcp, cp);
> +             cp = newcp;
> +     }
>       vmargs.classpath = cp;
>  
>          cp = getenv(LIBRARYPATH1);
> @@ -499,15 +510,17 @@
>                               + strlen(argv[i])
>                               + 1;
>  
> -                     /* Get longer buffer FIXME:  free the old one */
> +                     /* Get longer buffer */
>                       if ((newcpath = malloc(cpathlength)) == NULL) {
>                               fprintf(stderr,  _("Error: out of memory.\n"));
>                               exit(1);
>                       }
>  
>                       /* Construct new classpath */
> -                     if( vmargs.classpath != 0 )
> +                     if( vmargs.classpath != 0 ) {
>                               strcpy(newcpath, vmargs.classpath);
> +                             free(vmargs.classpath);
> +                     }
>                       else
>                               newcpath[0] = '\0';
>                       strcat(newcpath, path_separator);
> 
> _______________________________________________
> kaffe mailing list
> [email protected]
> http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

CLASSPATH and -classpath have to get completely ignored when using -jar.
The only valid CLASSPATH is the Class-Path entry in the manifest of the jar.


Michael
-- 
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html

Join the community at http://planet.classpath.org/

_______________________________________________
kaffe mailing list
[email protected]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to