0

I've not had success setting up an environment variable on El Capitan. Nothing to do with dock or bash shell. Trying to run a java gui which requires an environment path variable to a JDBC driver to connect to an oracle db: http://docs.oracle.com/cd/E11882_01/install.112/e38228/inst_task.htm#BABBBHJH

I have tried methods:

In each case, the export command at Terminal does not show the new variable.

What is correct method for El Capitan?

Is "JDBC" an acceptable name for the variable? Or am I supposed to label it PATH? I notice the export command already lists a PATH item, and I am afraid to overwrite it:

declare -x PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands"

Is /Users/mac_admin/Downloads/Oracle/instantclient_12_1 an acceptable location for the files?

thx

Community
  • 1
  • 1
johny why
  • 2,047
  • 7
  • 27
  • 52
  • What are you trying to do? Are you trying to get some JDBC binary thing to work from a bash shell OR are you trying to get something to work from the Dock? In OS X, the Dock is "special" in that it DOESN'T get the user's environment. Kind-of sucks, really. – Bob Kuhar Sep 27 '16 at 16:54
  • nothing to do with dock or bash shell. Trying to run a java gui which requires an environment path variable to a JDBC driver to connect to an oracle db: http://docs.oracle.com/cd/E11882_01/install.112/e38228/inst_task.htm#BABBBHJH – johny why Sep 27 '16 at 17:38

1 Answers1

0

It kind-of matters where you want to use this. If you are just trying to get some binary utility to run from Terminal shells you launch add an export into ~/.bash_profile and you are good to go: export JDBC='Robert was here'

tcc-rkuhar:scouting robert.kuhar$ source ~/.bash_profile
tcc-rkuhar:scouting robert.kuhar$ echo $JDBC
Robert was here

You need the equals sign to get the environment variable set. Assuming that the value you've put in the export JDBC is a directly that has the binaries you want to execute. The line in your ~/.bash_profile is probably...

export JDBC=/Users/mac_admin/Downloads/Oracle/instantclient_12_1
PATH="${PATH}:$JDBC"

You'll know this worked if you

echo $PATH
/usr/local/bin:...blah...blah...blah::/Users/mac_admin/Downloads/Oracle/instantclient_12_1
Bob Kuhar
  • 10,838
  • 11
  • 62
  • 115
  • not trying to run something from terminal shells. Trying to run a java gui which requires an environment path variable to a JDBC driver to connect to an oracle db: http://docs.oracle.com/cd/E11882_01/install.112/e38228/inst_task.htm#BABBBHJH – johny why Sep 27 '16 at 17:39
  • @johnywhy so this answer should work. Just note that the equals sign is required to get the value into the environment variable. If the value of JDBC isn't to some directory containing executable binaries,, you don't need the whole ```PATH="${PATH}:$JDBC"``` thing – Bob Kuhar Sep 27 '16 at 18:08
  • unclear. is this the solution? do i just run this at a command line? `export JDBC='Robert was here'`? – johny why Sep 27 '16 at 18:16
  • @johnywhy I really don't know that the oracle tool is doing with that environment variable, but, yes, the ```export JDBC='something_meaningful_to_oracle'``` will set an environment variable called JDBC and make it available to processes started through this shell. What oracle wants that value to be, I don't know. – Bob Kuhar Sep 27 '16 at 22:50
  • Hi @BobKuhar, thx for reply. "available to processes started through this shell" --the lifetime of the variable is only the lifetime of the terminal session, with your method? Need a permanent environment variable. – johny why Sep 28 '16 at 19:21
  • @johnywhy there is no such thing as a "permanent environment variable". An environment is an environment. You need to know what environment(s) you want your crap to run in. If you can't figure out what environment you need this in, I can't help you. – Bob Kuhar Oct 02 '16 at 05:12
  • i may misunderstand Mac. In Windows, you can create permanent environment variables, that last beyond the lifetime of a console window. Is that not possible in Mac? Your answer appears to be 2 different answers... or something -- can you clarify? – johny why Oct 02 '16 at 17:40