Java and UNIX environment variables
Hi folks,
am I right when I say that it is not possible to access UNIX environment variables from Java (these ones delared by the export statement)?
Cheers,
Heiko
Yes.. Since some OS do not have the concept of environment variables,it is directly not possible.
But using the method System.getProperties you can get
some inf about the environment.
the following links may be of some help to you
http://www.javaworld.com/javaworld/javaqa/2001-07/01-qa-0706-env.html
http://www.jguru.com/faq/view.jsp?EID=11422
Similar Messages
-
XSL variable and unix environment variable
Any idea how I can pass the unix environment variable to the custom XSL file? I want to be able to pass the $PO_TOP path so the file location can be derived
The below code works fine for static file location but I want it to be more generic.
<fo:block xsl:use-attribute-sets="termcond">
<xsl:if test="($print_draft = '')">
<xsl:value-of select="unparsed-text('/usr/tmp/tc.txt','UTF-8')"/>
</xsl:if>
</fo:block>
<fo:block id="last-page"/>
Thanks in advanceyou'll need to use the name(.) XPath function to test the name of the current node.
-
Hi experts m new to apps please help.. I have installed successfully Oracle Apps R12 on OEL - 5 All the services runining fine. but when i am opening forms its giving error "install missing plugins" i installed jre-6u7-linux-i586-rpm.bin and Mozilla Firefox 3.0.18 [root@ust ~]# cd firefox/plugins/ [root@ust plugins]# ln -s /usr/java/jre1.6.0_07/plugin/i386/ns7/libjavaplugin_oji.so ./libjavaplugin_oji.so [root@ust plugins]# ls libjavaplugin_oji.so libnullplugin.so [root@ust plugins]# ll total 20 lrwxrwxrwx 1 root root 58 Sep 11 16:22 libjavaplugin_oji.so -> /usr/java/jre1.6.0_07/plugin/i386/ns7/libjavaplugin_oji.so -rwxr-xr-x 1 root root 19160 Sep 15 2007 libnullplugin.so [root@ust plugins]# but when m trying to open forms at that time giving error "install j2se plugin version 1.6.0_07 on your client and NPX_PLUGIN_PATH environment variable set before starting Netscape."
Linux is not a certified client tier for accessing EBS
Unable to access r12 forms in linux client
https://forums.oracle.com/search.jspa?view=content&resultTypes=&dateRange=all&q=linux+client&rankBy=relevance&contentTyp…
HTH
Srini -
Fetching UNIX environment variables
Does anyone know of a way to fetch a UNIX environment variable into a PL/SQL variable?
Thanks
KerriHi Dave
If you are just running through the conc manager as a regular report you can not do this. At the CM layer publisher is not aware of nor can it be passed environment variables.
If you are on 11.5 why not store the sub template in the template manager and then use our URI to reference it:
xdo://APPCODE.TEMPLCODE.LANG.TERR
Check the user guide.
Regards
Tim -
How to pass Unix environment variable to a SQL procedure or SQL * Plus
Can any body suggest me how to ,
How to pass Unix environment variable to a SQL procedure or SQL * Plus file..
I am trying to invoke a SQL Procedure from Unix
by passing the value of a Unix environment variable.
Is it possible..?
Thanks in advance.
Regards,
Srinivas JaltaruWithin your shell script you can use what is known as a "here document" which is basically a way of wrapping a call to Oracle. The following call to Oracle loops and writes rows to files with numerically increasing file names. Two unix shell variables are used, one in a select statement and one in a spool command :
<pre>
#!/bin/bash
export ORACLE_SID=DEV05
FILENO=1007351
while [ ${FILENO} -le 1008400 ]
do
FILENAME=farm_${FILENO}.txt
DUMMY=`sqlplus -s user20/user20 <<SQLSTOP
set lines 73
set pages 0
set head off
set termout off
set echo off
set feedback off
select rpad(searchx, 8)
from blastx@PRODUCTION
where searchx = ${FILENO} ### here's a shell variable
spool /export/home/user20/sql/psiblast/BACKUP2_D/${FILENAME} ### here's a shell variable
spool off
SQLSTOP`
FILENO=`expr ${FILENO} + 1`
done
exit 0
</pre> -
Runtime.exec and setting environment variables
Runtime.exec and setting environment variables
I need a decent example which works on Windows.
Got any?Thank you.
I was hoping for an example of the use of
http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Runti
e.html#exec(java.lang.String,%20java.lang.String[]) or
http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Runti
e.html#exec(java.lang.String,%20java.lang.String[],%20j
va.io.File) which take environment variable
information such as PATH.
The reason is because there is a library which is
being loaded via loadLibrary (
http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Syste
.html#loadLibrary(java.lang.String) ). However, for
the child process to find the library the PATH needs
to be updated.
Any example regarding changing the PATH variable via
Java so that libraries can be loaded and processes
created? (Perhaps, I should make a new post and
restate the question with this more explicit
information?)
That won't work. LoadLibrary occurs in the JVM environment. As I said you can't change the JVM environment via exec().
If the shared library needs something in the path then you are going to have to set the path before your application starts up.
If you just need to load the library from someplace that is not on the path then you should be using System.load(). -
Installed jre and jdk and setup environment variable
installed jre and jdk and setup environment variable but still i am not able to rum program?
cannot find symbol class string
package system does not existif removing 1 jre will help your disk space problems
then you urgently need a bigger disk.
Btw i never notice Java installing 2 different JRE's
so i dont think it will harm remvong one, make sure
you dont delete one you are using :)I assume that you don't run MS os; that's the only one that installs 2 JRE's.
To OP: This has been discussed by Sun, but no changes have been announced. Maybe the relocation in version 1.5 of the private (aka developer) code to the Program Folder is a start of this change? -
How do I use a UNIX environment variable for the path of a file name
We are running Forms 6i over the web. The forms server runs on a UNIX (HP-UX) machine.
I want to read the contents of a file, which is simple enough, using the TEXT_IO package. However, I want to reference a UNIX environment variable that specifies the file path i.e
PROCEDURE get_file IS
in_file Text_IO.File_Type;
linebuf VARCHAR2(1800);
filename VARCHAR2(200);
BEGIN
filename:= '$LOG_DIR/RCAS181.log';
in_file := Text_IO.Fopen(filename, 'r');
.....other stuff
Notice the filename string references my unix env variable '$LOG_DIR'. However, this doesnt work. If I put the full pathname it works fine.
Any suggestions ?Have a look at TOOL_ENV.GETVAR()
-
Changing UNIX environment variables?
Is there an easy way to change the environment from inside Java-code?
I have tried using the compile version and this works fine.
Compile version:
java -DmyVar="$PATH" myClass
and then used System.setProperty("myVar", "/home/lala");
The above works fine and changes the PATH variable in UNIX, but i don�t want to set these things at compiletime, is there another way?
Thank you for any hints
// addeI want to change the systems environment variable when I run my Java application, what happens when I close the program does not concern me. And I don�t just want to fetch what�s currently there, I want to change them and then use them in my program.
But can you somehow do this without telling the program what variables you are interested in at compile time?
Thank you for your answers -
OMB PLUS - Problem passing Unix environment variables to OMBPlus
Due to a requirement to encapsulate deployment of OWB applications, we currently start OMBPlus.sh from our own wrapper ksh script (deploy.ksh) in order to get the new / changed application into the target control center etc.
We now have a new requirement that means we need to pass the content of the Unix environment across to OMBPlus.sh (and from thence into our deployment tcl scripts).
No problem, if you believe the tcl documentation. The entire Unix environement gets dumped into a hash array called 'env', so you can get the variable's value out just by saying $env(unix_valraible).
Sounds great, it should work a treat.
Except OMBPlus only silghtly resembles tclsh.
The 'env' that gets into OMBPlus bears practically no resemblance to the 'env' that existed before OMBPlus.sh got invoked.
Does anyone have:
a decent explanation for why the env gets scrambled (and how to avoid it) ?
or an alternative method of getting the Unix environment varaible values into OMBPlus ?
Please do not propose passing them all on the command line because (would you beleive it) the values are database passwords !
Edited by: user10466244 on 23.10.2008 09:28Unfortunately, the java implementation of TCL that Oracle used as the basis for OMB+ is NOT a fully-featured implementation. Just try using packages...
However, and understanding why you don't want to hard-code passwords into a file, you can always edit the setowbenv.sh file in your owb/bin/unix directory to grab your specific shell environment variables and propogate them to the java session.
towards the bottom of this env file you will see a section that looks something like:
JDK_HOME=../../../jdk
OWB_HOME=/owb
ORA_HOME=/owb
OEM_HOME=/owb
IAS_HOME=/owb
ORACLE_HOME=/owb
CLASSPATH=Personalties.jar:../admin:$MIMB_JAR:
CLASSPATH_LAUNCHER="-classpath ../admin:../admin/launcher.jar:$CLASSPATH: -DOWB_HOME=$OWB_HOME -DJDK_HOME=$JDK_HOME -DORA_HOME=$ORA_HOME -DOEM_HOME=$OEM_HOME -DIAS_HOME=$IAS_HOME -Doracle.net.tns_admin=$ORA_HOME/network/admin Launcher ../admin/owb.classpath"
export ORA_HOME
export OWB_HOME
export JDK_HOME
export OEM_HOME
export IAS_HOME
export ORACLE_HOME
You could add in the environment variables that you want propogated, include them into the CLASSPATH_LAUNCHER, and then they will turn up in your OMB+ session env array.
e.g., to propgate an environment variable called MY_DATABASE_PASSWORD you would:
JDK_HOME=../../../jdk
OWB_HOME=/owb
ORA_HOME=/owb
OEM_HOME=/owb
IAS_HOME=/owb
ORACLE_HOME=/owb
CLASSPATH=Personalties.jar:../admin:$MIMB_JAR:
CLASSPATH_LAUNCHER="-classpath ../admin:../admin/launcher.jar:$CLASSPATH: -DOWB_HOME=$OWB_HOME -DMY_DATABASE_PASSWORD=${MY_DATABASE_PASSWORD} -DJDK_HOME=$JDK_HOME -DORA_HOME=$ORA_HOME -DOEM_HOME=$OEM_HOME -DIAS_HOME=$IAS_HOME -Doracle.net.tns_admin=$ORA_HOME/network/admin Launcher ../admin/owb.classpath"
export ORA_HOME
export OWB_HOME
export JDK_HOME
export OEM_HOME
export IAS_HOME
export ORACLE_HOME
So now you have no protected data hardcoded, it will pick up your specific environment variables at runtime, and when you start OMB+ you will be able to:
array get env MY_DATABASE_PASSWORD.
cheers,
Mike -
Crystal Reports with Java in Unix Environment
We have Crystal Enterprise Professional Edition and Embedded Edition v10 with us.We want to use them for generating reports in our development project.
We have to generate reports as batch jobs ( scheduled jobs) for which we will have a Java Application running in Z/OS (Unix zSeries). This Java Application will connect to our database(DB2) and retrieve data which should be filled in the report design(template).
1.Can the .rpt file have the design alone(without the data from database).?
2.Can we fill the data from the database using the .rpt file in a Java Application using an API ?
3.Can we export this file(report with data) to a text file with a specific character encoding.?
All the above has to be done using a Java Application that will run in a Z/OS(Unix Environment).
4.Is Java API for the above operations available as a .jar file that can be included in our classpath in UNIX Environment ?
I request you all to help me with these queries as soon as possible.
Million Thanks in Advance.Hi,
It seems that you are having issue with Crystal reports Java SDK's.
Post your question in Java Development - Crystal Reports forum.
That forum is monitored by qualified technicians and you will get a faster response there. Also, all Java Development queries remain in one place and thus can be easily searched in one place.
Thank you for your understanding
Amit
Edited by: Amit Singh on Dec 2, 2008 2:55 PM -
Unix Environment variable for connect string in SQL*Plus
I am using some environment variables to connect to a sql*plus session in unix.
they are exported as part of a file which contains the following and gets executed through the .profile.
export db_username=xxx
export db_password=xxx
export db_name=xxx
i have created a file abc.sql which contains the following
connect $db_username/$db_password@$db_name
Now, I have a shell script which uses this file inside it to connect to a sql*plus session and execute some queries.
The contents of the shell script :
API_CONNECT_SQL=abc.sql
sqlplus /nolog << THEEND
WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK
WHENEVER OSERROR EXIT FAILURE ROLLBACK
set timing on
@${API_CONNECT_SQL}
---- do something
EXIT
THEEND
Now, the sql*plus session is able to get db_username and db_password, but not the db_name. It says "TNS service name not found".
If I hardcode some database name in place of db_name, it connects properly.
Please let me know the problem and solution as well.
Any help appreciated.
thanks,
Vijayfor me this one works
# =========================================
# begin of script
# =========================================
export db_username=alpha
export db_password=bravo
export db_name=charly
echo "connect $db_username/$db_password@$db_name" > xxx.sql
API_CONNECT_SQL=/cfs/dummy1/0/appl/dummy2/rev_04/zzz/tst/xxx.sql
cat ${API_CONNECT_SQL}
sqlplus /nolog << THEEND
spool xxx
WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK
WHENEVER OSERROR EXIT FAILURE ROLLBACK
set echo on
host cat ${API_CONNECT_SQL}
@${API_CONNECT_SQL}
select * from dual;
spool off
EXIT
THEEND
# =========================================
# end of script
# ========================================= -
Overwrite java parameters with environment variables or other mechanism???
I am using several java programs on my machine. Each of them uses some deeply nested startup script so I have no chance to modify the parameters of the java command.
I would need to change certain parameters though, e.g. the heap size or certain system properties.
Is there a way to do this by e.g. setting environment variables or modifying a user-specific configuration file?
I am using jdk 1.5.0_06 on Linux (Ubuntu).Well the ones I am dealing with do not, unfortunately.
I am also interested in a general way to tune the JVM settings without modifying each and every call statement.
Surely there must be some mechanism to achieve this?? -
Getting a Unix environment variable
Hi, everyone.
I need to use a Unix enviroment variable from a form. This form
is gonna use this variable in order to be the path of another
form who is gonna be called.
In other words:
CALL_FORM( $unix_var + '/forms/myform_name' );
unix_var is what I want to get.
Thanks a lot in advance,
EduardoIt worked, Michael. Thanks a lot!
To the documentation guys at Oracle... This is how you define
the TOOL_ENV package in the Forms' help:
"The TOOL_ENV package allows you to interact with Oracle
environment variables by retrieving their values for use in
subprograms."
Suggestion: ...with Oracle environment variables AND OTHER
SYSTEM OPERATION ENVIRONMENT VARIABLES...
because this narrow definition can prevent people for trying to
use it to retrieve other NON-ORACLE environment variable via
this package. Thanks. -
Unable to start java tools - Error : Environment variable JAVA_HOME not set
hi all,
I am not able to start the java tool - Visual Admin, Configtool, etc in the solaris Bash shell.
I was given authorizations on solaris and i'm able to view the logs and browse in solaris boxes,
But, when i try to start Visual Admin, it says" ERROR environment variable JAVA_HOME not set "
Since,my colleagues are using this tool for years, how come the environment variable is not set only for my user profile ?
Is it like the environment variable has to set seperately for every user profile ?
Do i need to set it initially for my profile eventhough it is working for others ?
i am confused..please help.
AddyNicholls, Thanks for your quick reply.
Ofcourse, I use my login ID to use java tools and they use their's obviously.I don't use <SID>adm.
We WRQ reflection for X-Windows and Putty for Command line Solaris Access.
When i try to use VA through the X-Window tool WRQ reflection, I am not able to start the tool.
My doubt here is, Do we need to setup the environment variable for every new user initially for the first time ? ( I am a new user for this environment )
Supposing if i need to setup the environment variable, do i need to set it up for the all the Solaris Boxes i use ?
I am able to browse through the files.when i try to start the VA by giving ./go i am not able to start it up.
Appreciate your time and valuable replies.
Addy
Maybe you are looking for
-
RAM modules on different generations of macbooks
hello, i have recently upgraded the RAM modules of my 2.16GHz macbook core 2 duo. so am left with 2 unused 512mb RAM modules, can i install them on my brother's first generation macbook core duo? thanks.
-
IPhoto 6.4 is running very slow
iPhoto takes several minutes to do anything. Beachball spinning while I wait. I iPhoto library is about 45gigs, I have 200gigs of free space on HD, 8 mg of ram on a MacBook Pro running OS 10.7.5. I have tried removing the com.apple.iPhoto.plist file,
-
Help! Nano is black and wont reset!!!
I had my ipod nano in an iradio it was playing fine, then just went black. It will not reset and my computer will not recognize it. I then put my husbands nano on same iradio and after about 10 minutes did same thing. What happenened, HELP?
-
Differences between ac3 sound conformity
I saved on my Server a different sorts of ac3 "native" assets sound tracks. That's means that I don't create it using a proper software. All audio tracks playing normally on encore 1.5 and I can normally burn and hear on DVD stand alone, but after up
-
Removing address and other functionalities from a window
Hi, I want to remove the address bar and other functionalities from the browser of an external window called from webdynpro. Could you tell me how to do this. Regards, Jayant.