X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :content-type:mime-version; q=dns; s=default; b=MXX143f8Zi50+Vrr X4AHjzIj5HmxiXb6Ape0h3irHEnhGM8cDtEknMhe3RcDNZo8+ZfiSiSmtoubKzS5 sijV1DkB7oZiKvJLh+CjQHpDXChG4hiq79mJAdunMGvnbKILhhNbsZKH4eVr4GMz TuCzAXlOvpnwZeBqGXSnHZk6GsU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :content-type:mime-version; s=default; bh=UAXJIYR1+JBmUnoPuGFsyE 4xpJ8=; b=fHSouIRSkKrkRbGZwY5n1zLHXuBDPPREZdqI81iaf2u8EA/tMEwYmw i53SL116fjMJoa0KMuC7zNUlrtjCTnrQ7QysFOTEtC33/lg25x/tgyS0CLgBskNH P8wEN6UKqPx17HQHEhDppuJInOM4cEst27uuYvcZl9iUMwfpPSqLw= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=appdata, precautions, java, Java X-HELO: mx-us-aus-01-int.bmc.com From: "Toke, Mahesh" To: "cygwin AT cygwin DOT com" CC: "Virulkar, Nitin" , "Badhei, Sankharaj" Subject: Problem to retrieve environment variable values in JVM when Cygwin prompt is used Date: Mon, 18 Dec 2017 11:35:07 +0000 Message-ID: x-ms-exchange-transport-fromentityheader: Hosted Content-Type: multipart/mixed; boundary="_002_e94789226dd64626944bc4029433ef08houexmbprd03adprodbmcco_" MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-18_08:,, signatures=0 X-Proofpoint-Spam-Reason: safe --_002_e94789226dd64626944bc4029433ef08houexmbprd03adprodbmcco_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi,=20 We use Cygwin build and its command prompt in our use cases.=20 Currently, We are facing a problem to retrieve environment variable values = in JVM program. Please find details of issue below : Version details : Currently, cygwin1.7.33 is being used on windows (tried o= n server 2008R2, server 2012) platform.=20 Files attached with this mail : 1. SampleJVM.cpp =3D=3D> C program which evokes JVM and it calls a java met= hod 2. TestEnvironmentVariables.java and TestEnvironmentVariables.class =3D=3D>= Java program containing a method to print environment variables. Precautions : 1. Ensure that jdk is installed on the system.=20 2. In the SampleJVM.cpp program, LoadLibrary() function loads jvm.dll. Plea= se replace the path with local installation path. 3. -Djava.class.path is set to C:\\temp where TestEnvironmentVariables.clas= s file is kept. Please replace C:\\temp with local disk path where TestEnvi= ronmentVariables.class is kept. 4. Compile the program on cygwin command prompt using : g++ SampleJVM.cpp -= o SampleJVM -I"C:\Microsoft\include\jni" -I"C:\Microsoft\include\jni\win32" Ensure that C:\Microsoft\include\jni and C:\Microsoft\include\jni\win32 are= replaced with location of jni.h and jni_md.h file. These files will be pre= sent in jdk installation. 5. Execute the program ./SampleJVM on cygwin prompt Results : PATH, SYSTEMDRIVE, SYSTEMROOT, WINDIR variables are getting printed. Problem : On windows machine, there are many environment variables already set. But t= hey are not getting printed as output of java program. For example APPDATA variable value is coming null hence not printed on the = command prompt. Same program if built using another compiler (e.g. visual studio) and execu= ted on command prompt then it prints all the environment values. As a summary, when a C program spawns a JVM and calls java method, then ins= ide java method, we are not able to retrieve environment variable values. This issue is occurring only when we use Cygwin build and Cygwin command pr= ompt. I did not find related information on this problem on Cygwin faqs link. It = looks like a generic bug with Cygwin build. Please confirm if you are able to run the sample program and reproduce the = issue. Thanks to update me on its status. Regards, Mahesh --_002_e94789226dd64626944bc4029433ef08houexmbprd03adprodbmcco_ Content-Type: text/plain; charset=us-ascii -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --_002_e94789226dd64626944bc4029433ef08houexmbprd03adprodbmcco_--