Loading variables from JAVA PROGRAM
Hello, i have a java program how have on a variables that i want to put on a DataBase Oracle9i.
Help me
Hey, if you're the one that posted this: http://forum.java.sun.com/thread.jsp?forum=32&thread=495288 then you still owe me some..
You want environment vars to remain changed after your programme finished? Do you want them to remain changed in a new session (logout/login) ? Do you want them changed in both Systems equally (the mechanisms are equal but the syntax is different in DOS and Unix shells) ?
As I do not get tired to repeat: provide some information and the possibility of being helped is raised exponentially => explain what you try to do and people will try to help you.
-T-
Similar Messages
-
Setting windows environment variables from Java program
Is there any way to set environment variables from Java program in Windows? Any help is appreciated.
Here is my situation:
I need to decrypt an encrypted Oracle user password in a batch file which will be used while running a sql script with sqlplus. I was planning to have bat file which will call a Java program decrypt the password and set it as an env variable in windows which will be available while calling sqlplus.
thanksRuntime.exec has a lot of overloadings. Two of them
allows you to specify the environment variables.
exec
public Process exec(String[] cmdarray,
String[] envp,
File dir)
throws IOExceptionExecutes the specified command and
arguments in a separate process with the specified
environment and working directory.
cmdarray - array containing the command to call and
its arguments.
envp - array of strings, each element of which has
environment variable settings in format name=value.
dir - the working directory of the subprocess, or null
if the subprocess should inherit the working directory
of the current process.
I had this sample program:
public class SetVarExample {
public static void main (String[] args) throws Exception {
String[] cmd_env= new String[] {"password="+"ABCD","Path=C:\\Sun\\AppServer\\jdk\\bin"};
String cmd = "cmd /c SET ";
Runtime.getRuntime().exec(cmd,cmd_env);
System.out.println( "Finish ...." );
I tried it in a command prompt. But looks like when the program exits, it's a whole new process and so it does not retain the env variables set in the java program.
Any suggestions? Am I doing it worng?
thanks -
Calling oracle SQL Loader from java program
Hi,
I want to insert data into oracle tables from a text files containing fixed length fields. I am using SQLLoader to achieve this. The requirement is to call the SQLLoader within the java program.
Does anyone know how to call SQL Loader from java program?
Thanks,
VarshaSimply "exec" the sqlldr program with the parameters you need to pass to it.
Runtime.exec (........)
Try to pass all parameters needed including the username and password, and use the option "silent" to avoid output, and the option "log" to have a log file of the modifications that sqlldr has done to the database. -
How to edit the existing data in the XML file from java programming.
Hi all
i am able to create XML file with the sample data as below from java programming.
i need sample code on how to edit the existing data in the XML file?
for example
<?xml version="1.0"?>
<mydata>
<data1>
<key1>467</key1>
<name1>Paul</name1>
<id1>123</id1>
</data1>
<data2>
<key2>467</key2>
<name2>Paul</name2>
<id2>123</id2>
</data2>
</mydata>
i am able to insert the data in the XML.
now i need sample code on how to modify the data in the above XML file from the java programming for only key2,name2,id2 tags only. the remaining tags data in the XML file i want to keep same data except for key2,name2,id2 which are i want to modify from java code
Regards
Sunil
[points will be always rewardable]hi
u need a parser or validate the xml file for to read the xml file from java coding u need for this
xml4j.jar u can download this file from here
http://www.alphaworks.ibm.com/tech/xml4j
or we can use the SAX(simple API for XML)
some sample applications for this
http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
http://www.developertutorials.com/tutorials/java/read-xml-file-in-java-050611/page1.html
http://www.xml-training-guide.com/e-xml44.html
let me know u need any other info
bvr -
How to load variables from a .txt file
Hi.
I usually make a flash aplication in colaboration with a php
programmer. But i want to test my swfs without having to wait for
him. So i want to do that through a text file. I know that flash
can load variables from text files. The problem is i don't know how
to format the text file ( example.txt).
Thank youHere's a couple of ideas.
First you probably want to change what you have...and put
your 'if (pVar==1' etc inside a separate function and call it from
the onLoad handler after you have assigned the value to pVar...
because the onLoad will run at some unknown point in time after
loading has finished (actually in the test environment this might
work... but that wouldn't be the same as what happens in a
production setting).
To create test files for loadvars... simply create a new as2
file and put this code on the first frame and test movie: -
How to access database file on CDROM from Java Programe??
Hello friends,
I am making online exam application.
I want my question database to be reside on CDROM.
but i am not getting any idea how to make DSN or static path that resolute the path that i have mentioned for CDROM.
basically i want to know how to access CDROM from Java Programe????
Thanks in advance
Navik PathakOnce you mounted the CDROM (something maybe as /media/cdrom) as a file system (or assigned a drive letter to it like D: or F: or whatever), the files are accessible normally.
-
How to connect iseries green screen from java program
how to connect iseries green screen from java program to get the data in the DB files ,here the DB is DB2/400
Just some Friday fun. Use the telnet program that comes with Windows and supports VT escape sequences.
import java.io.*;
import java.net.*;
public class AutoTelnet {
private static Socket s;
public static void main(String[] args) throws Exception {
Thread t = new Thread() {
@Override public void run() {
try {
s = new ServerSocket(5555).accept();
} catch (IOException ex) {
ex.printStackTrace();
t.start();
Process p = new ProcessBuilder("cmd", "/C", "start", "telnet", "127.0.0.1", "5555").redirectErrorStream(true).start();
t.join();
PrintStream ps = new PrintStream(s.getOutputStream());
ps.println("Screen will be cleared in 5 seconds");
ps.println("5");
Thread.sleep(1000);
ps.println("4");
Thread.sleep(1000);
ps.println("3");
Thread.sleep(1000);
ps.println("2");
Thread.sleep(1000);
ps.println("1");
Thread.sleep(1000);
ps.println("\u001b[2J");
Thread.sleep(5000);
} -
How to create a file under web application root from java program
how to create a file under web application root from java program like an action class?
like an action class?Huh? What exactly is your requirement?
Creating a file is usually done with java.io API. Read the java.io tutorials how to play with files. -
How to call windows help files .hlp from Java program
Hai all everybody
How to call windows Help file that is xxx.hlp files from java programs
any help great!!!!
regards
veeruHow about
Runtime.getRuntime().exec("start xxx.hlp"); -
SOLVED: How To Use LDAP over SSL (no certs) from java program
Trying to connect to OID from Java program (using Grocery Store demo as a test). Want to use SSL with no server certificate. OID is configured, and ldapsearch -U 1 works.
Tried using URL with ldaps, or adding SECURITY_PROTOCOL,"ssl". In both case the error is 'simple bind failed'.
Samples on OTN say this should be possible, but then only have code for the non-ssl connection.
Posting from others with this same question don't seem to have been answered.
Message was edited by:
user590350
I have found that using ConnectionUtil.getSSLDirCtx() from Oracle will make a no-authentication SSL connection. An example in the sample code would be useful.Even with Java APIs, There is a way to talk through SSL without bothering about certificates. It's just that you will have to write some code and make some changes in settings.
Read following to get further information on the same.
http://kiranthakkar.blogspot.com/2007/04/dummny-certificate-authentication.html
I don't know or I won't comment whether it's the right approach or not but it's definitely a work around.
Thanking You
Kiran Thakkar -
Problem while running dos command from java program
Dear friends,
I need to terminate a running jar file from my java program which is running in the windows os.
For that i have an dos command to find process id of java program and kill by using tskill command.
Command to find process id is,
wmic /output:ProcessList.txt process where "name='java.exe'" get commandline,processid
This command gives the ProcessList.txt file and it contains the processid. I have to read this file to find the processid.
when i execute this command in dos prompt, it gives the processid in the ProcessList.txt file. But when i execute the same command in java program it keeps running mode only.
Code to run this command is,
public class KillProcess {
public static void main(String args[]) {
KillProcess kProcess = new KillProcess();
kProcess.getRunningProcess();
kProcess = new KillProcess();
kProcess.readProcessFile();
public void getRunningProcess() {
String cmd = "wmic /output:ProcessList.txt process where \"name='java.exe'\" get commandline,processid";
try {
Runtime run = Runtime.getRuntime();
Process process = run.exec(cmd);
int i = process.waitFor();
String s = null;
if(i==0) {
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(process.getInputStream()));
while ((s = stdInput.readLine()) != null) {
System.out.println("--> "+s);
} else {
BufferedReader stdError = new BufferedReader(new
InputStreamReader(process.getErrorStream()));
while ((s = stdError.readLine()) != null) {
System.out.println("====> "+ s);
System.out.println("Running process End....");
} catch(Exception e) {
e.printStackTrace();
public String readProcessFile() {
System.out.println("Read Process File...");
File file = null;
FileInputStream fis = null;
BufferedReader br = null;
String pixieLoc = "";
try {
file = new File("ProcessList.txt");
if (file.exists() && file.length() > 0) {
fis = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(fis, "UTF-16"));
String line;
while((line = br.readLine()) != null) {
System.out.println(line);
} else {
System.out.println("No such file");
} catch (Exception e) {
e.printStackTrace();
return pixieLoc;
} when i remove the process.waitFor(), then while reading the ProcessList.txt file, it says "No such file".
if i give process.waitFor(), then it's in running mode and program is not completed.
Colud anyone please tell me how to handle this situation?
or Is there anyother way to kill the one running process in windows from java program?
Thanks in advance,
SathishHi masijade,
The modified code is,
class StreamGobbler extends Thread
InputStream is;
String type;
StreamGobbler(InputStream is, String type)
this.is = is;
this.type = type;
public void run()
try
InputStreamReader isr = new InputStreamReader(is, "UTF-16");
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null)
System.out.println(type + ">" + line);
} catch (IOException ioe)
ioe.printStackTrace();
public class GoodWindowsExec
public static void main(String args[])
try
String osName = System.getProperty("os.name" );
String[] cmd = new String[3];
if( osName.equals( "Windows 95" ) )
cmd[0] = "command.com" ;
cmd[1] = "/C" ;
cmd[2] = "wmic process where \"name='java.exe'\" get commandline,processid";
} else {
cmd[0] = "cmd.exe" ;
cmd[1] = "/C" ;
cmd[2] = "wmic process where \"name='java.exe'\" get commandline,processid";
Runtime rt = Runtime.getRuntime();
System.out.println("Execing " + cmd[0] + " " + cmd[1]
+ " " + cmd[2]);
Process proc = rt.exec(cmd);
System.out.println("Executing.......");
// any error message?
StreamGobbler errorGobbler = new
StreamGobbler(proc.getErrorStream(), "ERROR");
// any output?
StreamGobbler outputGobbler = new
StreamGobbler(proc.getInputStream(), "OUTPUT");
// kick them off
errorGobbler.start();
outputGobbler.start();
// any error???
int exitVal = proc.waitFor();
System.out.println("ExitValue: " + exitVal);
} catch (Throwable t)
t.printStackTrace();
}when i execute the above code, i got output as,
Execing cmd.exe /C wmic process where "name='java.exe'" get commandline,processid
and keeps in running mode only.
If i execute the same command in dos prompt,
CommandLine
ProcessId
java -classpath ./../lib/StartApp.jar;./../lib; com.abc.middle.startapp.StartAPP 2468
If i modify the command as,
cmd.exe /C wmic process where "name='java.exe'" get commandline,processid > 123.txt
and keeps in running mode only.
If i open the file when program in running mode, no contents in that file.
If i terminte the program and if i open the file, then i find the processid in that file.
Can you help me to solve this issue? -
Is it possible to execute SAPGUI scripts from java program?
Hi everyone..
I need to develop an java applications that executes the SAPGUI script or any technique that execute set of transaction as client.
Is it possible to execute SAPGUI scripts from java program? if so, how it can be achieved? is there any other technique to achieve above mention scenario?.
it will be more helpful, if docs related to that are shared..
Thanks in advanceOh, bummer. Would be much more convenient if I could just use iTunes for everything. Can't stand WMP. I wonder if WinAmp might be a good compromise?
Thanks for this answer . . .
Sharon -
Starting weblogic server from java program
Runtime r=Runtime.getRuntime();
Process p=r.exec("cmd /c d:/bea/weblogic700/server/bin/setWLSEnv.cmd");
when ihave given like this it is working.
now i want to start weblogicserver from jav program
String s="-Dweblogic.Domain=mydomain weblogic.Server"
Process p=r.exec("cmd /c d:/bea/weblogic700/server/bin/setWLSEnv.cmd java "+s);
when i gave like this weblogicserver should start with specified domain
but no output is comming.please tellme where the problem isno - nothing happened. it perform the next java code - and there is nothing else happen on the windows.
maybe i don't check in the right place for the error you are talking about?
i also tried i simple cmd file that does nothing - but still nothing...
for any other file types it works properly. -
Does somebody know whether it is possible to run some program with extension EXE from JAVA program?
Yes sombody knows. Yes it's possible. Have a look at Runtime#exec.
-
Loading Variables from ASP into Flash
I can find plenty of tutorials detailing how to load
variables from a defined asp page into Flash, but here's my
dilemma...
I have an asp page that is reading a URL with a unique
identifier in it (www.sampleURL.com?id=123456), and then turns the
id number from the URL into a variable. On the same page then, sits
my swf where I need to use LoadVars to pull in that ASP variable
via Actionscript. If I don't have a static asp page to pull the
variables in from and I want to pass the variable within the same
asp page the swf is located on, how do I do it? Many thanks in
advance..."bonzomn65" <[email protected]> wrote in
message
news:ej0630$pjh$[email protected]..
>I can find plenty of tutorials detailing how to load
variables from a
>defined
> asp page into Flash, but here's my dilemma...
>
> I have an asp page that is reading a URL with a unique
identifier in it
> (www.sampleURL.com?id=123456), and then turns the id
number from the URL
> into a
> variable. On the same page then, sits my swf where I
need to use LoadVars
> to
> pull in that ASP variable via Actionscript. If I don't
have a static asp
> page
> to pull the variables in from and I want to pass the
variable within the
> same
> asp page the swf is located on, how do I do it? Many
thanks in advance...
>
You don't need LoadVars for this at all. You can just pass
the variable to
your Flash movie by specifying a query string when you are
calling the
movie.
If you are using the straight object, embed method then it
would look
something like this:
<param name="movie" value="movie.swf?id=11111">
<embed src="movie.swf?id=11111" ... >
If you are using the ActiveContent JavaScript for your movie
then you just
leave off the .swf... so
"name", "movie?id=11111"
Then, in flash you can access the value of id from the _root,
like
var idInFlash:Number = _root.id;
Of course in the above example you would replace 11111 with
the proper
syntax for printing a variable's value in ASP.
Maybe you are looking for
-
Using RAPI to generate Service Forms
Interested in using RAPI to develop a service. My company is interested in using RAPI to develop a service that allows a user to select items from a list, then call or pull the associated atomic service to be used as part of a requisition. Does any o
-
Component Video Cable and Bumper Case
Just a head's up. If you have an iPhone 4 and a bumper case, the Component video cable will not fit properly when the bumper case is on. It inserts, but the cutout that fits the standard USB cable is too small for the plastic part of the cable that i
-
Why do all the windows open when i start my mac book pro up
After closing all the windows on my macbook pro , i shut the computer down, on re-starting the computer it opens all the wuindows up again any ideas why ?
-
Weblogic 12c Servlet Response - Special characters show up as question mark
My web app is running on Weblogic 12c (12.1.1) using WebWork + Hibernate. The program streams data (bytes making up a pdf) from a CLOB in an Oracle Database to the AsciiStream of the servlet output response. No exceptions are thrown, but the generate
-
E-Rec ,Candidate Appears twice in fast search
Hi We are using Standalone E-rec system EHp4 , Done with all the ALE Related configuration for Data Transfer b/t ECC to E-rec System , While Running PFAL(RHALEINI) for the first with the object type 'P' we missed to update the infotype 0006 , subtyp