Page 1 of 1
0.9.* breaks java command line launching
Posted: 15 Oct 2008 11:47
by mrchumley
I have a java app that launches VLC using the following command line (I've removed all the parameters for clarity):
Code: Select all
Runtime.getRuntime().exec("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe")
In versions pre 0.9.2 this worked fine. With versions 0.9.2 and 0.9.4 the launching has stopped working correctly. What happens is that VLC process is created (and appears in task manager) but the UI is not shown until the calling application is closed. I am using Java JRE 1.6.0_07 on Windows XP SP3 but have tried Vista with the same results.
Tried a few things but seems to be a problem with VLC only.
In the descriptions below "working" means displaying instantly rather than waiting until the app closes.
- - launching using the same command from a DOS prompt DOES work
- launching VLC.exe DOESNT work but launching iexplore.exe using the same technique DOES work
- a simple main() with the simple launch command (ie no parameters) under Vista DOESNT work.
Anyone any clues as to what's different and how to fix it?
Re: 0.9.* breaks java command line launching
Posted: 15 Oct 2008 17:02
by Jean-Baptiste Kempf
Yes, please give us the messages in -vvv.
You probably need to specify the plugin-path.
Re: 0.9.* breaks java command line launching
Posted: 16 Oct 2008 14:27
by mrchumley
Below is the output listing after launching VLC.exe from within a standalone Java application using the command
"C:/Program Files/VideoLAN/VLC/vlc.exe" -vvv --extraintf=logger
In summary:
We launch our Java app (either via Eclipse IDE or JNLP) and click a button to exec() the VLC command. The vlc process is created and appears in the TaskManager but the UI doesnt appear until we close our application.
The listing below is identical (except for thread IDs and other numbers) to the output from the same command issued in a command prompt which does show the UI, so I'm not sure this will give you any clues.
This same behaviour is shown on three separate PCs, two WinXPs in the work environment and one home PC running Vista.
Code: Select all
-- logger module started --
main debug: CPU has capabilities 486 586 MMX MMXEXT SSE SSE2 FPU
main debug: looking for memcpy module: 3 candidates
main debug: using memcpy module "memcpymmxext"
main debug: thread 5656 (Interaction control) created at priority 0 (interface/interaction.c:382)
main debug: thread started
main debug: Creating an input for 'Media Library'
main debug: Input is a meta file: disabling unneeded options
main debug: `file/xspf-open://C:\Documents and Settings\cimellim\Application Data\vlc\ml.xspf' gives access `file' demux `xspf-open' path `C:\Documents and Settings\cimellim\Application Data\vlc\ml.xspf'
main debug: creating access 'file' path='C:\Documents and Settings\cimellim\Application Data\vlc\ml.xspf'
main debug: looking for access module: 2 candidates
access_file debug: opening file `C:\Documents and Settings\cimellim\Application Data\vlc\ml.xspf'
main debug: using access module "access_file"
main debug: TIMER module_Need() : 2.000 ms - Total 2.000 ms / 1 intvls (Avg 2.000 ms)
main debug: Using AStream*Stream
main debug: pre-buffering...
main debug: received first data for our buffer
main debug: creating demux: access='file' demux='xspf-open' path='C:\Documents and Settings\cimellim\Application Data\vlc\ml.xspf'
main debug: looking for demux module: 1 candidate
playlist debug: using XSPF playlist reader
main debug: using demux module "playlist"
main debug: TIMER module_Need() : 0.000 ms - Total 0.000 ms / 1 intvls (Avg 0.000 ms)
main debug: `file/xspf-open://C:\Documents and Settings\cimellim\Application Data\vlc\ml.xspf' successfully opened
main debug: looking for xml module: 1 candidate
main debug: using xml module "xtag"
main debug: TIMER module_Need() : 1.000 ms - Total 1.000 ms / 1 intvls (Avg 1.000 ms)
playlist warning: invalid <playlist> attribute:"xmlns:vlc"
playlist debug: parsed 0 tracks successfully
main debug: removing module "xtag"
main debug: EOF reached
main debug: control type=1
main debug: removing module "playlist"
main debug: removing module "access_file"
main debug: TIMER input launching for 'Media Library' : 5.000 ms - Total 5.000 ms / 1 intvls (Avg 5.000 ms)
main debug: waiting for thread initialization
main debug: thread started
main debug: thread 5580 (preparser) created at priority 0 (playlist/thread.c:79)
main debug: waiting for thread initialization
main debug: thread started
main debug: thread 5568 (fetcher) created at priority 0 (playlist/thread.c:108)
main debug: waiting for thread initialization
main debug: thread started
main debug: rebuilding array of current - root Playlist
main debug: rebuild done - 0 items, index -1
main debug: thread 5572 (playlist) created at priority 0 (playlist/thread.c:117)
main debug: looking for interface module: 1 candidate
logger: VLC media player - version 0.9.4 Grishenko - (c) 1996-2008 the VideoLAN team
logger:
Warning: if you can't access the GUI anymore, open a command-line window, go to the directory where you installed VLC and run "vlc -I qt"
logger: using logger...
logger warning: no log filename provided, using `vlc-log.txt'
logger debug: opening logfile `vlc-log.txt'
main debug: using interface module "logger"
main debug: TIMER module_Need() : 7.000 ms - Total 7.000 ms / 1 intvls (Avg 7.000 ms)
main debug: thread 5012 (interface) created at priority 0 (interface/interface.c:168)
main debug: looking for interface module: 1 candidate
main debug: thread started
main debug: using interface module "hotkeys"
main debug: TIMER module_Need() : 4.000 ms - Total 4.000 ms / 1 intvls (Avg 4.000 ms)
main debug: thread 5536 (interface) created at priority 0 (interface/interface.c:168)
main debug: thread started
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
main debug: looking for interface module: 3 candidates
main debug: using interface module "qt4"
main debug: TIMER module_Need() : 22.000 ms - Total 22.000 ms / 1 intvls (Avg 22.000 ms)
main debug: thread 5404 (interface) created at priority 0 (interface/interface.c:168)
main debug: thread started
qt4 debug: Error while initializing qt-specific localization
main debug: removing all interfaces
qt4 debug: Quitting the Qt4 Interface
qt4 debug: Destroying the main interface
qt4 debug: Destroying the Dialog Provider
main debug: thread ended
main debug: thread times: real 0m3.040089s, kernel 0m0.093750s, user 0m0.031250s
main debug: thread 5404 joined (interface/interface.c:188)
main debug: removing module "qt4"
main debug: thread ended
main debug: thread times: real 0m3.071269s, kernel 0m0.000000s, user 0m0.000000s
main debug: thread 5536 joined (interface/interface.c:188)
main debug: removing module "hotkeys"
main debug: thread ended
main debug: thread times: real 0m3.102449s, kernel 0m0.000000s, user 0m0.000000s
main debug: thread 5012 joined (interface/interface.c:188)
-- logger module stopped --
I'd be interested if anyone else is seeing this? Here is a sample app that produces the effect. The app doesn't appear until the dialog is cleared and the program quits.
Code: Select all
public static void main(String[] args)
{
try
{
Runtime.getRuntime().exec("C:/Program Files/VideoLAN/VLC/vlc.exe");
JOptionPane.showConfirmDialog(null, "Quit Program", "Test", JOptionPane.OK_OPTION);
}
catch (IOException e){e.printStackTrace();}
}
Re: 0.9.* breaks java command line launching
Posted: 24 Oct 2008 13:33
by mrchumley
Can anybody confirm that they have had the command line working from a java app as listed below and that its not just me?
Re: 0.9.* breaks java command line launching
Posted: 28 Oct 2008 01:22
by anon23
First post!
I'd just like to say, I'm having the exact same problem as mrchumley, and I'd be very interested in a solution.
Thanks
Re: 0.9.* breaks java command line launching
Posted: 12 Nov 2008 13:40
by chrisaaaaa
Another sufferer, for me it carries on up thru 0.9.6 and Java 1.6.0_10.
Would use JVLC, but I need streaming and the ability to leave VLC running after the app quits, ironic that it only works after the app quits now
Chris
Re: 0.9.* breaks java command line launching
Posted: 13 Nov 2008 15:14
by VLC_help
Does it help if you run it as
Re: 0.9.* breaks java command line launching
Posted: 14 Nov 2008 00:02
by chrisaaaaa
I got a sort of workaround going with something like that, a throwback to the days of DOS, something like
"cmd /c /k start "vlc" "c:\prog.....exe".
I got it to start, and can track when it is closed, but I lost the ability to close VLC from java.
Chris
Re: 0.9.* breaks java command line launching
Posted: 14 Nov 2008 00:21
by Arite
If you want VLC to exit on finishing use e.g.:
In the commandline (not quite the same as closing from Java though).
Arite.
Re: 0.9.* breaks java command line launching
Posted: 14 Nov 2008 00:47
by chrisaaaaa
I tried grabbing std input and sending that to it via java but it did not work.
If it does not get fixed in VLC soon I supposed I will have to get VLC to open a http socket for remote control and close it that way, but it is all getting a bit messy.
Chris
Re: 0.9.* breaks java command line launching
Posted: 07 Mar 2009 19:44
by 0001001
I have the same problem. Has anyone found a solution yet?
Re: 0.9.* breaks java command line launching
Posted: 07 Mar 2009 23:37
by 0001001
Ok I got the solution!
The problem is that the new VLC 0.9.x produces "Output" that needs to be processed. (Do not know how to explain it).
So to get the VLC working you have to process the InputStream of the process you created.
StreamGobbler class is from here:
http://www.javaworld.com/javaworld/jw-1 ... tml?page=4
Example:
Code: Select all
Process vlcprocess = Runtime.getRuntime().exec(vlc);
StreamGobbler errorGobbler = new StreamGobbler(vlcprocess.getErrorStream(), "ERROR");
StreamGobbler outputGobbler = new StreamGobbler(vlcprocess.getInputStream(), "OUTPUT");
errorGobbler.start();
outputGobbler.start();
class StreamGobbler extends Thread{
InputStream is;
String type;
StreamGobbler(InputStream is, String type){
this.is = is;
this.type = type;
}
public void run(){
try{
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null){
//System.out.println(type + ">" + line);
}
} catch (IOException ioe){
ioe.printStackTrace();
}
}
}
But my advice for the VLC team is to have no output (I don't know if this is called command line output) when starting vlc. I don't know if vlc 0.8.x had this output when starting but this version worked without processing the streams.