Does anyone know how to open the CD-ROM tray using Java? Is it possible to do
so, or must some sort of C code be used?
Thanks,
B. Meyer
Gran...@hotmail.com
_______________________________________________
Submitted via WebNewsReader of http://www.interbulletin.com
On Mon, 26 Mar 2001 06:14:38 +0000, B Meyer wrote:
>Hello everyone,
>
>Does anyone know how to open the CD-ROM tray using Java?
Yes.
>Is it possible to do
>so, or must some sort of C code be used?
Yes.
You can try to interface a command-line program that does this. The relevant
method is called System.exec or similar. On Linux, you can interface the
"eject" command line tool.
If no command-line tools exist for you platform that does this, you will need
to interface a system library that provides the function. JNI (Java Native
Interface) is the keyword here.
Gerhard
mail: gerhard <at> bigfoot <dot> de
web: http://highqualdev.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: Weitere Infos: siehe http://www.gnupg.org
iD8DBQE6v2xaeyJldYarQ8ARAmubAJ466nGIGgOXFq3M6hRdsv5u2PHuOACfUbJg
fLJJdMc2/9tiYQztif9KDas=
=Es8x
-----END PGP SIGNATURE-----
There is no Java API to eject the CD tray. There is no C API to do that
either, come to think of it.
As you suggest, you will need to call an ioctl in the device driver using JNI.
Or, if your OS has a "cdeject" command, you could call that instead. That
is the approach I would use.
--
The Java FAQ is at
http://www.afu.com
Might be worth bookmarking it, or looking thru it for other info.