JNI

This is a discussion on JNI within the C Programming forums, part of the General Programming Boards category; Hi i am trying to use JVM in C, to run JBoss AS, i have already run it but now ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    14

    JNI

    Hi i am trying to use JVM in C, to run JBoss AS, i have already run it but now i need to stop it, JBoss has two bat files to do it, one for run and the other for stop, i am trying to use two diferent JVM but in the second it doesnīt recognize the JVM some help here itīs my code

    Code:
    JNIEnv* create_vmStart(char *path[]) {
    	
    	JNIEnv* env;
    	JavaVM* jvm;
    	JavaVMInitArgs args;
    	JavaVMOption options[7];
    	
    	
    	/* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */
    	args.version = JNI_VERSION_1_4;
    	args.nOptions = 4;
    	
    	options[6].optionString = "-Dsun.rmi.dgc.server.gcInterval=3600000";
    	options[5].optionString = "-Dsun.rmi.dgc.client.gcInterval=3600000";
    	options[4].optionString = "-server";
    	options[3].optionString = "-Xmx512m";
    	options[2].optionString = "-Xms128m";
    	options[1].optionString = "-Djava.endorsed.dirs=C:\\jboss-4.0.4.GA\\lib\\endorsed\\resolver.jar;"
    	                          "C:\\jboss-4.0.4.GA\\lib\\endorsed\\xalan.jar;"
    	                          "C:\\jboss-4.0.4.GA\\lib\\endorsed\\xml-apis.jar;"
    	                          "C:\\jboss-4.0.4.GA\\lib\\endorsed\\serializer.jar";
    	options[0].optionString = path;
    	
    	args.options = options;	
    	args.ignoreUnrecognized = JNI_FALSE;	
    
    	JNI_CreateJavaVM(&jvm, (void **)&env, &args);
    	
    	return env;
    }
    and the second virtual machine its something like

    Code:
    JNIEnv* create_vmStop(char *path[]) {
    	
    	JNIEnv* env;
    	JavaVM* jvm;
    	JavaVMInitArgs args;
    	JavaVMOption options[1];
    	
    	
    	/* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */
    	args.version = JNI_VERSION_1_4;
    	args.nOptions = 1;
    	
    	options[0].optionString = path;
    	
    	args.options = options;	
    	args.ignoreUnrecognized = JNI_FALSE;	
    
    	JNI_CreateJavaVM(&jvm, (void **)&env, &args);
    	
    	return env;
    }
    the porpuse to do this its to set to diferent kind of options one for start and other for stop, because they need different JAR files

    when i call the second function env its 0xccccccc and jvm too some help???
    Last edited by Salem; 01-03-2007 at 02:35 PM. Reason: fold long lines

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Timers
    By Deb in forum C Programming
    Replies: 16
    Last Post: 04-23-2007, 10:15 AM
  2. stdout with JNI
    By GoLuM83 in forum C Programming
    Replies: 4
    Last Post: 12-14-2006, 12:27 PM
  3. Does anybody know how can we use Java to prepare a C HeaderFile
    By arvindkr_1999 in forum C++ Programming
    Replies: 8
    Last Post: 04-28-2004, 03:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21