473,378 Members | 1,218 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Problems with executing program from java

I have problems with this simple program below.
It starts to read and dump wav data to file but stops after 2MB.
The cdda2wav processes are still alive but nothing more is happening.
I have more advanced examples with threads and reading from the process
buffers but the result is the same.
Java version is 1.5 and OS is Linux slackware 10.0.

public class TestRead {
public static void main (String[] args) {
try {
String[] cmd = {"/usr/bin/cdda2wav", "-D", "/dev/cdrom",
"-S", "1", "-t", "1"};
Process process = Runtime.getRuntime().exec(cmd);
process.waitFor();
System.out.println("Exit Value=" + process.exitValue());
}
catch (Exception x) {
x.printStackTrace();
}
}
}
Jul 17 '05 #1
2 3152
"Micke" <th*********@hotmail.com> wrote in message
news:xV*********************@newsc.telia.net...
I have problems with this simple program below.
It starts to read and dump wav data to file but stops after 2MB.
The cdda2wav processes are still alive but nothing more is happening.
I have more advanced examples with threads and reading from the process
buffers but the result is the same.
Java version is 1.5 and OS is Linux slackware 10.0.

public class TestRead {
public static void main (String[] args) {
try {
String[] cmd = {"/usr/bin/cdda2wav", "-D", "/dev/cdrom", "-S",
"1", "-t", "1"};
Process process = Runtime.getRuntime().exec(cmd);
process.waitFor();
System.out.println("Exit Value=" + process.exitValue());
}
catch (Exception x) {
x.printStackTrace();
}
}
}

Try calling getInputStream and getErrorStream on your Process and reading
their contents. As specified in the Process documentation, these streams can
have limited buffer sizes, and when those buffers fill, the process may
block or deadlock.
Jul 17 '05 #2
Ryan Stewart wrote:
"Micke" <th*********@hotmail.com> wrote in message
news:xV*********************@newsc.telia.net...
I have problems with this simple program below.
It starts to read and dump wav data to file but stops after 2MB.
The cdda2wav processes are still alive but nothing more is happening.
I have more advanced examples with threads and reading from the process
buffers but the result is the same.
Java version is 1.5 and OS is Linux slackware 10.0.

public class TestRead {
public static void main (String[] args) {
try {
String[] cmd = {"/usr/bin/cdda2wav", "-D", "/dev/cdrom", "-S",
"1", "-t", "1"};
Process process = Runtime.getRuntime().exec(cmd);
process.waitFor();
System.out.println("Exit Value=" + process.exitValue());
}
catch (Exception x) {
x.printStackTrace();
}
}
}


Try calling getInputStream and getErrorStream on your Process and reading
their contents. As specified in the Process documentation, these streams can
have limited buffer sizes, and when those buffers fill, the process may
block or deadlock.


I've got it working now.
Before posting the message here I did what you said, kind of...
But it didn't work. Your answer made me think a little bit more.
I think the reason why it failed was that the inpuStream and errorStream blocked each other.
So I put them in two threads and that did it!

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dr. Dave Landis | last post by:
Greetings: I have a group of Java classes that I need to invoke from a Win32 DLL. The following code, when executed from a stand-alone EXE works just fine. When I insert it into my DLL, the...
3
by: Henry Reardon | last post by:
I installed DB2 for Linux, Unix, and Windows on V8.2 (i.e. 8.1.7) on Windows XP on Friday. I had some problems with migration which are still outstanding - see my earlier thread - but I managed to...
2
by: Erik | last post by:
Hi Everyone, I'm having real problems compiling some source for eVC4++. The errors I am getting are below: It all seems to be centred around winsock. If I move the afsock.h reference to before...
2
by: Mahesh S | last post by:
Hi I have created a UDF which sits in db2 database. I want to call that UDF from within a java program and capture the result. The UDF takes a string parameter and returns a double value. ...
7
by: google | last post by:
I would like to execute a single JavaScript command from within a web service. The command is a mathmatical statement. I have a web page with some client side logic that does this and I'm now...
1
by: jesmi | last post by:
my code is: U]employee.cfm <html> <head> <title>Employee List</title> </head> <body> <h1>Employee List</h1>
0
by: nadeemabdulhamid | last post by:
Hello, I'm trying to write some Java code that will launch a python interpreter shell and pipe input/output back and forth from the interpreter's i/o streams and the Java program. The code posted...
0
by: mamoon | last post by:
hi all, i am facing a serious problem in running JDBC programm in Apache server environment. Background Information- 1, OS: Enterprise Linux4 running Apache2 2. pgsql8.2 3.JDBC driver:...
5
by: sayeo87 | last post by:
Hi, I am quite new to JSP so please forgive me if I ask really simple things... I am trying to run system commands on the server and display the output on a webpage. This is what I've got: <%@...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.