From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55403 invoked by alias); 18 Dec 2017 11:35:18 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 55380 invoked by uid 89); 18 Dec 2017 11:35:17 -0000 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 Received: from mx-us-aus-01.bmc.com (HELO mx-us-aus-01-int.bmc.com) (198.175.230.158) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Dec 2017 11:35:16 +0000 Received: from pps.filterd (mx-us-aus-01-int.bmc.com [127.0.0.1]) by mx-us-aus-01-int.bmc.com (8.16.0.20/8.16.0.20) with SMTP id vBIBZEq9016964 for ; Mon, 18 Dec 2017 11:35:14 GMT Received: from hou-exmbprd-02.adprod.bmc.com ([172.17.1.86]) by mx-us-aus-01-int.bmc.com with ESMTP id 2evrr24hj6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 18 Dec 2017 11:35:14 +0000 Received: from HOU-EXMBPRD-03.adprod.bmc.com (172.17.1.87) by hou-exmbprd-02.adprod.bmc.com (172.17.1.86) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 18 Dec 2017 05:35:08 -0600 Received: from HOU-EXMBPRD-03.adprod.bmc.com ([192.168.34.75]) by hou-exmbprd-03.adprod.bmc.com ([192.168.34.75]) with mapi id 15.00.1347.000; Mon, 18 Dec 2017 05:35:08 -0600 From: "Toke, Mahesh" To: "cygwin@cygwin.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 13:10:00 -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 X-SW-Source: 2017-12/txt/msg00167.txt.bz2 --_002_e94789226dd64626944bc4029433ef08houexmbprd03adprodbmcco_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-length: 2297 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 Content-length: 219 -- 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_--