![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Enviornment Variable in B shell (I call it nested variable) | princelinux | Shell Programming and Scripting | 4 | 07-01-2008 10:35 PM |
| Setting environment variable on a remote solaris machine using shell script | eamani_sun | Shell Programming and Scripting | 1 | 05-30-2008 07:05 PM |
| Setting Environment Variable date | d3ck_tm | High Level Programming | 6 | 11-08-2006 02:33 AM |
| Setting up Environment Variables | rpandey | Shell Programming and Scripting | 6 | 06-06-2005 06:28 AM |
| setting environment variables ??? | Gargamel | UNIX for Dummies Questions & Answers | 5 | 06-13-2002 08:12 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Setting environment variable using JNI call
I have function declaration in Java and same function definition written in C programming language.. A JNI call from Java is made to a fuction...Function would set the environment variable { putenv(cEnvString1);} using C-built -in function ..and later return the encrypted string...
putenv is used to set the environment variable in C...Is there any alternate function to set the environment variable..? Looks like putenv is working here. getenv function works well.. C function definition for a JNI call:- ----------------------------------------- JNIEXPORT jstring JNICALL Java_gdm_schema_main_encryption_encryptStr (JNIEnv *j_env, jobject j_obj) { char *cConnString = NULL ; char *cEnvUserPasswd = NULL; char cEnvString1[200]= {"FND_HIDDEN_USERPASS="}; /** ** If environment variable is not set **/ /* if (cEnvUserPasswd == NULL) { fprintf(stderr,"\nError in finding connect string info. exiting ...Shafi\n"); exit(-1); } */ /** ** If Environment variable contains unencrypted login-password ** i.e. called directly from bin, return it . **/ /* if (strchr(cEnvUserPasswd , (int)'/') != NULL) return convertToJavaString( j_env, cEnvUserPasswd ,strlen(cEnvUserPasswd)); else { cConnString = process_string ("INSTALL/install@fnd9i", "0", ENCRYPT); return convertToJavaString( j_env, cConnString , strlen(cConnString)); } */ fprintf(stderr,"\nEncryption block.... ...\n"); cConnString = process_string ("INSTALL/install@fnd9i", "0", ENCRYPT); putenv("FND_HIDDEN_USERPASS=NONE"); /* Prepare string for putenv function sprintf(cEnvUserPasswd,"%s",cConnString); */ strcat(cEnvString1,cConnString); /* Keep the Connect string and position in Environment */ putenv(cEnvString1); fprintf(stderr,"\nAfter calling encryption %s.... ...\n",cEnvString1); fprintf(stderr,"\nAfter calling encryption %s..%s..%d ...\n",j_env,cConnString,strlen(cConnString)); return convertToJavaString( j_env, cConnString , strlen(cConnString)); } ------------------------ |
| Forum Sponsor | ||
|
|