Executing external programs in Windows from UNIX
Hi all,
I would like to call an external program in Windows box from UNIX box. I tried to create a command in SM69, specify the command and OS type to Windows. When I try to execute the command in SM49, I got an error 'program_start_error'.
I tried also to create an RFC destination in SM59, using connection type = T (start external program via TCP/IP), specifying the program in the Program field and specify the Windows box hostname (or IP add) in the Target host. But this also seemed could not work.
Is there any other ways I could do this?
Thank you.
Mizwan
<b>RSBDCOS0 Execute UNIX commands. </b>
Look at <b>SM69, SM49</b> and
Function <b>SXPG_COMMAND_EXECUTE</b>
e.g. SM69
Press F5 or click Change button
Press F6 or click Create
Fill in the following parameter :-
Command name - the unix scripts file name e.g. ZABAPFTP
Operating system command - e.g. sh
Parameters for operating system command - e.g. /sap_production/usr/sap/trans/data/zabapftp.sh
REPORT ZABAPFTP.
data : t_btcxpm like btcxpm occurs 0,
p_addparam like sxpgcolist-parameters,
rep_date like sy-datum,
t_date like SXPGCOLIST-PARAMETERS.
rep_date = sy-datum - 1.
t_date = rep_date.
*p_addparam = '/sap_production/usr/sap/trans/data/zabapftp.sh'.
refresh t_btcxpm. clear t_btcxpm.
call function 'SXPG_CALL_SYSTEM'
EXPORTING
commandname = 'ZABAPFTP'
additional_parameters = t_date
TABLES
exec_protocol = t_btcxpm
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
others = 12.
if sy-subrc ne 0.
write:/ 'Error in ZABAPFTP ', sy-subrc.
endif.
regards
vinod
Similar Messages
-
Executing external programs from PL/SQL?
Hi All,
Is it possible to execute external
programs (i.e. shell scripts, or
perl scripts) from a stored procedure
or trigger?
I know that typically it is the other
way around, but hey try telling that
to my boss.
Thanksyou cant execute any operating system commands from plsql
procedures. but you can achieve result by using either java
stored procedure or pro*C program .
Suresh Vemulapalli -
Concurrent program to FTP from Unix to windows
Hi,
I am trying to FTP files from UNIX to a windows machine. I tried to do it through a shell script but it did not work , so i tried at the command prompt.
I am able to login and get files from windows to UNIX but I am not able to PUT files.
I spoke to the admin and he says all permissions are granted on teh remote host. I am able to put files with the same userid from windows to windows but not from UNIX to windows.
Any ideas why? User id has read/write permissions.
thanksare you sure its a path issue i face the same issue before and find out it was a windwos premission issue
fadi hasweh
http://oracle-magic.blogspot.com/
Oracle is not Magic, it just takes years of experience -
Pocket PC -Problem executing external program from java
Hi,
I'm developing an application on Dell Axim x51 PDA. I am using mysaifu jvm. The application needs to execute an external program (.exe) for which I'm using the Runtime class.
I get java.io.IOException: The system cannot find the file specified.
I have verified that the file exists. ( i used File class to check if the file exists)
here's the part of code :
Runtime rt = Runtime.getRuntime ();
File sktScan = new File("\\My Documents\\RFID\\ScktScan.exe");
if(sktScan.exists())
System.out.println("FILE EXISTS");
String command = sktScan.getAbsolutePath();
process = rt.exec (command);
System.out.println("Socket Scan Path is : "+command);You have acces to "java.lang.Runtime currentRuntime.exec()" method ? in my case NetBeans IDE dont give me for my compilation with :
microedition.configuration CLDC-1.1
microedition.profiles MIDP-2.0 -
How to execute external program in java?
My question is how to execute an external program in java.
I need to call a unix command in java.
Thanks.it depends on what you are trying to do. Following are the two methods
1. Runtime.exec() : this method allows you just to call an external program as a seperate process
2. JNI (Native Interface) :- As of right now only C and C++ are supported by this method. This method allows you to directly call the C/C++ methods from JAVA -
My java application has a feature in which it executes an external program, which creates a file, then shuts down. That's working great.
My problem: how can my program tell when the external program is finished executing, so that it can work with the created file?Basically you just need to call waitFor on the Process object returned from Runtime.exec. See this article for a more detailed discussion: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
-
Executing external program (non-java)
Hello,
I just started programming Java. I installed SunForum3.2 on SunRay some days ago and I was faced with the problem that all that the people who are registered with the GateKeeper-Software are not shown anywhere. So I developed a small app, that read out a file containing the output of the command "registrar -q" ( displays all registered users including their SunForum-name ). Now some people not working on the SunRay-platform would like to connect as well to the SunForum-users. For this reason I'd like to execute "registrar -q" periodically and directly use the output from and within a Java-app but I couldn't find a way to execute the program "registrar -q" so far.
Thanks for your help.
ThomasProcess p = Runtime.getRuntime().exec( "registrar -q" );
Then read the Process's input stream, which should give you the stdout of your command. There are plenty of full code examples of how to do this floating about, and you should have no problem with it. -
JavaProcessBuilder freeze to execute external program
I am trying to run external program using JavaProcessBuilder class. This program doesn't return any status ( it freeze here: int status = mosesPro.waitFor();) when there are more than 20 lines in my test file (command [3, 4]). I would be very thankful for any solution/suggestion. I have attached my sample code below:
String command [] = new String [5];
command [0] = "/Users/X/tools/moses/moses-cmd/src/moses";
command [1] = "-config";
command [2] = "/Users/X/Documents/thesis/workspace/juneTest/translation/evaluation/filtered.test/moses.ini";
command [3] = "-input-file";
command [4] = "/Users/X/Desktop/test2.input";
try {
child = new ProcessBuilder(command);
mosesPro = child.start();
int status = mosesPro.waitFor();
if (status == 0) {
BufferedReader reader = new BufferedReader(new InputStreamReader(mosesPro.getInputStream(), "UTF-8"));
String line;
line = reader.readLine();
while (line != null) {
System.out.println(line);
line = reader.readLine();
reader.close();
} else {
BufferedReader errorReader = new BufferedReader(new InputStreamReader(mosesPro.getErrorStream(), "UTF-8"));
String errLine;
errLine = errorReader.readLine();
while (errLine != null) {
System.out.println(errLine);
errLine = errorReader.readLine();
errorReader.close();
mosesPro.destroy();
} catch(Exception ex) {
ex.printStackTrace();
}You have a deadlock. The stdout buffer is filling so the process is waiting for space to become available. Space can never become available since you don't read the stdout stream until the process has terminated. You should read the 4 sections of http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html and implement the recommendations.
Note - the 'traps' article is concerned with Runtime.exec() but the traps are just the same with ProcessBuilder. -
Execute external program from java in the same virtual machine
hello,
I need some help. here is what i need: i'm developing a test tool and i need to execute the application to be tested from my test tool in the same virtual machine so that i can be able to connect to that application and catch events like clicking and so on.
problem is that i do not know how to launch the application i want to test in the same virtual machine as the test tool.
any help would be good,
thanksproblem is that i do not know how to launch the
application i want to test in the same virtual
machine as the test tool.Just invoke the main class of that application.
You probably don't want to hear this, but writing a test tool is not easy if you are going to try to catch events etc. It's probably a bit too hard for you if you don't know how to invoke an app within the same VM.
Kaj -
How can I execute an IE browser window from within my java application?
I am programming a java application that requires me to execute a browser application and point to a specific web site. How can I do this? I cannot seem to find any examples on the web.
Hi Heals,
This forum is for discussing Measurement Studio for Visual Basic and is not really a good place to ask general purpose Java questions. I suggest searching one of the comp.lang.java.* newsgroups at http://groups.google.com/.
Off the top of my head, though, I would say take a look at the Runtime.exec method.
- Elton -
Making batch files to execute java programs in windows
In my comp sci class, i found a folder with a batch file, an application file, and all class files necessary to run the program.
how do i take my java program and make a batch file to run it (in dos) like that program in my comp sci class?Okay, here are your steps for running a java program from a batch file:
1) Open Notepad
2) type the following:
set JAVA_HOME=C:\j2sdk1.4.0_03 // specify the path where your jdk is
set path=%JAVA_HOME%\bin;.
javac {-classpath .;one.jar;two.jar} YourProgramName.java
java {-classpath .;one.jar;two.jar} YourProgramName
The stuffs inside {} is not necessary if your program doesnt use any .jar files.
3) Save the notepad as mybatch.bat in the directory where your Java program is located.
4) In the DOS prompt, go to the directory where you have .java and .bat files
(use 'cd' command)
5) Now, type mybatch.bat and press ENTER.
Thatz it. Your program runs like a charm now!!!
(provided the compiler is pleased with ur code :)
-- layman's pal -
Execute external program, ErrorStream and InputStream
I use this command to launch new process:
Process proc = Runtime.getRuntime().exec(cmd);
as stated in java doc
The methods that create processes may not work well for special processes on certain native platforms, such as native windowing processes, daemon processes, Win16/DOS processes on Microsoft Windows, or shell scripts. The created subprocess does not have its own terminal or console. All its standard io (i.e. stdin, stdout, stderr) operations will be redirected to the parent process through three streams (getOutputStream(), getInputStream(), getErrorStream()). The parent process uses these streams to feed input to and get output from the subprocess. Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock.
but I do not need any those streams. what happen if I make proc = null;
will there be any potential block or deadlock?I have read this article before.
there is usage of waitFor() in example but I do not want to use waitFor().
I want to launch many processes and monitor them by some other way... for example via sockets...
right now I launch my process via shell script and redirect STDOUT and STDERR to /dev/null
is it possible to launch it from java the same way?
Edited by: NoName on Jan 27, 2009 4:16 AM -
Launching Programs and Windows from Flash
Hi,
I am new to flash having done most of my previous work as
HTML. I am trying to create a CD-ROM which I want to open seperate
swf files as exe's in new windows. When I do it at the moment it
treats it like a web page and asks if i want to open. Is it
possible to do this seamlessly so they just open as if it was
written in Visual Basic etc?
Any help would be appreciated.You will want to look at the docs on fscommand and publishing
the .swf files as .exe. The other windows you will want to open
will need to be opened using the fscommand from the main .exe file,
these exe files will need to be stored in the fscommand folder in
the same root as your main .exe file. -
How can I execute an external program from within a button's event handler?
I am using Tomcat ApacheTomcat 6.0.16 with Netbeans 6.1 (with the latest JDK/J2EE)
I need to execute external programs from an event handler for a button on a JSF page (the program is compiled, and extremely fast compared both to plain java and especially stored procedures written in SQL).
I tried what I'd do in a standalone program (as shown in the appended code), but it didn't work. Instead I received text saying the program couldn't be found. This error message comes even if I try the Windows command "dir". I thought with 'dir' I'd at least get the contents of the current working directory. :-(
I can probably get by with cgi on Apache's httpd server (or, I understand tomcat supports cgi, but I have yet to get that to work either), but whatever I do I need to be able to do it from within the button's event handler. And if I resort to cgi, I must be able to maintain session jumping from one server to the other and back.
So, then, how can I do this?
Thanks
Ted
NB: The programs that I need to run do NOT take input from the user. Rather, my code in the web application processes user selections from selection controls, and a couple field controls, sanitizes the inoputs and places clean, safe data in a MySQL database, and then the external program I need to run gets safe data from the database, does some heavy duty number crunching, and puts the output data into the database. They are well insulated from mischeif.
NB: In the following array_function_test.pl was placed in the same folder as the web application's jsp pages, (and I'd tried WEB-INF - with the same result), and I DID see the file in the application's war file.
try {
java.lang.ProcessBuilder pn = new java.lang.ProcessBuilder("array_function_test.pl");
//pn.directory(new java.io.File("K:\\work"));
java.lang.Process pr = pn.start();
java.io.BufferedInputStream bis = (java.io.BufferedInputStream)pr.getInputStream();
String tmp = new String("");
byte b[] = new byte[1000];
int i = 0;
while (i != -1) {
bis.read(b);
tmp += new String(b);
getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + tmp);
} catch (java.io.IOException ex) {
getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + ex.getMessage());
}Hi Fonsi!
One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
/Thomas -
Re: Error while Execute External Operating System Command using T.code SM49
Dear Experts,
I Have uploaded one .exe file in the application server (eg: sum.exe) and created the OS command in SM69 transaction .
And maintained the application server path in the 'operating system command' field in SM69 t.code.
Our SAP system, oprating system is UNIX.
After I have executed the external command using transaction SM49 , but I got the below error.
Can not execute external program (permission denied) , External program terminated with exit code 1
Immediately I run the SU53 transaction code to check the authorization, but Authorization was successful.
Could any one please help on this error.
Thanks in advance.>>Can not execute external program (permission denied) , External program terminated with exit code 1
You need to give the permission as 755 to your file.
>>I Have uploaded one .exe file in the application server (eg: sum.exe)
You are on UNIX and do not expect to any result of .exe file as UNIX doesn't know about this.
Maybe you are looking for
-
How can I highlight a single app in my dock?
I believe this is an exclusive Lion feature. Forgive me if I'm unable to explain it well. A handful of times, I was able to cast a spotlight on an app in my dock, and then the rest of the screen became dim. For example, my Pages app was once open;
-
How can I recover iPhotos from my hard drive?
I screwed up my MacBook Pro by adding a exFAT partition while operating in BOOTCAMP. Now I cannot start my machine. I can probably pull my hard drive and enter it as the OS Yosemite was probably not affacted. Is there a way to retrieve all my phot
-
Problem in CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
While working in PDF attachment I am using Function 'GET_JOB_RUNTIME_INFO' as bellow CALL FUNCTION 'GET_JOB_RUNTIME_INFO' IMPORTING eventid = gd_eventid eventparm = gd_eventparm external_program_a
-
FCP XML to Flint - Problems with Time Remap
My Flint artist and I have had some problems with the XML Export and Import that we cannot figure out. The XMLs from FCP sequences that have variable speed Time Remaps applied show up on the Flint with those particular clips with the wrong in/out poi
-
I have this massage:your iphone could not be activated because the activation server is temporarily unavailable