tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
Date Tue, 15 Oct 2002 13:59:49 GMT
mturk       2002/10/15 06:59:49

  Modified:    jk/native2/common jk_vm_default.c
  Log:
  Add the classpath option to the vm:
  
  Revision  Changes    Path
  1.22      +35 -9     jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c
  
  Index: jk_vm_default.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- jk_vm_default.c	8 Jul 2002 13:35:02 -0000	1.21
  +++ jk_vm_default.c	15 Oct 2002 13:59:49 -0000	1.22
  @@ -424,10 +424,11 @@
       jk_map_t *props=jkvm->properties;
       JavaVMInitArgs vm_args;
       JNIEnv *penv;
  -    JavaVMOption options[100];
  +    JavaVMOption options[JK2_MAXOPTIONS * 2];
       JavaVM *jvm;
  -    int optn = 0, err;
  -    
  +    int optn = 0, err, classn = 0, classl = 0, i;
  +    char *classpath = NULL;
  +
       /** Make sure we have the vm dll */
       if( jkvm->jvm_dll_path ==NULL ||
           ! jk2_file_exists(env, jkvm->jvm_dll_path )) {
  @@ -486,14 +487,32 @@
   
       vm_args.version = JNI_VERSION_1_2;
       vm_args.options = options;
  -
  +    for (classn = 0; classn < jkvm->nClasspath; classn++)
  +        classl += strlen(jkvm->classpath[classn]);
  +    if (classl) {
  +        classpath = jkvm->pool->calloc(env, jkvm->pool, 
  +                                       classl + classn + sizeof("-Djava.class.path="));
  +        strcpy(classpath, "-Djava.class.path=");
  +        strcat(classpath, jkvm->classpath[0]);        
  +        for (i = 1; i < classn; i++) {
  +            strcat(classpath, ";");
  +            strcat(classpath, jkvm->classpath[i]);
  +        }
  +    }
       while(jkvm->options[optn]) {
  -        env->l->jkLog(env, env->l, JK_LOG_INFO,
  -                      "vm.openJvm2() Option: %s\n", jkvm->options[optn]);
  +        if (jkvm->mbean->debug > 1)
  +            env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                          "vm.openJvm2() Option: %s\n", jkvm->options[optn]);
           /* Pass it "as is" */
           options[optn].optionString = jkvm->options[optn];
           optn++;
       }
  +    if (classpath) {
  +        if (jkvm->mbean->debug > 1)
  +            env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                          "vm.openJvm2() Classpath: %s\n", classpath);
  +        options[optn++].optionString = classpath;
  +    }
   
       vm_args.nOptions = optn;
       
  @@ -557,10 +576,18 @@
       char *value=valueP;
       
       if( strcmp( name, "OPT" )==0 ) {
  -        jkvm->options[jkvm->nOptions]=value;
  -        jkvm->nOptions++;
  +        if (jkvm->nOptions < JK2_MAXOPTIONS) {
  +            jkvm->options[jkvm->nOptions]=value;
  +            jkvm->nOptions++;
  +        }
       } else if( strcmp( name, "JVM" )==0 ) {
           jkvm->jvm_dll_path=value;
  +    }
  +    else if( strcmp( name, "classpath" )==0 ) {
  +        if (jkvm->nClasspath < JK2_MAXOPTIONS) {
  +            jkvm->classpath[jkvm->nClasspath]=value;
  +            jkvm->nClasspath++;
  +        }
       } else {
           return JK_ERR;
       }
  @@ -580,7 +607,6 @@
       jkvm->pool=pool;
   
       jkvm->jvm_dll_path = NULL;
  -    jkvm->options = pool->calloc( env, pool, 64 * sizeof( char *));
       jkvm->nOptions =0;
   
       jkvm->init=jk2_vm_initVM;
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message