Set the environment vars
Is there anyway to setup env variables inside java application. In CGI progs, I used to do putenv and setup all the environment I needed. How I can do the same thing in Java servlet or just java.
-Raj
Why?
Changing a env var will not affect anything in java. And it will not propogate back up once it exits either (very limited usage for this last case.)
And if you want to shell, via Runtime.exec() it has a way to set the vars for the shell.
Similar Messages
-
How to set the environment variable of csh
Hello expert,
I set the environment varibale of csh after I upgade the oracle 10.2.0.1 to 10.2.0.5. I added "setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/oracle/client/10x_64/instantclient" to profile ".dbenv_GVSHP101.csh" . But when I run env in my os , it showed LD_LIBRARY_PATH=/usr/sap/IDS/SYS/exe/run:/usr/sap/IDS/SYS/exe/uc/linuxx86_64:/oracle/IDS/102_64/lib:/oracle/client/10x_64/instantclient:/oracle/client/10x_64/instantclient
. There are two :/oracle/client/10x_64/instantclient in my environment varibale. I do not why. How can I set the environment? Thanks a lot.Hallo,
I don't know which O/S you are using and how your .dbenv-files looks.
However, as quick work around you could just add the following lines to the end of .dbenv_<hostname>.csh:
unsetenv LD_LIBRARY_PATH
setenv LD_LIBRARY_PATH /usr/sap/IDS/SYS/exe/run:/usr/sap/IDS/SYS/exe/uc/linuxx86_64:/oracle/IDS/102_64/lib:/oracle/client/10x_64/instantclient
Regards,
Thomas. -
Setting the environment variable
I just installed the rpm for the 1.4 SDK on my RedHat 7.1 box. Does anyone know how I can set the environment variable so it will recognize Java from the command line? Thanks in advance.
You need to set a couple of environment variables in your "profile" script. Which one, exactly, depends on the shell you use. It's probably .profile on your home directory.
Try
JAVA_HOME=/usr/java1.4 (or wherever it really is)
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME,PATH -
How to set the Environment Variable
I'm going through a tutorial on how to create an application and run from the command prompt. I have finished installing my jdk 6 Upadate 5 but i don't know how to set the Environment Variable for the javac compiler and the java interpreter to find my program.
I have created an application called "ExampleProgram" and have saved it on drive C:. How do i set the Environment Variable so that the "javac" compiler and the "java" interpreter can find itgyesa_say wrote:
I'm using Windows XP Service Pack 2.A very bad choice to go with Windows. Personally I prefer Linux.
I Google and had several information on how set it, but i tried all of them and none seem to work.I typed "how to set environmental variable in winxp" in Google and the very first link provided all the information I needed (you need). These things will make much more sense if you go through it yourself rather than having someone else spoon-fed you the answer. -
How to set the environment for Oracle XE-database.
Hi,
I have a:- lsnrctl command not found,
And when I echo oracle host & path I got:-
[oracle@ddcdevws02 etc]$ echo $ORACLE_HOST
[oracle@ddcdevws02 etc]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/u02/oracle/bin
Now I know that my environment is not set, but could anyone please assist me how I can set the environmernt ??? I mean commands or detailed instruction step as to what needs to be set where & how, I mean the SID, port, Path ???, I am new to Linux as well as database .
When I see the listener process using this:- ps -ef | grep tnslsnr, this is the output:-
[oracle@ddcdevws02 ~]$ ps -ef | grep tnslsnr
oracle 14727 1 0 14:25 ? 00:00:00 /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr LISTENER -inherit
oracle 22618 21569 0 15:59 pts/2 00:00:00 grep tnslsnr
So does this mean that my Oracle home is "/usr/lib/oracle/xe/app/oracle/product/10.2.0/" ???
Also In the host file under /etc/ directory I have these settings
127.0.0.1 localhost.localdomain localhost
10.201.60.21 ddcdevws02.hddev.healthdialog.com ddcdevws02
I don't know if this is correct or not ? But I doubt I could make any change in the host file, please suggest me.
Thanks
Samuser8692703 wrote:
I am sorry Ed I reliazed that that was Phirir's suggestion to me, & Yes this is XE-Oracle database .... so the sid name would be "XE" ...?? I am sorry for my stupid questions as I am very new to ths .
I've never worked with XE, but from everything I've seen, that would also be your SID. check the contents of /etc/oratab
And then what other details required after I run this command ". oraenv", can I run this from any directory or some specific location ?
Just like any command, you can run it from anywhere as long as the directory is in your PATH.
But actually, you should be setting this in your profile, so that you just inherit it when you log on to the server. Depending on your OS, that would be either $HOME/.profile or $HOME/.bash_profile. Here are the commands you should have in that file:
export ORACLE_HOME=pathtoyouroraclehomedirectory
export ORACLE_SID=nameofyouroraclesid
export PATH=$ORACLE_HOME/bin:$PATH>
well I have this infor. with me
HTTP port ---> 8080
Port fopr Database ----> 1521
Anythin else required ? -
Runtime Error setting the 'Environment' when running with TWO executables
Hello,
I'm using XML DB for the very first time, so this problem may be easy to solve.
I'm currently running a test with TWO separate C# Console executables.
One executable correctly sets up the Xml Environment, Manager, and Container and simply adds XML documents to the database.
The second executable simply is supposed to run some XQuery commands. I use the same Environment, Manager, and Container code to do the initialization. However, I'm having trouble with setting up the 'Environment' in this executable. I get the following error:
DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery, exception code = DATABASE_ERROR
On this line of code:
Sleepycat.Db.Environment env = new Sleepycat.Db.Environment(envdir, envconf);
I've only seen code examples that run in a SINGLE executable. I'd really like to access the XML DB from multiple threads/executables, but am having trouble.
Can there be multiple 'Environments' and 'Managers' for the one XML Db?
Will provide more data if needed, and thanks for any help!
MattI guess you addressing this in the wrong forum. I see tags like "sleepycat" and "C#", probably thats why nobody replied.
-
How do I set the environment to change outputs when I press a button?
Hi guys!
This is a question for the Logic pros:
How do I set up my environment so that when I press a Button on my Midi Controller the Outputs from the Master Channel switch from 1-2 to 3-4 (to hear my music through different loudspeakers)???
Does somebody know how to do that?
Thank you in advance!
Greetings from GermanyThe easiest way is to route your mix to all the outputs you're using. Then set up fader objects in the env that transform toggled cc's from your keyboard switches. Cable those fader objects to the output channel objects. To toggle the Mute on an output channel you'll need to send it a fader message #9, value 0 or 1, on channel 1.
That would work, as long as you have switches on your keyboard that can transmit toggled cc's. -
How to properly set the environment for user oracle under Linux
Hi,
Every time I install XE on Linux somewhere, I repeat these steps (along with [fixing the /etc/init.d/oracle-xe startup script|http://forums.oracle.com/forums/thread.jspa?threadID=843780&tstart=0]), so I thought, why not contribute this to the community.
Those who have installed XE on Linux know that, after installation, logging in as user oracle gets you in a
$cryptic prompt. On top of that, none of the essential environment variables are set. Not amusing. That's because the oracle user lacks the proper configuration files for the bash prompt. Log in as user oracle and create these:
.bashrc
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi.bash_profile
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
unset USERNAME.bash_logout
clearNow log out and then log in again - a nicer prompt, and all environment variables are set, ready to run sqlplus, imp, etc.
This should help make your overall XE experience on Linux easier. Regards,
GeorgerNice. I checked the .bash_profile of my oracle installation and this is what I can contribute (I got the additional stuff from some tests with other Oracle Versions):
# /etc/skel/.bash_profile
# This file is sourced by bash for login shells. The following line
# runs your .bashrc and is recommended by the bash info pages.
[[ -f ~/.bashrc ]] && . ~/.bashrc
# Oracle Profile Settings
if [ $USER = "oracle" ]; then
source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fiC. -
Why do we actuallya need the setting of environment variables?
Hello guys,
I read that, in order to connect to the database via SQL*Plus, we need to have the environment variables set. So, SQL*Plus is a command tool, which doesnt know over which path to connect to db, if the environment variables are not set?
How about the needs of setting environment variables at point of view of MS-DOS? I know that over MS-DOS we can check if the environment variables are already set or not. Or we can actively set the environment variables.
When should we actually set the environment variables? Before we run the GUI or after? I read, that if we set it before we run the GUI, then the setting will be taken over when it comes to that step by running GUI. I am curious, since this would be interesting to know, if we use other version than XE.
Thanks..Oracle's flexibility ... many different versions working the same on many different versions of many different operating systems ... means that a single consistent installation and configuration methodology must work everywhere so as not to have the limitations of other competing products that work on only a single operating system or require that one learn a different syntax and methods for different versions.
Be grateful Oracle is as it is. Your competence in one version and operating system translates into competence in others. -
Setting the runtime environment for MySQL & creating tables,compile query
Hi....
i am a new user of MySQL server.i don't know the Rutime Environment on my machine.so please tell me how can i set the environment for MySQL.
How can i create tables & compile query please tell me?All of those are MySQL only questions. Nothing to do with JDBC.
There are MySQL forums. And there is certainly lots of MySQL documentation. So what of that have you read? -
Setting up the environment for a WebLogic Ant task
The documentations always starts:
1.. On Windows NT, execute the setWLSEnv.cmd command, located in the
directory WL_HOME\server\bin, where WL_HOME is the top-level directory of
your WebLogic Server installation.
2.. On UNIX, execute the setWLSEnv.sh command, located in the directory
WL_HOME/server/bin, where WL_HOME is the top-level directory of your
WebLogic Server installation.
How much of what's in those bat files (or sh files on UNIX) do I actually
need? Can I set the environment in Ant without calling the batch files --
i.e. no system environment variables?
TIA,
Robert Snyder
[email protected]Being a JBoss geek I cannot let it pass to recommend to at least investigate JBoss 7.1 as a possible alternative to Glassfish :)
Also MySQL works fine and is very common and thus very much documented, which is a big plus. But I would not pass up the chance to look into PostgreSQL as well. To me that is basically the perfect balance between the simplicity of MySQL and the power of an Oracle DBMS.
It depends on what you want to do with it of course, a simple web application works perfectly fine on MySQL, but then you probably also don't need the horsepower of a full enterprise container. You can also just use Tomcat 7 which is fast, easy to setup, well documented and doesn't use up so many resources either. -
Variable substitution in the environment.plist file
I want an additional item in the PATH environment variable for GUI-launched apps. I've created the ~/.MacOSX/environment.plist file and added an entry to create a PATH variable. I have initially tried to set the value of this to
"$(PATH):/usr/local"
in an attempt to append the /usr/local folder to the path. However, the PATH value appears to be exactly what I've set it to - without the substitution.
1) Is there a way to get the existing value substituted in?
2) As I'm always out to learn new things, is there a better way of achieving this?
(My fundamental problem is that I have written a plugin for XCode and I'm trying to not hard code the location of a compiler into it. Therefore I thought I'd use the PATH variable to let me find it. However the default PATH value doesn't include /usr/local which is where the compiler is located. So I'm looking for a way to add this folder into the PATH value, and the ~/.MacOSX/environment.plist seemed to be what I wanted - as long as I can get the substitution going. Otherwise I have to hard code the path into THAT file which I feel is just as bad!).
Thanks
SusanHi Susan,
I'm sorry; I didn't mean to imply that this is the wrong place to ask the question. I hope that it's the best place. I was just trying to explain, mostly to myself, why everyone assumes that the part of the system that reads the environment.plist will behave like a shell.
If you were worried about hard-coding the path on your own machine, I would say that you needn't worry. The only path that exists prior to the setting of environment variables from the environment.plist is hard-coded into the system somewhere. A while back someone found it but that's not really important. If you want to start with that default, you can. If you need to know what it is, I'm sure that we can find it for you somewhere. I assume it's along the lines of:
/usr/bin:/bin:/usr/sbin:/sbin
While I'm not telling you to not do it, I suggest that you rethink setting the user's path an environment.plist. Changing the environment of every last one of a user's processes "behind the back" of the user seems a bit presumptuous. It wouldn't be a problem if you set a variable that no other app could recognize but if you added something to my path, my first thought would be to look there for a trojan horse. I would eventually realize that it was misguided instead of malicious but I wouldn't like it. It also stands some chance of changing the behavior of a user's UNIX applications.
If you distribute an environment.plist file with your plugin, you would also have to address the issue of users that already have such files. Thus, it would seem that you would need to do a little checking in an install script. That being the case, you could evaluate the user's PATH variable in that script and use it to hard-code the path in an environment.plist that you generate programmatically from the install script at runtime. Such a script would also give you the opportunity to ask the user if he wants an environment.plist file.
Of course that approach would make it difficult for a user to remove an element from his path; it wouldn't be sufficient to cease adding the element to the path in the user's shell startup scripts. You would probably be better off using the default path. That might not interfere with changes the user makes in his shell startup scripts but it would mine. You added /usr/local/bin to the end of a user's path. My startup scripts only add path elements if they aren't already there. However, I want /usr/local/bin in front of the default part of my path so your change would alter the behavior of my system.
If you want to change the environment of a single application, it is common to "wrap" its invocation in a script that sets the environment before invoking the application. However, I'm not sure how that would work with an Xcode plugin.
Gary
~~~~
There are only 10 kinds of people in the world. Those
who understand binary numbers and those who don't. -
How to chang the environment of running process in C?
Hi All,
I have a application written in C ( OS Solaris 10 ) actually this application runs under some pre defined and standardised environment (specific to my project ).
Now I have requirement to access API of a library( already existing code ) in my application to perform some operations. I need to enhance my C code.
This API ( or library ) is not compatible with the standardised environment set for my application.(standardised environment (specific to my project ))
Can anybody please suggest me how can I set the environment (compatible to the library)while using that API (or library ) and reset to my project specific environment after the result is obtained from the new API (library ).
To be more specific during execution of my C-Application ( Environment variable LD_PRELOAD=/usr/lib/secure/libmtmalloc.so ). I am enhancing my application to use PAM Modules ( Pluggable Authentication Modules ) PAM APIs exposed performs internally some operation and return some values to me.But inside the PAM my application is crashing during malloc operation.
I have written a test application when it uses PAM APIs and perform the same operation under normal enviroment (uses libc for memory related function) it works fine.
So please tell me how can I set this environment variable LD_PRELOAD to libc only during execution of this API and revert this environment variable LD_PRELOAD back to libmtmalloc after it performs this operation is done.
Please dont tell me about the bug with libmtmalloc.so instead please provide me with some programming solution to achieve this.
Thanks alot in advance.
Regards,
Rahul.rahulsingh wrote:
*What do you mean "linked"? libC is dynamic (run-time) object. So your
library will be linked with the necessary items at runtime. If mtmalloc
is preloaded, then it may well use the mtmalloc routines.*
By linked I mean if I that library(libraryA) during compilations process it is linked to libC ( -lC). No, that doesn't normally happen at compile time. It might check the library to see what functions are in it, but it doesn't actually take sections of libC and place them in the library.
Instead, the run-time linker places both your library and libC (and the app, and other dynamic libraries) in memory when the app is run. LD_LIBRARY_PATH and LD_PRELOAD both affect the run-time linker in where and how it will look for libraries to load. You can see where it resolves by using 'ldd' on the app.
This will show dynamic libraries that were required at compilation time. It is also possible for an application to explicitly grab a library via 'dlopen'. Any such files will not appear in 'ldd' output.
Darren -
How to set the size of mutex region?
I am using a berkeley xml db on a CMS system.
The server's memory is 562M. When more than 80 users visited the system (without setting the environment configuration of berkeley DB), the berkeley db got the following errors: unable to allocate memory for mutex; resize mutex region.
Firstly, I set the environment configuration programmatically. I used java class EnvironmentConfig.setMutexIncrement(int) to change the region of mutex. However, the same error still happened event after EnvironmentConfig.setMutexIncrement(200) was used.
Therefore, I change the cachesize to 1M. But got the same error.
My config is
config.setCacheSize(1 * 1024 * 1024);
config.setAllowCreate(true);
config.setInitializeCache(true);
config.setInitializeLocking(true);
config.setInitializeLogging(true);
config.setThreaded(true);
Any help would by gratefully received.
Best Regards
JosieHi Josie,
The solution is to allocate a bigger number of mutexes to allocate. This can be done by calling DbEnv::mutex_set_max or DbEnv::mutex_set_increment.
For more details, please check here:
C++ APIs: http://www.oracle.com/technology/documentation/berkeley-db/xml/api_cxx/mutex_set_max.html
Java APIs: http://www.oracle.com/technology/documentation/berkeley-db/db/java/com/sleepycat/db/EnvironmentConfig.html#setMaxMutexes(int)
http://www.oracle.com/technology/documentation/berkeley-db/db/java/com/sleepycat/db/EnvironmentConfig.html#setMutexIncrement(int)
Please try to apply the above suggestion, and let me know if it works.
Thanks,
Bogdan Coman -
Setting Oracle environment variable using batch (.bat) file in windows
Hi,
Oracle 9i db
Windows OS
I am in process to create the database (Considered that Oracle9i software is already installed) by running one batch file which consist of all the scripts for the database creation.
But i also want to set the environment variables at MyComputer(right click)>properties>advance>environment, permenently by running the batch (.bat) file
ORACLE_HOME
ORACLE_BASE
ORACLE_SID
So, how can it be done ?
With RegardsHi,
*@echo off*
set ORACLE_SID=iprsdb
set ORACLE_BASE=C:\oracle
set ORACLE_HOME=C:\oracle\ora92
call C:\install_bkp\test_env_var.bat
echo Test Successfull.
Above mentioned is the code written in the batch (.bat) file
In that i have also called another .bat file which test the env. variable values which is as below:
c:\>test_env.bat
===================
Testing oracle sid
===================
iprsdb
=====================
Testing oracle base
===================
C:\oracle
=====================
Testing oracle home
=====================
C:\oracle\ora92
Test Successfull.
But when i checked at MyComputer(right click)>properties>advance>environment variables
there, I saw none of the entries from the above, why so ?
how to set env. variables permanently using the DOS commands. ?
With Regards
Maybe you are looking for
-
Custom PL/SQL API that inserts the data into a custom interface table.
We are developing a custom Web ADI integrator for importing suppliers into Oracle. The Web ADI interface is a custom PL/SQL API that inserts the data into a custom interface table. We have defined the content, uploader and an importer. The importer i
-
I removed chrome 10 and newly installed FF4 final, and I can't read PDF files within the browser. There was no problem in Chrome. I can't even see the acrobat reader plugin in the plugins page. Acrobat 10 is already installed in my PC. Every time I t
-
Erase a White Background on a Photo
I need to erase a white background on a photo of a wine bottle so a web host can use the bottle image without the white background but when I save the image with the background removed, it is still there when I open the saved jpeg image.
-
Why does my Itunes shut down everytime I try to watch a podcast?
In the last two days my Itunes stops working and shuts itself down each time I attempt to watch one of my pod casts. I tried uninstalling and reinstallaing Itunes, but to no avail. Any help is much appreciated.
-
Imovie 09 doesnt have speed option
I have imovie 09 and when i double click on a video it doesnt show the speed option and i even went to options to show advanced options as well can someone help me please. Im trying to make a video into slow motion thanks