M
Mithil
Hi everyone,
I am trying to schedule a script which runs a java file and that java
file executes a bluez linux command called hciconfig -i hci0 scan
which scans for bluetooth devices but i get an error in the cron log
file which is :
/home/mithil/t: line 2: clear: command not found
java.io.IOException: Cannot run program "hcitool":
java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:431)
at java.lang.Runtime.exec(Runtime.java:328)
at test.main(test.java:6)
Caused by: java.io.IOException: java.io.IOException: error=2, No such
file or directory
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 4 more
Cron is not able to recognize the bluez command. I had the same
problem with executing java files in cron but I added the path to java
file at the top of the cronfile and it works but couldn't figure out
how to get the bluez command working could some one please help me
out.
the java program is :
public class test {
public static void main(String[] args) {
try {
Process startUP = Runtime.getRuntime().exec("hcitool -i
hci0 scan");
Process scan = Runtime.getRuntime().exec("hcitool -i hci0
scan");
BufferedReader in = new BufferedReader(
new
InputStreamReader(scan.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
The script is:
|!/bin/sh
java test
The cronfile is:
PATH=$PATH:/home/mithil/jdk1.6.0_01/jre/bin
* * * * * /home/mithil/t > /home/mithil/cronlog.txt 2>&l
I am trying to schedule a script which runs a java file and that java
file executes a bluez linux command called hciconfig -i hci0 scan
which scans for bluetooth devices but i get an error in the cron log
file which is :
/home/mithil/t: line 2: clear: command not found
java.io.IOException: Cannot run program "hcitool":
java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:431)
at java.lang.Runtime.exec(Runtime.java:328)
at test.main(test.java:6)
Caused by: java.io.IOException: java.io.IOException: error=2, No such
file or directory
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 4 more
Cron is not able to recognize the bluez command. I had the same
problem with executing java files in cron but I added the path to java
file at the top of the cronfile and it works but couldn't figure out
how to get the bluez command working could some one please help me
out.
the java program is :
public class test {
public static void main(String[] args) {
try {
Process startUP = Runtime.getRuntime().exec("hcitool -i
hci0 scan");
Process scan = Runtime.getRuntime().exec("hcitool -i hci0
scan");
BufferedReader in = new BufferedReader(
new
InputStreamReader(scan.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
The script is:
|!/bin/sh
java test
The cronfile is:
PATH=$PATH:/home/mithil/jdk1.6.0_01/jre/bin
* * * * * /home/mithil/t > /home/mithil/cronlog.txt 2>&l