est-il possible d'appeler un shellscript ou le shellcode dans une classe java?Appelez un script shell dans Java?
Mon code (dans une méthode statique):
Runtime rtime = Runtime.getRuntime();
Process child = rtime.exec("/bin/bash");
BufferedWriter outCommand = new BufferedWriter(new
OutputStreamWriter(child.getOutputStream()));
outCommand.write("streamer -c /dev/video0 -b32 -o test.jpeg");
outCommand.flush();
outCommand.close();
child.destroy();
Mais je reçois cette erreur, si je tente ce code dans ma page jsp (de tomcat6):
java.security.AccessControlException: accès denied (java.io.FilePermission/bin/bash execute)
Une solution à ce problème?
EDIT: ls -l/bin/bash me montre la ligne follwing:
-rwxr-xr-x 1 root root 875596 2009-09-14 07:09/bin/bash
Merci
Utilisez-vous une version packagée de Tomcat? Si oui, il s'agit d'autorisations très restrictives. –
Hmm .. ne sais pas juste téléchargé apt-get install tomcat6 – Benni