Unable to run an exe file from a Servlet
I am not able to run a Servlet that calls an exe file using the following code. trial.exe is was built from a C program and it is simply a program that creates a text file with some content. I am using Tomcat 6.0 and JDK 1.5 on a Windows XP.
{color:#000080}try
Runtime rt=Runtime.getRuntime();
String[] command = {"C://Tomcat 6.0//webapps//ROOT//WEB-INF//classes//trial.exe"};
{color}
{color:#000080}
Process p = Runtime.getRuntime().exec(command);
p.waitFor();
catch(Throwable t)
// System.out.print(t.getMessage());
}{color}
Before running the code on Tomcat I've compiled the code above in a simple java programe and it executed without any problem.
Then I compiled the code within a servlet. No luck. Then I treid the following options:
Executed the Tomcat service under the context of a user by specifying a user(Log On option) for the Tomcat service.
Then with Local System Account, selecting “Allow service to interact with desktop”.
this time also, no luck. Can somebody help me on this please ?
BJJ
For clarity I am rewriting the last sentences here:
Then I compiled the above code within a servlet successfully and invoked the servlet from a browser with and without the following settings of Tomcat 6.0.
1. Executed the Tomcat service under the context of a user by specifying a user (Log On option) for the Tomcat service.
2. Then with Local System Account, selecting �Allow service to interact with desktop�.
I was not succeeded with any of the methods mentioned above.
Similar Messages
-
Hi , can anyone tell me how to run an exe file from my java program. the exe is in the same directory as my java files . When i click on a button i want to put something in the actionPerformed() method which will launch the exe file - prog.exe
Hope someone can help me.
Thanks JimHi !
Look at the RunTime class... -
How do I run an exe file from a java program?
I need to run an exe program from within a java program.
what do I need to do this?
thanksSee java.lang.Runtime.exec()
-
Hi,
Do you know a way to run the "startup.exe" Tomcat file from jsp?
I have to start and stop a server remotely.
Maxpublic Process pFiglio;
Runtime rt = Runtime.getRuntime();
pFiglio = rt.exec("c:\\Tomcat\\startup.exe ");
then you can have
pFiglio.waitFor();
iEsito = pFiglio.exitValue();
pFiglio.destroy();
Look at specification:
http://java.sun.com/j2se/1.5.0/docs/api/
Look class "Runtime" and "Process".
Ema -
Run a .exe file with parameters from my java code
Hi, I want to run a .exe file from my java program. This .exe file will take some parameters in the command line. I need
to supply that to the program as well. Can someone help me in this please?
Thanks in advance.I am trying like this:
public class lauch_ext {
public static void main(String[] args) throws Exception{
try {
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("C:\\Apps\\myapp.exe arg1 -arg2 return_arg");
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null) {
System.out.println(line);
int exitVal = pr.waitFor();
System.out.println("Exited with error code "+exitVal);
} catch(Exception e) {
System.out.println(e.toString());
e.printStackTrace();
} -
How to run exe file from inside java
I wan to run an exe file from inside java code. How can I do it?
ThanksHi Oakam
This is very simple. Just go through the given code below
in place of FILEANDPATHNAME just give the exe's path and name
Note :- adding ".exe " is not necessary
public class exep
public static void main(String args[])
Runtime r = Runtime.getRuntime();
Process p = null;
try{
p = r.exec("FILEANDPATHNAME");
catch(Exception e)
Give ur feedback
Thanx
Ottran -
Hi all !!!
Is it possible to run a *.exe file from java.....
if yes how??
if no why not??
regards
adYes. It's possible. One of the Runtime.exec() methods are probably what you want:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
You can't instantiate a Runtime object, so you'll need to call it up by:
Runtime.getRuntime()
For example, if you want to run the Calculator in Windows, try:
Runtime.getRuntime().exec("calc"); -
How to run an external .exe file from an indesign pluging
Hi,
Suppose if I have written an separate application in C++ (.exe file) & need to run it from an indesign pluging(as if a service in windows). have you provided that facilities in your SDK? if it's please let me know how to run an external .exe file from a indesign pluging.
Thanks,I'm actully writing data in PMString to a external txt file.
another question..
if i want to execute an action when the ok button is cliked how can i do it?
whe i add a button(widget) i know how to handle it. please see my code.
// Call the base class Update function so that default behavior will still occur (OK and Cancel buttons, etc.).
CDialogObserver::Update(theChange, theSubject, protocol, changedBy);
do
InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID());
ASSERT(controlView);
if(!controlView) {
break;
// Get the button ID from the view.
WidgetID theSelectedWidget = controlView->GetWidgetID();
if (theChange == kTrueStateMessage)
//if (theSelectedWidget == kEXTCODGoButtonWidgetID
switch(theSelectedWidget.Get())
case kEXTCODGoButtonWidgetID:
this->ViewOutput();
break;
case kEXTCODFindButtonWidgetID:
this->SaveLog();
break;
// TODO: process this
} while (kFalse);
I do two actions "SaveLog" & "ViewOutput()" using two buttons. But i dont know how to execute an action when the ok button is clicked... -
Running .EXE file from Java
Do you know, how run an .exe file, for example Internet Explorer or other program, from Java application?
It's very important for me.Too run external program and pass string arguments see class java doc
of java.lang.Runtime method exec . You see online or download or
rename src.jar to s.zip EXTRACT and see
exec
public Process exec(String[] cmdarray,
String[] envp)
throws IOException
Executes the specified command and arguments in a separate process with the
specified environment.
This is a convenience method. An invocation of the form exec(cmdarray, envp)
behaves in exactly the same way as the invocation exec(cmdarray, envp,
null).
Parameters:
cmdarray - array containing the command to call and its arguments.
envp - array of strings, each element of which has environment variable
settings in the format name=value, or null if the subprocess should inherit
the environment of the current process.
Returns:
A new Process object for managing the subprocess
Throws:
SecurityException - If a security manager exists and its checkExec method
doesn't allow creation of the subprocess
IOException - If an I/O error occurs
NullPointerException - If cmdarray is null, or one of the elements of
cmdarray is null, or one of the elements of envp is null
IndexOutOfBoundsException - If cmdarray is an empty array (has length 0)
See Also:
ProcessBuilder
getRuntime
public static Runtime getRuntime()
Returns the runtime object associated with the current Java application.
Most of the methods of class Runtime are instance methods and must be
invoked with respect to the current runtime object.
Returns:
the Runtime object associated with the current Java application. -
How to run .EXE files from Linux Portal page?
We have an IIS web server that runs a Photoshow_player.exe slide show program. I'm not sure if this can run from Linux Portal, but we are trying.
The link in an IIS web page looks like this:
<a> href="file:///\\mulsrv22\share\PCS\PhotoshowPlayer.exe" title="clean slate">clean slate</a>
Portal is installed and running from two Linux servers. If I create a link using the above syntax, I get "can not display page" browser errors.
I copied the entire PCS directory from the Windoz box to a Portal web_dav folder, but running the .EXE link from that Portal page gives errors indicating that the /PDS/data/.XML and /PCS/data/.jpg files can not be found.
Any ideas on how I can run this slide show from Linux Portal?
Thanks.
--Donif you just need to run a slideshow in you portal, why don't you use a javascript slide show ?
Just "googleize" and you'll find tons of javascripts taht can do that.
for example : http://www.barelyfitz.com/projects/slideshow/ -
hi all
i am looking for code to run a program(any EXE File ) from developer Form (Developer 6i)
thanks a lotlook at the documentation for the HOST command in Forms.
Regards
Grant Ronald
Forms Product Management -
Running exe files from java applications
Hello All,
Is it possible to run executable files from java applications?
I need to run an exe file on the client from the server machine, the exe could reside on either the server or any other machine on the LAN. Is it possible to specify the path of where the exe resides, and run it on a client machine?HI,
I tried to launch a MS Word application using runtime.exec but it gives me some problem
The foll. code to launch a txt file using notepad works.
Runtime rt = Runtime.getRuntime();
String[] callAndArgs = {"notepad.exe","C:\\coo7\\wizard.txt"};
Process child = rt.exec(callAndArgs);
However, oif I try to launch a MS Word application, it asks for the entire path of WINWORD.exe, (unlike just specifying notepad.exe as the first argument in String[] callAndArgs) and this can vary from one machine to another.. how do I get around this?
The foll. code snippet works but the complete path of where WINWORD.exe might be installed on any machine, is not fixed:-(
Runtime rt = Runtime.getRuntime();
String[] callAndArgs = {"C:\\Program Files\\Office\\Office10\\WINWORD.exe","C:\\coo7\\wizard.doc"};
Process child = rt.exec(callAndArgs);
Any idea/suggestions pls.. -
Unable to run a Batch File Operating System Command
Using XI 3.0, I am unable to run a Batch File Operating System Command After Message Processing.
My Batch file:
gpg -se -r BOA3RSKY --armor --passphrase-fd 0 %1 < C:\Progra~1\GNU\GnuPG\gpgin
My Command Line (ID scenario)
exec "cmd.exe /c C:\Progra~1\GNU\GnuPG\boagpg.bat %F"
If I execute
exec "cmd.exe /c type C:\Progra~1\GNU\GnuPG\boagpg.bat >xis.txt"
It displays the contents of boagpg.bat file in xis.txt.
I just don't understand why when I run the batch file, I would expect an %F.asc encrypted file in the same directory as the %F unencrypted file.
Any ideas?
or will I need Basis to create commands that will allow me to run GPG from XI Command Line?Check this links if its helpful
http://help.sap.com/saphelp_nw04/helpdata/en/bb/c7423347dc488097ab705f7185c88f/frameset.htm
/people/sap.user72/blog/2004/01/30/command-line-help-utility
Check this thread a similar problem
Process Integration (PI) & SOA Middleware
Note 841704 - XI File & JDBC Adapter: Operating system command
http://service.sap.com/sap/support/notes/841704
Try to see the below links
/people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
OS Command on FTP
OS command line script - Need help
FTP - Run OS Command before file processing
Note: reward points if solution found helpfull
Regards
Chandrakanth.k -
Unable to pick up the file from Receive Location
BizTalk is unable to pick up the files from receive location.
My admin console is working so slow.
It is showing the problem of snap-in as follows:
I have checked all my receive location and its masking,it is working fine.
Actually it is working fine in dev server(snap-in problem is not occuring in dev server ) but when I import MSI and binding in UAT server.
It is not picking up the file from receive location.
I want to know one more thing :if my message box database is not working fine,will it receive the files from receive location.
PrakashFor files not received by receive location. If the Receive Location is still enabled but files are not processed by Receive Location, then check whether the host instance configured with your receive location is running. If the host instance is in
running state, restart the host instance and try.
Regarding the error in the admin console as shown in the image, people started to see this issue with admin console from BizTalk 2009 onwards. This happens in cases like you have done some activity with console and before its been refreshed it you do more
activities like expanding the node you will see this error. Sometimes WMI is bit slowly to refresh your admin console screen. Just wait for few seconds untill the WMI screen is rendered completely. Ensure you have all the cumulative updates installed for your
version of BizTalk and also ensure the service pack for your OS is updated.
Obviously if message box is not working, files will not be received/processed. But if message box is not in healthy state this would affect all other application not just one and in-fact it would affect entire BizTalk not just Receive Locations.
To start analysing this file not been processed by Receive Location, start with checking the host instance as mentioned.
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply. -
Launch EXE file from IC WebClient
Hi All,
How can we call .exe file from IC WebClient.
we want to launch the .exe file from the navigation into application work area.
any suggestion would be great.
Thanks,
Raj.Hello Raj,
The best way to do this would be with the Transaction Launcher. Depending on the version of CRM you are running, you might need to modify the handler class -- as some newer version of CRM seemed to append the http preface to the front of any non-URL file name. Of course, if your EXE program runs as a web application, you could just call the URL.
Best regards,
John
Maybe you are looking for
-
HT1473 how to get my voice memos to my PC
my iPhone was synced to an old iTunes library now i have a new mac - created a new user id for apple and connected to MAC my Mac has another iTunes library contents as well how do I make sure I have whats on my iPhone on the PC - Do I have to create
-
How do i get my songs back if itunes wipes them off?
i plugged my iphone into the laptop to transfer my new songs to my library and its wiped all the songs i've just bought off my phone, how do i get them back?
-
Can't load an image in flash builder
Hi, I recently copied my project from one computer to another. On my old computer, everything worked fine, but on my new computer, when it tries to load images, it gives me this error : Error #2148: SWF file http://localhost/MyProject-debug/MyProjec
-
Problem with filestree strange behavior
i'm creating a tree which shows w directory with containing subfolders and files, and displays checbox with corresponding filename and size, everything is ok but when i click on checkbox, and then once again select it the sign to corresponding chechb
-
Background ALV problens, lack of coluns
Hello guys, I'm building a simple report that has about 27 coluns. The problem is when the user run's the report in background mode. After running, when you'll check the spool, it's incomplete (some of the last coluns just don't appear). I thought bu