How to get the console output generated by a executable program?
when I am trying to use method getOutputSteam of Process to gain the outputStream,I got nothing!
I have also tried to use stream redirect,also no result!
please help me! Thank you in advance!
my main code are below:
Process ps=Runtime.getRuntime().exec("xxx.exe");/*xxx.exe is a executable program which will generate a console with the message I want to gain.*/
int exitVal= ps.waitFor();
if(exitVal==0){
BufferredReader br = new BufferedReader(new InputStreamReader(ps.getInputStream())); String st;
while((st = br.readLine()) !=null){
System.out.println("write:"+st);
}//my result show that I got nothing from the progam.
}
I've seen this kind of problem with an offending xxx.exe. Generally it means that the program isn't flushing its output immediately, so your java program never sees it.
Similar Messages
-
How can I get the console Output generated by a exe file
when I am trying to use method getOutputSteam of Process to gain the outputStream,I got nothing!
I have also tried to use stream redirect,also no result!
please help me! Thank you in advance!
my main code are below:
Process ps=Runtime.getRuntime().exec("xxx.exe");/*xxx.exe is a executable program which will generate a console with the message I want to gain.*/
int exitVal= ps.waitFor();
if(exitVal==0){
BufferredReader br = new BufferedReader(new InputStreamReader(ps.getInputStream())); String st;
while((st = br.readLine()) !=null){
System.out.println("write:"+st);
}//my result show that I got nothing from the progam.ok, this works (I tried) :
import java.lang.*;
import java.io.*;
public class ps {
public ps() {
public static void main(String[] args)
try
Runtime rt=Runtime.getRuntime();
Process ps = rt.exec("ps");
BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
String st;
while((st = br.readLine()) !=null){
System.out.println("write:" + st);
} catch (Exception e)
e.printStackTrace();
}But it's not the same that a simple ps :
[host@localhost java]$ ps
PID TTY TIME CMD
4065 pts/1 00:00:00 bash
4319 pts/1 00:00:00 ps
[host@localhost java]$java ps
write: PID TTY TIME CMD
write: 4065 pts/1 00:00:00 bash
write: 4320 pts/1 00:00:00 java
write: 4321 pts/1 00:00:00 java
write: 4322 pts/1 00:00:00 java
write: 4323 pts/1 00:00:00 java
write: 4324 pts/1 00:00:00 java
write: 4325 pts/1 00:00:00 java
write: 4326 pts/1 00:00:00 java
write: 4327 pts/1 00:00:00 java
write: 4328 pts/1 00:00:00 java
write: 4329 pts/1 00:00:00 java
write: 4330 pts/1 00:00:00 java
write: 4331 pts/1 00:00:00 ps
write: 4332 pts/1 00:00:00 java
write: 4333 pts/1 00:00:00 java
[paul@localhost java]$
And I don't know why... -
How to get the Query output to Excel
Hi ,
Can you tell me how to get the Query output to excel with out using any third party tool?
Can you tell me how to write the code in Webservice and call it..
Please explain it Elaboartly..
Thanks in Advance!!!
Miniwhats your source system?
you can use Live office, or query as a webservice if you are getting data from universe
if you're getting data from SAP BI query and you have a java stack on your netweaver then you can get the data directly using sap bi connector in xcelsius.
good luck -
How can get the console window name of the current form?
How can get the console window name of the current form?
Try the various get methods of the viewObject such as getQuery:
http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/navId.4/navSetId._/vtAnchor.getQuery%28%29/vtTopicFile.bc4jjavadoc%7Crt%7Coracle%7Cjbo%7CViewObject%7Ehtml/ -
How to get the desired output in the format ...?
Hi all,
I am having data like this.
Col1 col2 col3
1 2 1
1 2 2
1 2 3
2 3 7
2 3 8
2 3 9
I want to output the data like this
1 2 1,2,3
2 3 7,8,9
How to get this.
Thanks in advance,
PalIn simple sql...
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from t
2 /
COL1 COL2 COL3
1 2 1
1 2 2
1 2 3
2 3 7
2 3 8
2 3 9
6 rows selected.
SQL> select max(decode(rno,1,to_number(col1||col2||col3))) col1, max(decode(rno,2,col3)) col2, max(decode(rno,3,col3)) col3
2 from (select row_number() over(partition by col1,col2 order by col3) rno, t.*
3 from t)
4 group by col1
5 /
COL1 COL2 COL3
121 2 3
237 8 9
SQL>Thanks,
Karthick. -
How to get the message ID generated by the PI system during message mapping
Hi All,
I have a file to file scenario, where during the mapping, I want to map and send the Message ID generated by PI.
Can anyone please help me with this?
Kind regards,
JoeHi,
You have write UDF for this.
Please see the below code .
java.util.Map map = container.getTransformationParameters();
String MesID = (String)map.get(StreamTransformationConstants.MESSAGE_ID);
return MesID;
Hope this helps to you.
Regards,
P.Rajesh -
How to get the given output format..
Hi,I want to write a code in ABAP in such a way that I should get the output in the right side format.
Ex:
1200 - > 1,200
12000 - > 12,000
120000 -> 120,000
1200000 -> 1,200,000
12000000 -> 12,000,000
120000000 - > 120,000,000
Thanks.HI tushar,
1. I don't know whether i understood u r question !
2. FOr writing with COMMA,
if we use simple WRITE,
then it will show just as u want !
regards,
amit m. -
How to get the erroe message, if i run java program using .bat file
Hi,
I have a java file which accepts two inputs as command line argument. I want to make this pgm a tool. So have created a *.bat file which has the following command
java myprogram arg1 arg2
I'm gonna share this program with others. So i'll keep the class file and the .bat file in a commaon folder. All the users have to do is, edit the .bat file to give his/her args and run the .bat file. The pbm is, if the user input is not valid, I have put displays in the pgm to show it.
But if i run thru .bat, I'm not getting the error message or I don't know where it is getting displayed.
Can anyone help me with this ?
Thanks,
MaryWhen i run from the console, I can see the output.
But, when i double click on the .bat file from the
folder, it runs fine and i couldn't see the output.
nullThat's because the error message is printed, and then the console is closed. The message is there but you need to read really really fast :) -
How to get the job output to be displayed/send in a report?
Dear All,
IHAC that have a couple of jobs which they all work fine and return the desired value, and now the customer wants to take the output of the jobs and place it in one big report?
The jobs created are the daily health checks that the DBAs run. They would like to have all the output from all the jobs consolidated in one report to be sent to them every morning on their emails.
Kindly advise if this is doable.There isn't really a way to redirect a job's output. Unless you try to dig it out of the repository. Trust me it will be a hell of a job to puzzle out the locations and SQL statements to get it.
You might consider trying to migrate your jobs into reports (if possible). Reports can be redirected to e-mail recipients.
Regards
Rob -
How to get the desire output from sql query
Consider an Order Table: ...
Order Table:
Order Id Item Qty
O1 A1 5
O2 A2 1
O3 A3 3
Please provide SQL which will explode the above data into single unit level records as shown below
Desired Output:
Order Id Order Id Qty
O1 A1 1
O1 A1 1
O1 A1 1
O1 A1 1
O1 A1 1
O2 A2 1
O3 A3 1
O3 A3 1
O3 A3 1How do I ask a question on the forums?
SQL and PL/SQL FAQ -
How to get the following output
Table 1 Table 2
EmpCode EmpName EmpCode EmpPhone
10001 ABC 10001 12345
10002 BCD 10001 23456
10003 CDE 10001 34567
10004 EFG 10006 45678
10005 FGH 10007 56789
10006 GHI 10007 67890
10007 HIJ 10010 78901
10008 IJK 10010 89012
10009 JKL 10010 90123
10010 KLM 10011 13579
10011 LMN 10012 35791
10012 MNO 10012 57913
10013 NOP 10012 79135
10014 OPQ 10017 91357
10015 PQR 10017 12390
10016 QRS 10019 23479
10017 RST
10018 STU
10019 TUV
output
EmpCode EmpName EmpPhone
10001 ABC 12345/23456/34567
10002 BCD
10003 CDE
10004 EFG
10005 FGH
10006 GHI 45678
10007 HIJ 56789/67890
10008 IJK
10009 JKL
10010 KLM 78901/89012/90123
10011 LMN 13579
10012 MNO 35791/57913/79135
10013 NOP
10014 OPQ
10015 PQR
10016 QRS
10017 RST 91357/12390
10018 STU
10019 TUV 23479
Srimanta,
Check this:
select t1.EmpCode,t1.EmpName,STUFF((select '/'+EmpPhone from Table2 where EmpCode=t1.EmpCode for xml path('')),1,1,'') as PhoneNum
from Table1 t1
left join Table2 t2 on t1.EmpCode=t2.EmpCode
group by t1.EmpCode,t1.EmpName
Edited : small change in code(highlighted - t1 instead of t2)
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'> -
How to get the primary key generated by an Insert?
My classpath is correct. So does anybody knows
Why the following lines of code do not work?
I get this message error.
The line incorrect is line "6".
Exception in thread "main" java.lang.AbstractMethodError:
com.microsoft.jdbc.sqlserver.SQLSe
rverConnection.prepareStatement(Ljava/lang/String;I)
Ljava/sql/PreparedStatement;
1. String strSql;
2. PreparedStatement stmt;
3.
4. strSql = "insert into MYTABLE (MYFIELD) values ('SOMESTRINGVALUE')";
5.
6. stmt = myConnection.prepareStatement
7. (strSql,Statement.RETURN_GENERATED_KEYS);
8.
9. stmt.executeUpdate();
10. stmt.close();
I try to use the method
"ResultSet getGeneratedKeys()"
from the class Statement but without effect since the program can�t proceed from line '6'.Hi,
1. String strSql;
2. PreparedStatement stmt;3.
4. strSql = "insert into MYTABLE (MYFIELD) values ('SOMESTRINGVALUE')";5.
6. stmt = myConnection.prepareStatement
7. (strSql,Statement.RETURN_GENERATED_KEYS);8.
9. stmt.executeUpdate();
10. stmt.close();Can your go and look Ur code @4,
4. strSql = "insert into MYTABLE (MYFIELD) values (?)";and then before @9,
stmt.setString(1,SOMESTRINGVALUE);
Raju -
How to get the query output depending on the current date
i created a region of type "query",inside it created region using wizard of type "table" . in the query i filter the data depending on the current date (taken from dual table) . but still it showing no output on the page. i run the same query in the toad and its showing the 2-3 rows.
If anybody know where the problem is then do inform me.
thanks in advance.i got the answer by trying out in OAF
-
My Table Data
ContractID MaterialGroup CommodityCode Amount
C123 Travel 200 100
C123 Travel 201 100
C123 Travel 203 100
C124 Stationery 315 500
C126 Travel 200 600
C126 Admin 413 600
My expected output
ContractID MaterialGroup CommodityCode Amount
C123 Travel 200|201|203 100
C124 Stationery 315 500
C126 Travel|Admin 200|413 600
My Present Output
CONTRACTID MATERIALGROUP COMMODITYCODE AMOUNT
C123 Travel|Travel|Travel 200|203|201 100
C124 Stationery 315 500
C126 Travel|Admin 200|413 600
My Query:
SELECT ContractID,
RTrim(
xmlagg(
xmlelement(e, MaterialGroup|| '|')).extract('//text()'),'|') MaterialGroup,
RTrim(
xmlagg(
xmlelement(e, CommodityCode|| '|')).extract('//text()'),'|') CommodityCode,Amount
FROM (
WITH t1 AS (
SELECT 'C123' ContractID, 'Travel'MaterialGroup, 200 CommodityCode, 100 Amount FROM dual UNION all
SELECT 'C123', 'Travel', 201, 100 FROM dual UNION all
SELECT 'C123', 'Travel', 203, 100 FROM dual UNION all
SELECT 'C124','Stationery', 315, 500 FROM dual UNION all
SELECT 'C126','Travel', 200, 600 FROM dual UNION all
SELECT 'C126','Admin',413, 600 FROM dual)
SELECT * FROM t1)
GROUP BY ContractID,Amount;select t.*,
case when cdm = 1 and cm > 1
then substr(materialgroup,1, instr(materialgroup,'|', cdm)-1)
else materialgroup end materialgroup_edit,
case when cdm = 1 and cm > 1 then mm else materialgroup end materialgroup_edit2
from
select contractid,
count(materialgroup) cm,
count(distinct materialgroup) cdm,
max(materialgroup) mm,
rtrim(
xmlagg(
xmlelement(e, materialgroup|| '|')).extract('//text()'),'|') materialgroup,
rtrim(
xmlagg(
xmlelement(e, commoditycode|| '|')).extract('//text()'),'|') commoditycode,amount
from (
with t1 as (
select 'C123' contractid, 'Travel' materialgroup, 200 commoditycode, 100 amount from dual union all
select 'C123', 'Travel', 201, 100 from dual union all
select 'C123', 'Travel', 203, 100 from dual union all
select 'C124','Stationery', 315, 500 from dual union all
select 'C126','Travel', 200, 600 from dual union all
select 'C126','Admin',413, 600 from dual )
select * from t1)
group by contractid,amount
) t;
CONTRACTID CM CDM MM MATERIALGROUP COMMODITYCODE AMOUNT MATERIALGROUP_EDIT MATERIALGROUP_EDIT2
C123 3 1 Travel Travel|Travel|Travel 200|203|201 100 Travel Travel
C124 1 1 Stationery Stationery 315 500 Stationery Stationery
C126 2 2 Travel Travel|Admin 200|413 600 Travel|Admin Travel|Admin
3 rows selected.
select contractid,
case when count(distinct materialgroup) = 1 and count(materialgroup) > 1 then max(materialgroup)
else
rtrim(
xmlagg(
xmlelement(e, materialgroup|| '|')).extract('//text()'),'|') end materialgroup,
rtrim(
xmlagg(
xmlelement(e, commoditycode|| '|')).extract('//text()'),'|') commoditycode,amount
from (
with t1 as (
select 'C123' contractid, 'Travel' materialgroup, 200 commoditycode, 100 amount from dual union all
select 'C123', 'Travel', 201, 100 from dual union all
select 'C123', 'Travel', 203, 100 from dual union all
select 'C124','Stationery', 315, 500 from dual union all
select 'C126','Travel', 200, 600 from dual union all
select 'C126','Admin',413, 600 from dual )
select * from t1)
group by contractid,amount;
CONTRACTID MATERIALGROUP COMMODITYCODE AMOUNT
C123 Travel 200|203|201 100
C124 Stationery 315 500
C126 Travel|Admin 200|413 600
3 rows selected.
with t1 as (
select 'C123' contractid, 'Travel' materialgroup, 200 commoditycode, 100 amount from dual union all
select 'C123', 'Travel', 201, 100 from dual union all
select 'C123', 'Travel', 203, 100 from dual union all
select 'C124','Stationery', 315, 500 from dual union all
select 'C126','Travel', 200, 600 from dual union all
select 'C126','Admin',413, 600 from dual ),
t2 as
select contractid, materialgroup
from t1
group by contractid, materialgroup
select t1.contractid,
t2.materialgroup,
rtrim(
xmlagg(
xmlelement(e, commoditycode|| '|')).extract('//text()'),'|') commoditycode,amount
from t1,
select contractid,
rtrim(
xmlagg(
xmlelement(e, materialgroup|| '|')).extract('//text()'),'|') materialgroup
from t2
group by contractid
) t2
where t1.contractid = t2.contractid
group by t1.contractid, t2.materialgroup, t1.amount;
CONTRACTID MATERIALGROUP COMMODITYCODE AMOUNT
C123 Travel 200|203|201 100
C124 Stationery 315 500
C126 Admin|Travel 200|413 600
3 rows selected. -
How to get an eText output after registering its concurrent program
I have registered a concurrent program based on eText template in Oracle Apps. 11.5.10. After that, I had registered its template in XML Publisher keeping its type as eText-Outbound. Now when I run the request, my concurrent program runs fine without publishing any output i.e. the template doesnt get attached to the program. So when I manually attach the template to the report explicitly and run it now, it faces a error which is in Java script. Please suggest the needful.
Hi Gurus,
Can anyone please tell Concurrent program and data definition registration process for Output type as E text.
Best Regards,
Mahesh
Maybe you are looking for
-
Pls help : How To select fields and data from user_table for each tablename
Please help with the query to generate a output which selects the code,meaning,inuse for each table in the user_table that has "CODED" as a part of table name. User table has some 800 table that contains CODED in the tablename. Desc of the table: DES
-
Label on external volume suddenly in chinese
Just turned on the laptop after a few days away, and two of the volume labels appear in Chinese characters. I have an external WD USB drive with four volumes on it, I think one was for iTunes files, one was for Time Machine backup, etc. I see the ext
-
Problem registering jdbc driver in jar
My java oracle program runs fine as a class. (java myclass) But when I run the program as an executable jar (java -jar myclass.jar), a statement like Class.forName("oracle.jdbc.driver. OracleDriver"); throws the ClassDefNotFound exception, in other w
-
Hi Experts, How do i trigger a web service from a WebDynpro ABAP component. Any idea regarding it is invited. I intend to use a Web service belonging to a different server, in my system so that i can invoke trhe functions and rettrieve or update the
-
Hello, I have a 2012 Macbook Pro. My issue is that my camera is always on. Even when I am not running any apps that use the camera. But when I do try and use facetime, or photobooth it says there is no camera connected. Does anyone know how to fix th