I am trying to run a Ruby script from Java by doing the following:
public static void main(String[] args) {
try {
Process process = Runtime.getRuntime().exec("ruby /path/to/file/file.rb");
process.waitFor();
System.out.println(process.exitValue());
}
catch (Exception e) {
e.printStackTrace();
}
}
When I this is run, I get 1
as the exit value. In my Ruby script, I am using Watir and Nokogiri thus a browser should be used. Nothing happens.
If I copy ruby /path/to/file/file.rb
into my terminal, it runs correctly. Any reason why this isn't working correctly?