I have a third-party application (VLC video decoder from http://www.videolan.org) that I start using Java, specifically using the following Java code:
I hold onto the process object so that I can close VLC later on.
When I start VLC using my Java application as shown above, the VLC application consumes 50% of the CPU before even doing anything; it's not even decoding video yet! (note: VLC the application is consuming 50% of the CPU, not my Java application; this per the Windows task manager). If I start VLC just by itself it doesn't consume anything more than 1% of the CPU.
Any reason why this would be so? It's causing a real problem when I actually start decoding video because VLC then consumes nearly 100% of the CPU.
Java 1.5+ on Windows XP [ June 25, 2008: Message edited by: David Irwin ]
Doing a little more research I came across the ProcessBuilder class in the Java 1.5 API. When I start VLC using the process builder the CPU usage is near 1% when idle. I'm hoping that this will help solve my problem.
After looking at the Java 1.5 source it turns out that the Runtime.exec() method actually uses the ProcessBuilder class. And I have been unable to get my application to start successfully using the ProcessBuilder class alone. Since Runtime.exec() actually uses ProcessBuilder internally I don't expect any fix if I were to get the standalone ProcessBuilder approach to work.
You are familiar with the traps in Runtime.exed(), as described in the classic article by Daconta? Please do a search of JavaRanch; there are other threads active at present addressing similar questions. [ June 27, 2008: Message edited by: Campbell Ritchie ]
Originally posted by Campbell Ritchie: You are familiar with the traps in Runtime.exed(), as described in the classic article by Daconta? Please do a search of JavaRanch; there are other threads active at present addressing similar questions.
[ June 27, 2008: Message edited by: Campbell Ritchie ]
Thanks for the reference...I hadn't read the article but for my sake I unfortunately was already doing much of what was suggested in the article.
Does anyone know of an alternative to using Runtime.exec(), such as some third-party library?
I will suppress my every urge. But not this shameless plug:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop