How do run dos command from form
Hi all,
I need to run a file.bat (dos), someone can help me, please?
I know the command HOST(..), but when execute the command exit a black window. Are there other command?
Thank you
Silvia
Hello,
I know the command HOST(..), but when execute the command exit a black window. Are there other command?Version Dependent.
For less then or equal 6i version
HOST('CMD /C C:\batch_file_name.bat');For the web based...
The same above command will work for AS level. If you need on client side then
CLIENT_HOST('CMD /C C:\batch_file_name.bat');-Ammad
Similar Messages
-
Hi ,
I would appreciate if anyone could tell me how to run DOS command such as "del" using JAVA language .Thank you.<steps onto soapbox>
Surely for something like 'del' we should be advocating a non-OS specific method so we don't lose sight of Java's cross platform abilities.
If it has to run an OS specific thing fine, but please look for a non OS specific solution first.
<steps off soapbox> -
How to run DOS command in Java environment?
Can i run DOS command in Java environment?
I did like this:
Runtime r = Runtime.getRuntime();
r.exec("cmd.exe");
r.exec("set classpath=%CLASSPATH%;.\\tmp")
but failed.
However if I run the java command, it runs successfully.
r.exec("javac Test.java");
r.exec("java Test");
how should I do so that i can run the DOS commands metioned above in Java Environment?
thanks a lot.Have a look at http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
This may help. I wonder if this is ok ?
Runtime r= Runtime.getRuntime();
r.exec("cmd.exe /C set classpath=%CLASSPATH%;.\\tmp\""); -
Running Copy command from Forms 6i
HI!
I want to run Copy command through Forms 6i i.e copy from scott/tiger@orcl insert test@msora(ename) using select to_char(ename) ename from emp;
I can run DDL command through Forms_ddl functions in Forms 6i, But copy command is not working using Forms_ddl.
thanks in advance.
Edited by: Kami_Lily on Aug 2, 2009 10:04 PMDear Kami Lily,
Oracle Forms is able to execute SQL and PL/SQL command only. Additionally it supports Operating System command by HOST built-in.
Though COPY is a SQL*Plus command, it is not possible to execute this command by HOST built-in.
Instead, if you hardly want to execute COPY command oracle forms 6i, then you make a batch file in operating system and run that batch file from HOST built-in.
Thanks. -
How to run OS commands from PL/SQL???
Hi
Is there any way to run OS commands(Windows Platform) from within PL/SQL?
ThanksAPC,
I am working on Discoverer, having lots of BAs & Workbooks created & stored in Database. Now if i want to move all the workbooks from one place to another (like from development to test or production) i can use Command line interface of Disco to do this. But i don't see any option there to export all the workbooks, so i thought of writing a pl/sql to get all the workbook names from the EUL then fire export Command for each record(although not a good practice but its a one time work). This is the place where i need to run OS command from within PL/SQL. Although it doesn't seem possible now(as you all said) without external procedure.
Lastly, you are right that "Oracle make databases not operating systems" but my first impression/comment about oracle is:
"Oracle is far Bigger, Powerful, Complex, Vast and Interesting System than any other..." so i believe it can do/capable doing anything :-)
thx Ashutosh,
Host is definitely an option but i can't run it from pl/sql(that i am looking for).. -
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? -
How to run unix command from Oracle Foms 10g
OS: UNIX Solaries, Oracle Application Server 10g
To run shell script from Oracle Forms, I used the following host('/bin/bash /u01/compile.sh') and it works well
Now, I need to run unix command something like
host('mv form1.fmx FORM1.FMX') but it's not working
I tried to append the command "mv form1.fmx FORM1.FMX" to the compile.sh shell script but also it's not working although the rest lines of the shell script is running well
Edited by: slamonty on Aug 23, 2012 12:36 AMYes, Thank you so much, it works well as follow
$ /bin/mv /u01/oracle/runtime/test/form1.fmx /u01/oracle/runtime/test/FORM1.FMX Edited by: slamonty on Aug 23, 2012 9:59 AM
Edited by: slamonty on Aug 23, 2012 11:14 AM -
How to run system commands from JAVA
Hi Friends,
How to run windows system commands from JAVA
Runtime r=Runtime.getRuntime();
r.exec("dir");
Throwing following Exception
CreateProcess :dir error=2
Thanks in advance
HamsaHi ,
in Windows NT this is not possible, you can use the following :
Runtime r=Runtime.getRuntime();
StringBuffer sbuf = new StringBuffer();
String dir = new String();
java.lang.Process proc = r.exec("cmd /c dir");
InputStream is = proc.getInputStream();
int ch ;
while((ch=is.read() ) != -1)
sbuf.append((char)ch);
is.close();
dir = sbuf.toString();
System.out.println(dir ); -
May I ask how I should write if I want to execute a dos command in java? The command is :
"C:\Program Files\Real\realproducer\rmeditor -i abc.rm -d abc.txt". Should I use array?
Thanks!why an array ?
String command = "C:\\Program Files\\Real\\realproducer\\rmeditor -i abc.rm -d abc.txt";
Process p = Runtime.getRuntime().exec( command );what about the seach function on the left side ? ;-)
tobias -
How to run dos command on java
would java run the dos command ?
if yes ~would you mind give me some example~please~..or just use:
Runtime.getRuntime().exec("cmd /c commandyouwanttouse");
Hope it works! -
hi,
is any one able to resolve my problem.
thanks in advance
my problem is that i want to run os command (dir/b to get list of all files and directory names) using oracle 10.1.0.1.0 plsql.
what will be the code snippet in oracle plsql.
if any one have an idea then please let me know.
thanks.First bullet of the thread no one reads
Posters, please mind these common-sense rules when participating here:
- When asking a question, provide all the details that someone would need to answer it. Consulting documentation first is highly recommended.
For me that includes perusing available resources. The 'Search Forum' button of this forum is. Http://asktom.oracle.com also is. Ninety nine percent of all users posting here did zero to resolve their own problem. This is why the results of 'Search Forum' are such a mess. As Oracle does nothing to moderate or clean up this forum, the mess stays and is aggravated because most people....
etc.
But then consilodating threads in a series of FAQs wouldn't help, as most people wouldn't read them.
Sybrand Bakker
Senior Oracle DBA -
hi all,
i am running this command at command prompt
like below
java filename argument.
ex: java validateuser user1
it works fine at command prompt. and the same command i want to run in jsp
so i tried like this
Runtime x = Runtime.getRuntime().exec("java validateuser user1");
whats happenning here is it just opening command promot of java.exe but its not running validateuser.
any help will be greatly appreciated.
advance thanks.why on earth are you trying to run java.exe on the command line through JSP?i think you misunderstand my question.
i am not trying to run java.exe on through jsp.
I am trying to run a validateuser user1 in jsp .
Note:validateuser is a java file which take one argument.here in my scnerio user1 is the argument. -
hi all
how do i run dos commands from java??????????Using Runtime#exec().
Also see http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html -
How to run a DOS command from an Oracle form.
How can I run a DOS command from an Oracle form (i.e. open the calculator located at c:\windows\system32\calc.exe)?
first of all get the environment variable for the c:\windows\system32 direcotry for any of the windows
you can use get variable from the ora env package
now cancat the system32 variable with the calc.exe string
now pass the string with host command as parameters
this process will work for all type of windows. -
How to run a script from Oracle Form (Beside using HOST command)
I would like to run a script from Forms 6.0. I know that we can actually issue this command :
host('plus80.exe' username/password@connect_string @c:\scriptname);
BUT, is there any other alternative ?Sqlplus is a different program, so one way or the other you have to leave Forms to run sqlplus. What is you objection against HOST?
You can also run sqlplus from the database, but again you need a stored java procedure to call sqlplus (sort of HOST command that runs in the database).
Francois' solution works if your script just has a query to run, but if you have specific sqlplus commands (spool etc.) forms_ddl is probably not a solution.
Maybe you are looking for
-
I added a new Fluid Grid Layout and when I try to add a DIV I receive the message "Could not find Dreamweaver Fluid Grid Style Sheet". I don't see the pink bars on my screen as shown in all of the tutorials. Can I use this option in CS6? I have fo
-
music on itunes will not play audio. I can hear Pandora play, so the speakers appear to work. It seems to be specifit to itunes. I can see the bar moving, but no sound emerges. Ideas?
-
How do I get to a Customer Service Chat?
I see that all the chats seem to be sales no matter what route you take on the contact us page. They tell me that they do not have a chat, but I have chatted with Customer Care before.
-
Unidentified Error when connecting DW with MySql
Hi I am trying to connect to Mysql Database which is hosted by a hosting company on their server. I have been given a static IP address and port to access this database remotely. I have add the information below to DW 8 in an attempt to gain access
-
Photoshop Elements 12 Organizer Crashes When Sharing Via E-Mail
Each time I try to share images via e-mail form (embedded pictures), Elements crashes. There is no specific cause given so it is not possible to correct. Suggestions?