web stats
Environment variables different from terminal when calling getenv - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-24-2019, 06:41 AM
mfortin mfortin is offline
What's HL7?
 
Join Date: May 2019
Posts: 2
mfortin is on a distinguished road
Default Environment variables different from terminal when calling getenv

Hello guys,

I am trying to set an environment variable to use in Mirth, but it does not show up when I call

var tempdir = java.lang.System.getenv("TMP"); // returns null
logger.debug(java.lang.System.getenv());

{PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, LANGUAGE=en_CA:en, INVOCATION_ID=bc84eb42ff8e4a7c8ba270c72234b2cc, JOURNAL_STREAM=8:13430, OLDPWD=/usr/lib/jvm/java-8-openjdk-amd64/jre, PWD=/opt/mirthconnect, LANG=en_CA.UTF-8}


There should be other variables here, such as USER and HOME, which also return null when I call getenv("USER").

This is on a fresh Debian 9.9 install in Virtualbox, I installed VB guest additions and Mirth 3.7.1 (sh version) only.

Thanks for your help!


Here is the error log:

[2019-05-24 09:31:36,148] ERROR (com.mirth.connect.server.controllers.DonkeyEngine Controller:1570): Error executing global deploy script.
com.mirth.connect.server.util.javascript.JavaScrip tExecutorException: com.mirth.connect.server.MirthJavascriptTransforme rException: SOURCE CODE:
98: function doScript() {99: var tempdir = java.lang.System.getenv("TMP");100: 101: logger.debug(java.lang.System.getenv());102: 103: globalMap.put("testDir", tempdir);104: 105: var testDir = new Packages.java.io.File(globalMap.get("testDir"));10 6: if (!testDir.exists()) try {107:
testDir.mkdir();LINE NUMBER:
103DETAILS:
Wrapped java.lang.NullPointerException
at Deploy:103 (doScript)
at Deploy:113
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.execute(JavaScriptUtil.java:75)
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeGlobalDeployScript(JavaScriptUtil.jav a:431)
[...]
Reply With Quote
 

Tags
debian, error, getenv, javascript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:12 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation