Capturing multiline process output ?
Hello all. I am writting a few methods that can execute a UNIX command
or script and then grab standard output. However, when I try to capture
the output I am only able to get the first line ? Here is a code snippet
private java.lang.Process shellProcess = null;
public void RunShellCommand( String command ) throws IOException
try
if( command != null )
String[] kshCommand = { "/bin/ksh", "-c", command };
/* Use the runtime exec() method to start the command. */
shellProcess = java.lang.Runtime.getRuntime().exec(kshCommand);
catch( IOException ioe )
throw( ioe );
public String getShellCommandOutput() throws IOException
String readStr = null;
if( shellProcess != null )
try
/* Create a buffered reader. */
BufferedReader stdInput = new BufferedReader( new InutStreamReader( shellProcess.getInputStream() ));
readStr = stdInput.readLine();
catch( IOException ioe )
throw( ioe );
return( readStr );
}These methods are called from a GUI like this:
myClass.RunShellCommad( "ls -l" );
String out;
while( (out = myClass.getShellCommandOutput()) != null)
/* Stuff ouput into a JTextArea */
}Does anyone know why I can only get one line of output. Thanks.
you r reading the output using this command
readStr = stdInput.readLine();
well you r calling stdInput.readline() only once
do something like this
while (readStr != null)
readStr = stdInput.readLine();
}
Similar Messages
-
Capture generated html output from jsf page in bean
Hi Member,
I have need to capture the html output coming form jsf page. means aftr rendering what html is displayed before user, we have need to get it in programm.
like if we use:
<h:dataTable......>
<h:colum>heloo</h:column>
</h:dataTable>
then their ouput will be:
<table>
<tr><td>heloo</td></tr>
</table>
and i have need of these complete line with <table> ......</table>
Please help me...
Thanks
Shailendra KumarThnx for quick reply.
But i want to capture it in render response phase. May it will be possible??? Is render response phase is responsible for generation of HTML format?? If yes then how can we capture output coming from this phase.
URLConnection if fine but it still hit server once. I don't want that. I want to store page html format during its view preparation for html.
Thanks
Shailendra Kumar -
Our organization uses an Oracle database hosted on a Unix platform and one of our data processing outputs is a “stuffer” document that has a barcode, and Unix jobs automatically send the document to a printer.
Is there a way, or does Adobe have a product or solution, to create a PDF version of the document including the barcode, before it’s sent to a printer?What format is the document that is printed? Or what technology is used to format the printer? There isn't a standard way of doing things in Unix.
-
Java.lang.Process output stream problem
Hi, I have a program that starts a process (java.lang.Process) using the java.lang.Runtime.exec() and it attemtps to interface with it using the provieded io streams. I have both the output and error streams being handled on their own threads and I have a hashmap of output lines/command pairs that are checked so that when the process outputs certain lines to the console it feed the proper input into the process. My problem is that when I feed the input into the process it dosen't respond to it almost like the user hasn't pressed enter, The process hangs. I have tried using /n /r and permutations thereof but nothing works. The thread does read the lines from the process and does output to the process from what i can gather. Can you help me!
here is some of the code..
public void run() {
try {
//the process's output
InputStreamReader isrOutput = new InputStreamReader(inOutput);
//the process's input(our output)
PrintWriter pw = new PrintWriter(outInput);
String line = null;
while(true){
if(brOutput.ready()){
line = "";
while(brOutput.ready())
line+=(char)brOutput.read();
System.out.print(line);
if(commands.containsKey(line)){
pw.println((String)commands.get(line));
System.out.println((String)commands.get(line));;
} catch (IOException ioe) {
ioe.printStackTrace();
}ThanksOops.. i forgot to flush my PrintWriter /blushing......... Thanks
-
Hello,
I purchased Adobe Premiere Elements 8 about one week ago. I installed it and everything seem to work well in my first project. I am new at editing videos but I was succesful in testing it by loading an existing video file in avi format from my computer and then doing some very basic editing (I splitted 2 scenes and added a title).
After my first succesful project (described above) I started a brand new project. Here, I want to capture a one hour video from the dv output of a video camera. So I connected the camera to the PC and then started adobe elements 8. Before starting the capture I only checked the boxes that said "capture video" and "capture audio" (the other 2 boxes that said download to timeline and autoanalyze were left unchecked). After that I started the capture process.
After the video capture was completed, a small window opened at the bottom saying that a PEAK FILE was being generated. After the peak file generation finished, I looked at the captured video. The video looked perfect. However the audio of the video was too fast. By this, I mean that the voices of the people in the movie were like they were speaking at more than twice the normal speed. Or to explain it in a different way, they sounded like the chipmunks.
So now I come to the question of this thread I started. Is there a way that I can fix the audio part of the video I captured? I will appreciate any help on this. Below I listed a few additional details in case this is needed.
Thanks,
ronel_8
PS. Here are some more details about my system:
1) Operating System: Windows XP
2) I am capturing the video on an external drive with 40 GB of available space. The external drive is connected to a PC via a USB connection.
3) Computer CPU: 2.4 GHZ
4) Computer RAM: 1.25 GB
5) Video tape is about one hour long.Hello Bill and Steve,
Your responses are very helpful. Although I was not able to fix the problem yet I do seem to think from what you both say that my system may be too slow to capture the one hour video. In any case I will copy below more details about the system as you requested:
1) Results from running Gspot:
The audio section of the Gspot window was blank. That is, no information was there. The File and Container sections say:
File Size: 12.6 GB
Note: 7.63 GB unneeded bytes at the end of the file
DV Type1 AVI
2) I did run the Gspot on another good avi file (captured to the PC with same camcorder) and says:
Codec PCM Audio
32kHz 1024 kb/s tot (2 chnls).
I suppose these are the audio settings from the camera.
3) Yes, I am capturing video from a miniDV camcorder (JVC GR-D70U).
4) I did not defragment the external drive prior to capturing the video with the audi problem. So I will give that I try and see if it solves the problem.
5) The external drive I am using is formatted to NTFS.
6) The computer is a Dell Dimension 2400, CPU: 2.4 GHZ, RAM: 1.25 GB
7) HDD Size=74GB and 11 GB of free space. But I am downloading video to external drive that has 60 GB free space.
One last piece of information that may be useful. If I open the AVI file (that I captured with Adobe Premiere Elements) with Windows Media Player, the audi sounds good. However if I open it with Adobe it has the problem I mentioned in my previous e-mail.
I'll aprreciate any further hints.
Thanks again,
ronel_8 -
Is possible capture InputStream Process to javaws application from another?
Hello i have simple problem when launch java web start application to another java program.
I do not succeed to capture the system.out of the application javaws.
what is problem?
this is my simple example.
import java.io.*;
public class Demo {
static void Demo()throws IOException {
// start the ls command running
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("javaws http://localhost:7080/myapp/myapp.jnlp" );
// put a BufferedReader on the ls output
InputStream inputstream =
proc.getInputStream();
InputStreamReader inputstreamreader =
new InputStreamReader(inputstream);
BufferedReader bufferedreader =
new BufferedReader(inputstreamreader);
// read the ls output
String line;
while ((line = bufferedreader.readLine())
!= null) {
System.out.println(line);
// check for ls failure
try {
if (proc.waitFor() != 0) {
System.err.println("exit value = " +
proc.exitValue());
catch (InterruptedException e) {
System.err.println(e);
public static void main(String[] args)
try
Demo();
catch(Exception ex)
ex.printStackTrace();
}Dear try67
I just forwarded him to a page (by Adobe Expert) where I had hoped this will help him.
It could also be your side.
I don't think that it took a comment from another. Unless it is a personal good advice. I just wanted to help and free of charge
Sometimes we overlook a detail by quick reading. Is this never happened to you ? -
Can i use labview to capture and process images from ip cameras connected to a switch.
Hi,
i have more then one ip cameras conneted in LAN by a switch. i have a PC conneted to same switch. is it possible to capture images from these ip cameras and process them(for example performing simple barcode scan or QR-code scan or OCR)? Which IP cameras will be supported?There is functionally no difference whether the camera is connected directly to the system or via a switch. Both should work the same. The only real requirement that you'd need to care about is whether the switch can pass multicast UDP traffic correctly (this is used for network discovery of IP cameras). Generally all unmanaged switches (probably what you are using) will treat multicast traffic identical to broadcast traffic, but some managed switches/routers may need to be configured to pass multicast.
Eric -
How to capture Runtime.exec() output? doesn't seem to work?
This is the first time I've used Runtime.exec();
Here's the code:
Runtime rt = Runtime.getRuntime();
process = rt.exec(jobCommand);
BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line=null;
while((line=input.readLine()) != null) {
System.out.println("OUTPUT: " + line);
int exitVal = process.waitFor();
} catch(Exception e) {
e.printStackTrace();
}//end catchas you can see, this is just copied and pasted out of the standard example for this method.
When it gets to the line:
while((line=input.readLine()) != null)
it doesn't read anything. However, when i run the SAME exact command from the windows CMD prompt i get a ton of output.
what am i doing wrong here?
thanks.Welcome to the forum!
>
as you can see, this is just copied and pasted out of the standard example for this method.
>
No one can see that - you didn't post a link to the example you said you copied.
>
it doesn't read anything. However, when i run the SAME exact command from the windows CMD prompt i get a ton of output.
>
No one can see what command you are talking about; you didn't post the commnd or even describe what output you expect to get.
>
what am i doing wrong here?
>
What you are doing wrong is not providing the code you are using, the command you are using or enough information about what exactly you are doing.
No one can try to reproduce your problem based on what you posted. -
Output 'incorrectly processed', 'output could not be issued'
Hi,
We trying to trigger a Bill of Lading custom Z print output type. This output was working correctly for some time and now it has started failing. When we try to issue the output through screen option it gives message 'output could not be issued'. But we are not able to figure it out as why this message is appearing even though all output configuration is good. The same output is triggering if we make some changes in the shipment change transaction(although changes are not relevent for the output parameters) but this behaviour is not constant as output triggers some time after the changes and some time may not.
When we try to retrigger the output type using messages option on the shipment, error appears as 'incorrectly processed'.
Please suggest as why this output type is behaving like this. Any help will be highly appreciated.
Thanks,
Sharanif it worked well in the past, then I would check if there was a change in the print program or in the form or in customizing, further I would investigate if this could be triggered from "outside" e.g. implementing OSS notes, activate business functions etc.
If you know the date when it started failing, then checking the transports of changes prior to this event in SE10 could be a good starting point. -
Capture preset anamorphic - output aspect ratio wrong
My capture preset was dv pal anamorphic as the footage was taken on a widescreen camera. Footage looks fine in FCP6, but when I export a QT file, the aspect ratio is wrong. Why should this be and how do I correct it?
Hi Simon,
this is because Quicktime is showing the whole file, squashed.
What is your final destination? DVD? Web? Presentation? That will depend on how you will output the file. If you are planning to play it on an SD TV, go to your timeline and make sure you change the ratio to SD with a widescreen mask.
If you want widescreen to play correctly on a standard def tv, then you need to add the mask to it. If you are planning to put it on a SD tv with widescreen, the TV's aspect ration is changed to accomodate the file. So it is playing back correctly, it is the TV that will change. This is why dvds often have two different discs, one for SD and one for wide screen.
I hope this is helpful. -
Execute MCSI report in background : process Output
Hello Folks,
I am working on Ecc 6.0 . i executed the report MCSI (RMCY9200) in background .
I need to process the output of that Job , But could not find any spool for the same job ...
Then i came to know that the Output of the job has to be seen from the Select Version option with the same Report MCSI(tcode)...
But now i have no idea, as how to process that output through an abap program...
Experts, please throw sum light, as how i can process it through an abap program ?
Thanks & regards
Sonal...Hi Rajani,
This is because of the printer specification selected while running/scheduling the job.
Please follow the below steps to get it corrected:
1) Go to SE38, enter the program name and press F8
2) Enter the selection parameters and from menu click Program -> Execute in Background
3) Now you need to select *Properties* button at below
4) Click on Format in the Next window
5) Select one which format with maximun WIDTH ot the width which works for you.
6) Save the Settings and run the job
Hope this helps!
Regards
Shital -
Accessing the run time data of processed output types in VA02
Hello All,
I have to write a code to make entriesin the Ztable when the user processes the output tpe in the VA02 transaction. How I can know that user has attached a new output type for that order?
I am writing my code at the save button of the VA02 tcode in the exit: userexit_save_document.
I checked for the Xnast, ynast, inast entries. But none of them store the current data of the processing of output types screens.
Please help.,
Thanks in advance
Rgds,
Madhuridata :it_xnast like vnast OCCURS 20 WITH HEADER LINE,
it_x1nast like vnast OCCURS 20 WITH HEADER LINE.
field-symbols :
<Fs1> type ZSDTT_VNAST,<Fs2> type ZSDTT_VNAST .
data: wa_xnast type vnast, wa_x1nast type vnast.
assign ('(SAPLV61B)XNAST[]') TO <fs2>.
assign ('(SAPLV61B)VNAST[]') TO <fs1>. -
Field Changes not captured in processing log in service request
Hi Experts,
I have activated the processing log for service request in CRM, but I am only able to see the changes done to status,notes,attachments. As the field level changes are not shown in processing log in web ui, but the same is visible in the GUI in change log. Is there any specific setting which I need to do capture the field level changes? Please let me know on the same
Thanks
AbishekHi Navin,
Please navigate to the following SPRO path and update the customizing the field that you display in the processing log.
SPRO->Customer Relationship Management-> Transactions -> Settings for Service Requests -> Settings for Processing Log -> Define Change History for Processing Log.
Thank you,
Regards,
Mayoo -
Capture runtime std output and error to logfile using dbms_scheduler
Hi,
I am trying to replace my cron jobs with dbms_scheduler.
can we capture output of a job from DBMS_SCHEDULER to a logfile similar to cron.
As in cron, we capture output in logfile.
30 18 * * * test.ksh > /home/someuser/cronlogs/clean_tmp_dir.log 2>&1
I am not getting any way to send std output and error to logfile in dbms_scheduler.
I tried also ...
dbms_scheduler.set_job_argument_value('test.ksh',1,'>');
dbms_scheduler.set_job_argument_value('test.ksh',2,'/home/someuser/cronlogs/clean_tmp_dir.log');
dbms_scheduler.set_job_argument_value('test.ksh',3,'2>&1');
But output not coming to /home/someuser/cronlogs/clean_tmp_dir.log.
Any help?
ThanksHi Karam,
Unfortunately there is no good, easy way to do this. The Scheduler treats arguments as literal arguments so ">" is seen as a regular argument and not a redirection symbol.
You will have to create a one line script that does your redirection and then call that script from the Scheduler.
Here's another idea. Write a redirect.sh script which takes three arguments: script_to_run stdout_file stderr_file
Then you can convert your cron jobs by calling this redirect.sh file with your script and the files you want to send output/stderr to.
redirect.sh will probably look something like
#!/bin/sh
$1 > $2 2> $3
Hope this helps,
Ravi. -
RSHTTPPIN - Capture connection test output
Hi Folks,
My requirement is to Capture the connection test output of "HTTP Connections to External Server" in SM59.
From the below screenshot I have to pass the "Detail" and "Value" information to my internal table.
I tried with the SUBMIT RSHTTPPIN EXPORTING LIST TO MEMORY AND RETURN but it is showing error as "Error in Control Framework" ,this error may be occured because of the output is in ALV form.
Please guide me to accomplish my requirement.
Thanks & Regards,
Sukumar M.Why don't you switch on the debugger before pressing connection test and you will get what logic/fm standard is using use that
Maybe you are looking for
-
How do I change the color of font in a fillable form in Adobe Reader? How can I check if the writer of the document has given permission to edit color and not just add text? Please help! I'm technologically challenged.
-
When i try to start itunes i get a, "QuickTime version 7.0d0 is installed, Itunes requires QuickTime version 7.1.3 or later. Please reinstall itunes." I have reinstalled itunes 3 times with quicktime, and i have installed just quicktime, but keep get
-
Is there any difference , selecting particular string from left to right
hi we have a problem for selecting a string ... we selecting a string from JEditorPane .. useing JEditorPane.getselectedText(); After selecting text we adding some tags to selected text it working fine when we are selecting from right to left . when
-
BDC Session processing in SM35
Hi, Please let me if a session in SM35 has lot of data to process, will it be timed out?? Thanks & Regards, Soumya.
-
Using ModernUI in Win 8.1 with SYNC seems to work on hand: Typing in keywords associated to URLs displays the right SYNC´ed URLs. But the bookmarks are not displayed. In desktop mode the SYNC runs properly in all aspects. How can I enable the visibil