I am trying to compile a java source file via a Ruby Script. However I am a bit puzzled by the following behavior
compile_results = `javac #{source_file}`
this fails to run with a 'No such file...' error. I popped up irb
irb(main):001:0> `javac -help`
Errno::ENOENT: No such file or directory - javac -help
from (irb):1:in ``'
from (irb):1
irb(main):002:0> `csc`
=> "Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.3053\nfor Microsoft
(R) Windows (R) 2005 Framework version 2.0.50727\nCopyright (C) Microsoft Corpo
ration 2001-2005. All rights reserved.\n\nfatal error CS2008: No inputs specifie
d\n"
However both javac and csc are on the PATH. e.g. if i run javac manually from the shell that I run the ruby script from, I am able to get to the java compiler. The source file exists.
I tried both ruby 1.8.7 and 1.9.1 (Windows). Does anyone see something that I am missing ?
Update:
I dont think it has to do with command line args. Rather it can't get to javac for some weird reason. I put the line javac %1
in a batch file and call the batch file in the usual way. This worked... but still am not sure of what the whole issue was with javac.