Closed tarmolehtpuu closed 14 years ago
You'll also see similar errors if running the Closure compiler with Java < 6 - something else to watch out for
Let's add a big, loud error if Java's not there, or if you're using Closure and it's less than 6. Do either of you have recommended ways to check the version of Java from Ruby?
The quick thought I have is to capture the output of java -version and parse it:
java version "1.6.0_17" Java(TM) SE Runtime Environment (build 1.6.0_17-b04) Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)
A simple cross platform way to check it would be something like this:
unless system('java -version')
throw "java not found in PATH"
end
I've just pushed a commit that raises a "JavaNotFound" exception if Java doesn't exist, or if the version is too low for your JavaScript compressor of choice. If either or both of you could give it a try, and confirm that it correctly throws the error in your environment, that would be great. To install the gem from a checked-out Jammit repo, just "rake gem:install".
natte:noahworld tarmo$ jammit
/Library/Ruby/Gems/1.8/gems/jammit-0.2.5/lib/jammit.rb:116:in check_java_version': the "java" command could not be found (Jammit::JavaNotFound) from /Library/Ruby/Gems/1.8/gems/jammit-0.2.5/lib/jammit.rb:60:in
load_configuration'
from /Library/Ruby/Gems/1.8/gems/jammit-0.2.5/lib/jammit.rb:136
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
require'
from /Library/Ruby/Gems/1.8/gems/jammit-0.2.5/bin/../lib/jammit/command_line.rb:2
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
require'
from /Library/Ruby/Gems/1.8/gems/jammit-0.2.5/bin/jammit:3
from /usr/bin/jammit:19:in `load'
from /usr/bin/jammit:19
works perfectly, thanks :)
Glad to hear it. Jammit 0.2.6 is out as a gem, with the Java exceptions. Closing this ticket -- thanks for the bug report.
Jammit fails with pretty cryptic errors (actually from yui-compressor) about broken pipes when java is not installed. Obviously yui-compressor requires java, but it would still be nice to get some sort of warning about not finding java in PATH.
Hope this saves someone a few hours of debugging ;)