PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Java|launcher|java_md.c =

page 3 of 18



      char* newpath	= NULL; /* path on new LD_LIBRARY_PATH */
      char* lastslash	= NULL;

      char** newenvp	= NULL; /* current environment */

      char** newargv	= NULL;
      int    newargc	= 0;
#ifdef __sun
      char*  dmpath	= NULL;  /* data model specific LD_LIBRARY_PATH,
				    Solaris only */
#endif    

      /*
       * Starting in 1.5, all unix platforms accept the -d32 and -d64
       * options.  On platforms where only one data-model is supported
       * (e.g. ia-64 Linux), using the flag for the other data model is
       * an error and will terminate the program.
       */

      { /* open new scope to declare local variables */
	int i;

	newargv = (char **)JLI_MemAlloc((argc+1) * sizeof(*newargv));
	newargv[newargc++] = argv[0];

	/* scan for data model arguments and remove from argument list;
	   last occurrence determines desired data model */
	for (i=1; i < argc; i++) {

	  if (strcmp(argv[i], "-J-d64") == 0 || strcmp(argv[i], "-d64") == 0) {
	    wanted = 64;
	    continue;
	  }
	  if (strcmp(argv[i], "-J-d32") == 0 || strcmp(argv[i], "-d32") == 0) {
	    wanted = 32;
	    continue;
	  }
	  newargv[newargc++] = argv[i];

#ifdef JAVA_ARGS
	  if (argv[i][0] != '-')
	    continue;
#else
	  if (strcmp(argv[i], "-classpath") == 0 || strcmp(argv[i], "-cp") == 0) {
	    i++;
	    if (i >= argc) break;
	    newargv[newargc++] = argv[i];
	    continue;
	  }
	  if (argv[i][0] != '-') { i++; break; }
#endif
	}

	/* copy rest of args [i .. argc) */
	while (i < argc) {
	  newargv[newargc++] = argv[i++];
	}
	newargv[newargc] = NULL;

	/* 
	 * newargv has all proper arguments here
	 */
    
	argc = newargc;
	argv = newargv;
      }

      /* If the data model is not changing, it is an error if the
	 jvmpath does not exist */
      if (wanted == running) {
	/* Find out where the JRE is that we will be using. */
	if (!GetJREPath(jrepath, so_jrepath, arch, JNI_FALSE) ) {
	  fprintf(stderr, "Error: could not find Java 2 Runtime Environment.\n");
	  exit(2);
	}

	/* Find the specified JVM type */
	if (ReadKnownVMs(jrepath, arch, JNI_FALSE) < 1) {
	  fprintf(stderr, "Error: no known VMs. (check for corrupt jvm.cfg file)\n");
	  exit(1);
	}

	jvmpath[0] = '\0';
	jvmtype = CheckJvmType(_argcp, _argvp, JNI_FALSE);

	if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, arch )) {
	  fprintf(stderr, "Error: no `%s' JVM at `%s'.\n", jvmtype, jvmpath);
	  exit(4);
	}
      } else {  /* do the same speculatively or exit */
#ifdef DUAL_MODE
	if (running != wanted) {
	  /* Find out where the JRE is that we will be using. */
	  if (!GetJREPath(jrepath, so_jrepath, ((wanted==64)?LIBARCH64NAME:LIBARCH32NAME), JNI_TRUE)) {
	    goto EndDataModelSpeculate;
	  }

	  /*
	   * Read in jvm.cfg for target data model and process vm
	   * selection options.
=3=

1|2| < PREV = PAGE 3 = NEXT > |4|5|6|7|8|9|10|11|12.18

UP TO ROOT | UP TO DIR | TO FIRST PAGE

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.010401 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)