Java - Disk Reader (Linux)

2

Good evening,

I was looking at how we can open the disk reader in Windows using Java there are several ways to even use vbs.

I wanted to know if I need to use any library on Linux or if I can do it directly by some command.

Could someone guide me? Thanks!

    
asked by anonymous 13.10.2015 / 01:40

1 answer

2

To open the drive:

try {
  Runtime.getRuntime().exec("eject cdrom");
} catch (Exception e) {
  System.out.print(e);
}

To close the drive:

try {
  Runtime.getRuntime().exec("eject -t cdrom");
} catch (Exception e) {
  System.out.print(e);
}
    
13.10.2015 / 02:08