How to Run External Exe/Scripts
Hi,
I am new to Java. I am doing a GUI Application Using Swing. I want to execute list of external exe or perl script repeatedly from my Application. I Tried that one using in for loop. within the for loop i write execute my external exe or script. I got the expected result. but my problem is I can not interact with the application on the of loop execution. Any one can Give me a Solution?.
Here is my Try..
Runtime rt = Runtime.getRuntime();
Process pr ;
String ScriptPath
for (int rcount = 0; rcount < trows ;rcount++ ){
ScriptPath = "D:/Scrip" + rcount + ".pl";
try{
pr = rt.exec(ScriptPath);
exitVal = pr.waitFor();
catch (Exception e){
exitVal = 4;
JOptionPane.showMessageDialog(null, "Status: " + exitVal, "Status" , JOptionPane.ERROR_MESSAGE);
Thanks,
Rajesh.K
You are probably executing you external apps via the Event Dispatch Thread. This is the thread responsible for updating the GUI.
You need to read up on the SwingWorker class. This is exactly where it should be used.
http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
nes
Similar Messages
-
How to execute external exe in SSIS Package
Hi,
I wanted to know how to execute external exe from SSIS Package can any one explain me or provide me valuable links.
Regards ,
AjayThere are few things you need to take care before executing exe from SSIS
1. The arguments etc expected by exe should be clearly defined inside execute process task
2. The Path where exe exists should be accessible to the account executing the package. SO you should grant account required permissions
3. If executing from a job make sure you either define a proxy account with required permissions and configure it to run the job or give service account all access required for executing exe
see
http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Media file path in IP IVR - Run external VRU script
Hi all,
I am configuring ICM script by using run external vru script which is located in IP IVR server. But, I am not sure how pass media file path from ICM script to VRU script.
Last time, I used IVR version 7.0. I set the path such as: c:\MediaServer\english. Now, I am running IVR version 10 with en_US language.
Any advise?
ThucHi,
I try to your guide but still silent. Log file is:
01 15:10:42.398 ICT %MIVR-SS_CMT-7-UNK:init:: flushDTMF=true DTMFBuffer.size=0
344389: Apr 01 15:10:42.398 ICT %MIVR-LIB_MEDIA-3-PROMPT_ERROR_IGNORED:Prompt error ignored: Exception=com.cisco.prompt.UndefinedPromptException: unable to append prompt: Vietnamese\Loichao.wav; nested exception is:
java.io.IOException: file not found: Vietnamese\Loichao.wav
344390: Apr 01 15:10:42.398 ICT %MIVR-LIB_MEDIA-3-EXCEPTION:com.cisco.prompt.UndefinedPromptException: unable to append prompt: Vietnamese\Loichao.wav; nested exception is:
344391: Apr 01 15:10:42.398 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: java.io.IOException: file not found: Vietnamese\Loichao.wav
344392: Apr 01 15:10:42.398 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.prompt.FilePrompt.appendTo(FilePrompt.java:229)
344393: Apr 01 15:10:42.398 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.prompt.DocumentPrompt.appendTo(DocumentPrompt.java:264)
344394: Apr 01 15:10:42.398 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.prompt.ConcatenatedPrompt.appendTo(ConcatenatedPrompt.java:169)
344395: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.cmt.dialogs.CMTDialogImpl.appendPrompt(CMTDialogImpl.java:165)
344396: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.cmt.dialogs.CMTDialogImpl.playCompositePrompt(CMTDialogImpl.java:140)
344397: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.cmt.dialogs.CMTDialogImpl.playInitialPrompt(CMTDialogImpl.java:110)
344398: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.cmt.dialogs.CMTDialogImpl.playPrompt(CMTDialogImpl.java:92)
344399: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.cmt.dialogs.CMTSimpleRecognitionDialogImpl.dialogLoop(CMTSimpleRecognitionDialogImpl.java:109)
344400: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.cmt.dialogs.CMTSimpleRecognitionDialogImpl.run(CMTSimpleRecognitionDialogImpl.java:87)
344401: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.app.impl.ApplicationManagerImpl$TaskImpl$ActionImpl.run(ApplicationManagerImpl.java:7757)
344402: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.app.impl.ApplicationManagerImpl$TaskImpl.doInterruptible(ApplicationManagerImpl.java:7560)
344403: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.dialog.DialogObjectImpl.invoke(DialogObjectImpl.java:632)
344404: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.steps.ivr.MenuStep.execute(MenuStep.java:394)
344405: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.obj.WFBeanStep.executeImpl(WFBeanStep.java:141)
344406: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.obj.WFStep.execute(WFStep.java:174)
344407: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.obj.WFWorkflowTask.executeStep(WFWorkflowTask.java:494)
344408: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.engine.core.WFEngineWorkflowTask.executeStep(WFEngineWorkflowTask.java:122)
344409: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.app.impl.WFWorkflowAppDebugTaskWrapper.executeStep(WFWorkflowAppDebugTaskWrapper.java:416)
344410: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.obj.WFWorkflowTask.execute(WFWorkflowTask.java:360)
344411: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.engine.core.WFEngineWorkflowTask.execute(WFEngineWorkflowTask.java:77)
344412: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.app.impl.WFWorkflowAppDebugTaskWrapper.execute(WFWorkflowAppDebugTaskWrapper.java:736)
344413: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.engine.core.TaskManager.runTaskNormally(TaskManager.java:416)
344414: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.engine.core.TaskManager.runTask(TaskManager.java:371)
344415: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.engine.core.Invoker.invoke(Invoker.java:85)
344416: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.app.impl.ApplicationManagerImpl$TaskImpl.subinvoke(ApplicationManagerImpl.java:4658)
344417: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.app.impl.ApplicationManagerImpl.subinvoke(ApplicationManagerImpl.java:2204)
344418: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.app.Application.subinvoke(Application.java:276)
344419: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.subsystems.ged125.ICMApplication.invokeWorkflow(ICMApplication.java:154)
344420: Apr 01 15:10:42.399 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.subsystems.ged125.ICMApplicationTask.invokeWorkflow(ICMApplicationTask.java:684)
344421: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.subsystems.ged125.ICMApplicationTask.runScript(ICMApplicationTask.java:1382)
344422: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wf.subsystems.ged125.ICMApplicationTask.execute(ICMApplicationTask.java:2468)
344423: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.app.impl.WFAppTaskWrapper.execute(WFAppTaskWrapper.java:291)
344424: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.engine.core.TaskManager.runTaskNormally(TaskManager.java:416)
344425: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.engine.core.TaskManager.runTask(TaskManager.java:371)
344426: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.wfframework.engine.core.TaskManager$RunnableTask.run(TaskManager.java:589)
344427: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.executor.impl.ExecutorStubImpl$RequestImpl.runCommand(ExecutorStubImpl.java:690)
344428: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.executor.impl.ExecutorStubImpl$RequestImpl.run(ExecutorStubImpl.java:486)
344429: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.executor.impl.ExecutorStubImpl$RequestImpl.run(ExecutorStubImpl.java:762)
344430: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:776)
344431: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.executor.impl.PooledExecutorStubImpl$1$WorkerImpl.run(PooledExecutorStubImpl.java:99)
344432: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.util.ThreadPoolFactory$ThreadImpl.run(ThreadPoolFactory.java:853)
344433: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: nested stack trace is:
344434: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: java.io.IOException: file not found: Vietnamese\Loichao.wav
344435: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.prompt.FilePrompt.appendTo(FilePrompt.java:229)
344436: Apr 01 15:10:42.400 ICT %MIVR-LIB_MEDIA-3-EXCEPTION: at com.cisco.prompt.DocumentPrompt.appendTo(DocumentPrompt.java:264) -
How to run an exe file in a java program
Hi,
Can somebody tell me how to run an exe file in a java program.
Thank you!Yes, java.lang.Runtime.exec().
Read this carefully before you do:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
Don't write a line of code before you're reviewed and understood the article completely. - MOD -
How to run the SQL Script in SQL Prompt?
Hi ExpertGroup,
I have written one SQL Script name called "MySQLSCript.SQL". I want to know how to run the SQL Script in SQL Prompt?.
Generally, I run SQL Script in PL/SQL Developer tool. But In this case, some SET command is not working/supporting in PL/SQL Developer Tool.
Let me know, How to Run in SQl Prompt.
Thanks & Regards,
Senthil K Kumar.This is my SQL Script....
SET COLSEP '|'
SET LINESIZE 32767
SET PAGESIZE 50000
/* SET LINESIZE 3000
SET PAGESIZE 50000
SET DEFINE OFF */
SET ECHO OFF
SET FEEDBACK OFF
--SET HEADING OFF
SET TRIMSPOOL ON
SET NEWPAGE NONE
SET UNDERLINE OFF
SPOOL &&EnterPath;
SELECT * FROM &&TableName;
SPOOL OFF
SET FEEDBACK ON
--SET DEFINE ON
PROMPT Done.
I am able to run this script in SQL Prompt....
Its executing fine...
But, If I am executing again it maynot asking for new set of data....
alternativily its taking old values only.....
how can i exeute with new set of data in the sql prompt..... -
How to run the open script code from eclipse?
Hi,
How to run the open script code from eclipse.
Please let me any soulutions on this.Hi Konda
I am not quite sure you can do that and it would even be not supported... Again, what is the purpose? Why do you want to run your openscript code in Eclipse?
What is the code you try to run?
As an example, even if you include al the jar files and so on. don't think the function "Launch Browser" could work because it isn't only java code orjar files.....
If you give us more background. maybe we can guide you to a better solution...
JB -
How to run unix shell script from java web applet
hi all
i have created one java applet. my apache web server is on unix server.
i have created one shell script in same directory where my .class and .htm files reside...
how to run this shell script from applet? it should search this .sh file on server and not on the client browser machine...
thanks in advanceI suppose you could make the shell script into a CGI, configure the server to execute CGIs, and then make the applet open the URL of that CGI.
-
How to run an Oracle Script File
Hi,
Please anybody tell me how to run an Oracle script file (*.sql file) from Query template.
In SQL*Plus we run a script file as @Script_file_name.sql
how do we do it in Query Template.Dave,
Please only post your question in one thread at a time....
[SAP xMII synchronus commincation|SAP xMII synchronus commincation]
Sam -
How to run ufdutility.exe
I would like to know how to run ufdutility.exe on my new mac
ufdutility.exe is a Windows program
It will not run on a Mac
You need to have Windows to run it
Allan -
How to run RWRUN.exe and RWCLIENT.exe in Linux
Our reports (11G R2) output desformat is PDF. We howerver, need to embed some fonts in the PDF when it is generated. So, we need to add the parameter PDFEMBED in the command line of RWRUN, RWCLIENT or RWSERVLET. However, the application server is Linux.
Since Linux does not have EXEs how to run these in Linux and how to pass parameters to them? i.e. reportname, directory,... etc.Hello,
You can find the shell scripts rwrun.sh and rwclient.sh in ORACLE_INSTANCE/config/reports/bin ...
Regards -
How to run a unix script from oracle warehouse Builder
Hi,
can any one share the information about, running the unix script or scripts using oracle warehouse builder.
Regards,
AkOne way is define a workflow. Inside the workflow you put
1)an external process that "points to" the shell script and then
2)put the mapping
The external process must have the "COMMAND" parameter set to the name of the shell script. If the script has parameters you must put them in the "PARAMETERS LIST" separated by "?" (for example, ?par1?par2).
The path where OWB executes the external process I think is the ORACLE_HOME of the OWB.
f you don't use workflow, you can try with this more complex solution. I tried with 9i and OWB 9.2 and it's working well.
You create an autonomous procedure (within a package or not) :
CREATE PROCEDURE Extract_Email_List
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
And use the sys.shell script that you need your dba/unix admin to install first of all, with a call like that.
sys.shell('sh ' || txt_dir_name || '/send_email_marketing.sh ' || txt_dir_name || ' ' || email_addr );
Then you import your procedure into OWB and use it in your mapping with the "pre-mapping" icon (you can set parameters for your proc with constants if you want).
To implement sys.shell, go to metalink and find "Note:168065.1" - "How to call a UNIX shell script from PL/SQL".
Once it's done once, it's not so bad. But I would still recommend the workflow approach also..
I hope this helps. -
How to run a sql script in oracle forms
Hi,
For me there is an sql script. I need to run that sql script in forms.
Actually we will run that sql file in pl/sql developer by giving @and the file name.
But how to run that file in forms.
Can any one help on these.Which book I have to look.
ThanksActually there is a script files which will drop all the indexes and tables.
DROP querry will be there for each index and each table.
So I run the script all the indexes and all the tables will be deleted. So using forms I have to run that script.
Thanks -
How to run sqlj.exe to translator Sqlj file which depends other file
I want to use sqlj.exe to compile sqlj file. I don't know what option can be set for Sqlj.exe can automatically compile sqlj file and it's dependent file(sqlj or java).
Here is one case:
There are three six files.
p1\A.sqlj
p1\A1.sqlj
p2\B.sqlj
p3\C.java
p3\DI.java
p4\E.java
1.the Class A has been declared as follow:
public class A extends C implements DI{
And in A.sqlj file, Class B and A1 will be used.
2.the class E has been declared as follow:
public class E extends C{
I want run sqlj.exe as follow:
sqlj -d=. A.sqlj
Does it can auto compile C.java, DI.java and A1.sqlj, B.sqlj?
We known, when java file is compiled, the dependent java file will be auto compiled,
for example, the command,
javac E.java
will compile E.java and C.java.
But how sqlj.exe automatically compile dependent file.
Thanks,I want to run an exe file Runtime.exec()
installed in a server from a client machine Server program that executes Runtime.exec() if told to do so by a client via a socket connection
everyday at a particular (fixed) time.Look at System.currentTimeMillis(), Calendar, Date, Timer... -
How to run the perl script from java ?
Hi , I need to run the pearl script from the server and to get the result of the script thro' java using SSH
Is there any 3rd party SSH API in java ?
Please help me out
thanks in advance
karthikThis seems like a very strange thing to want to do.
What is the perl script doing?
Do other programs (not some shell script) access this server-side perl script from a different machine?
If so how do they do it?
What currently triggers the perl script to execute?
What currently handles the output from the perl script?
If you can answer these questions (and understand the answers) you should be able to come up with a different approach to this.
You do not really want to call a remote perl script from a Java program, you want to achieve the effect you think that would have if you could do it.
So find the answers to the above questions, write them on 3" x 5" cards and lay them out on your desk.
What flow of control needs to happen? Which piece of code needs to produce or consume which piece of data?
If that fails, ask you self or who ever is making you do this what are the use-cases?
If you do not know what use-cases are or do not understand them well enough try reading
Use Case Modeling (The Addison-Wesley Object Technology Series) by Kurt Bittner and Ian Spence (Paperback - Aug 30, 2002)
http://www.amazon.com/s/ref=nb_ss_gw/002-7908514-4043267?url=search-alias%3Dstripbooks&field-keywords=use+cases&x=0&y=0
It is a short and easy to read book on the subject and also one of the best.
You MUST understand WHAT you are trying to achieve before you can decide HOW you are going to achieve it. -
How to run a Python Script in Terminal ?
Hello,
how can you run a Python Script in Terminal ? (OS X 10.4.5 - not OS X Server)
It´s about this Sript:
http://www.macosxhints.com/article.php?story=20060225091102170
Thanks
iMac G5 20" Mac OS X (10.4.5)While this isn't really specific at all to OS X Server (please keep your questions in the "Mac OS X Server" topic area related to OS X Server, it helps you and everyone else
Now then:
Please note the comments of "robg" (the site-"mom"/host):
"You'll want to save the script without the .txt extension, and remember to make it executable with chmod a+x site2template.sh
Save the file to your Desktop, and remove the ".txt" from the name so it's named: site2template.sh
then in the Terminal, issue:
chmod +x ~/Desktop/site2template.sh
"~" is shortcut for "the current user's (my) home directory"
From there you can simply use:
~/Desktop/site2template.sh /your/site
But, far better to:
choose a location to save the script, typically /usr/local/bin:
make the directory if you don't have one:
sudo mkdir /usr/local/bin
sudo cp ~/Desktop/site2template.sh /usr/local/bin/
then adjust the permissions:
sudo chmod 755 /usr/local/bin/site2template.sh
You may want to add /usr/local/bin to your path.
cat /etc/profile
and if you don't see it, add:
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
export PATH
ie:
sudo cp /etc/profile /etc/profile.bak
(back it up to play safe)
sudo pico /etc/profile
and add
:/usr/local/bin
to the path info.
Save it (ctl w)
exit (ctl x)
then type: source /etc/profile
(start learning vi or emacs eventually)
and you'll be able to run:
site2template /path\ to/your/site/to\ convert
Maybe you are looking for
-
Hi, Where do we configure Pension Funds for Norway ? It is under Savings Plans or Miscellaneous Plans ? Thanks !
-
My Ipod is currently PC formatted. If I were to format it for Mac would it still work as an external hard drive on a PC, or would I have to use special software.
-
Trouble with camera raw 6.7
Hi everyone, I'm on Mac, Photoshop CS5,1 all updated ok. I have a new problem after processed an image from Bridge to Camera Raw, when I click "Finish" and I return to Bridge, it doesn't take into account changes made in Camera Raw and I do not have
-
3600 slide - battery getting very hot on charging
Is this normal that the phone gets hot on charging. Or is it a flaw with the battery or the phone. Please advise
-
Hi, I have been using Captivate for a while now, and am slowly starting to get the hang of it! I am currently working on a project which includes static instructional material that is broken up by interactive software demos, all deployed through a LM