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

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

page 6 of 18




      newenvp = environ;

      {
	char *newexec = execname;
#ifdef DUAL_MODE
	/* 
	 * If the data model is being changed, the path to the
	 * executable must be updated accordingly; the executable name
	 * and directory the executable resides in are separate.  In the
	 * case of 32 => 64, the new bits are assumed to reside in, e.g.
	 * "olddir/LIBARCH64NAME/execname"; in the case of 64 => 32,
	 * the bits are assumed to be in "olddir/../execname".  For example,
	 *
	 * olddir/sparcv9/execname
	 * olddir/amd64/execname
	 *
	 * for Solaris SPARC and Linux amd64, respectively.
	 */

	if (running != wanted) {
	  char *oldexec = strcpy(JLI_MemAlloc(strlen(execname) + 1), execname);
	  char *olddir = oldexec;
	  char *oldbase = strrchr(oldexec, '/');

	
	  newexec = JLI_MemAlloc(strlen(execname) + 20);
	  *oldbase++ = 0;
	  sprintf(newexec, "%s/%s/%s", olddir, 
		  ((wanted==64) ? LIBARCH64NAME : ".."), oldbase);
	  argv[0] = newexec;
	} 
#endif

	(void)fflush(stdout);
	(void)fflush(stderr);
	execve(newexec, argv, newenvp);
	perror("execve()");

	fprintf(stderr, "Error trying to exec %s.\n", newexec);
	fprintf(stderr, "Check if file exists and permissions are set correctly.\n");

#ifdef DUAL_MODE
	if (running != wanted) {
	  fprintf(stderr, "Failed to start a %d-bit JVM process from a %d-bit JVM.\n",
		  wanted, running);
#  ifdef __sun

#    ifdef __sparc
	  fprintf(stderr, "Verify all necessary J2SE components have been installed.\n" );
	  fprintf(stderr,
		  "(Solaris SPARC 64-bit components must be installed after 32-bit components.)\n" );
#    else 
	  fprintf(stderr, "Either 64-bit processes are not supported by this platform\n");
	  fprintf(stderr, "or the 64-bit components have not been installed.\n");
#    endif
	}
#  endif
#endif

      }

      exit(1);
    }

}


/*
 * On Solaris VM choosing is done by the launcher (java.c).
 */
static jboolean
GetJVMPath(const char *jrepath, const char *jvmtype,
	   char *jvmpath, jint jvmpathsize, char * arch)
{
    struct stat s;
    
    if (strchr(jvmtype, '/')) {
	sprintf(jvmpath, "%s/" JVM_DLL, jvmtype);
    } else {
	sprintf(jvmpath, "%s/lib/%s/%s/" JVM_DLL, jrepath, arch, jvmtype);
    }
    if (_launcher_debug)
      printf("Does `%s' exist ... ", jvmpath);

    if (stat(jvmpath, &s) == 0) {
	if (_launcher_debug) 
	  printf("yes.\n");
	return JNI_TRUE;
    } else {
	if (_launcher_debug)
	  printf("no.\n");
	return JNI_FALSE;
    }
}

/*
 * Find path to JRE based on .exe's location or registry settings.
 */
static jboolean
=6=

1|2|3|4|5| < PREV = PAGE 6 = NEXT > |7|8|9|10|11|12|13|14|15.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.0131519 wallclock secs ( 0.00 usr + 0.01 sys = 0.01 CPU)