473,804 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getRunt ime().exec(cmd) ;
process.waitFor ();
System.out.prin tln("Exit Value=" + process.exitVal ue());
}
catch (Exception x) {
x.printStackTra ce();
}
}
}
Jul 17 '05 #1
2 3187
"Micke" <th*********@ho tmail.com> wrote in message
news:xV******** *************@n ewsc.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.getRunt ime().exec(cmd) ;
process.waitFor ();
System.out.prin tln("Exit Value=" + process.exitVal ue());
}
catch (Exception x) {
x.printStackTra ce();
}
}
}

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*********@ho tmail.com> wrote in message
news:xV******** *************@n ewsc.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.getRunt ime().exec(cmd) ;
process.waitFor ();
System.out.prin tln("Exit Value=" + process.exitVal ue());
}
catch (Exception x) {
x.printStackTra ce();
}
}
}


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
6303
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 JNI_CreateJavaVM function hangs. I'm not even getting around to calling my classes, just trying to start the VM. The jvm.dll is in my path. I've tried linking various MS runtimes, all to the same effect -- the call to JNI_CreateJavaVM hangs...
3
1728
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 drop the old SAMPLE database and create a new one that works fine. That enabled me to resume work on my current project. However, I am having problems with UDFs over and above the ones I mentioned in the earlier thread. I have a UDF that worked...
2
2127
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 my other includes then I get lots of errors like C2011: 'fd_set' : 'struct' type redefinition warning C4005: 'FD_CLR' : macro redefinition which I understand are due to the fact that windows.h is being included in another header file as well as...
2
1867
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. This is the code I came up with but it doesnt work and I dont know
7
2111
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 moving that functionality into a web service. To clarify - on the UI the user is collecting and entering data and then it gets stored into the database. Most fields are input but there are some that are calculated and stored. The calculated...
1
7861
by: jesmi | last post by:
my code is: U]employee.cfm <html> <head> <title>Employee List</title> </head> <body> <h1>Employee List</h1>
0
1647
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 below seems to work just fine under Mac OS X; however, under Windows XP (Java 1.6 and Python 2.5 installed) the program hangs when I give a command to import the Tkinter (Python GUI library) and create a top- level frame window. Specifically,...
0
1073
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: pg74.215.jdbc3.jar i am using jdbc client interface to pgsql database. Although i am able to connect to database server through java progm loading JDBC driver from my console(bash). BUT i am unable to run the same java progm through a html form using php....
5
7082
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: <%@ page import="java.io.*" %> <HTML> <BODY> <% Runtime rt = Runtime.getRuntime(); Process p = rt.exec("/bin/ls");
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9174
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6866
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3834
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.