buildr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lacton <lac...@users.sourceforge.net>
Subject Re: There is no tools.jar on Mac OS X JDK
Date Sat, 13 Sep 2008 17:15:38 GMT
Thank you for your feed back.

I didn't know File.exist? does not support 'nil'.  I'm disappointed.
I'm used to more programmer-friendly APIs in the ruby world. :-(

I'll fix it right away.

Lacton

On Sat, Sep 13, 2008 at 5:36 PM, Eung-ju PARK <eungju@gmail.com> wrote:
> I ran spec. spec complain about tools_jar variable is nil.
>
> --- error message ---
> can't convert nil into String
>
> /Users/eungju/src/buildr/lib/buildr/java/compilers.rb:63:in `exist?'
>
> 61        tools_jar = [File.expand_path('lib/tools.jar', ENV['JAVA_HOME']),
> File.expand_path('../lib/tools.jar', ENV['JAVA_HOME'])].
> 62          find { |path| File.exist?(path) }
> 63        dependencies << tools_jar if File.exist?(tools_jar)
> 64        cmd_args << '-classpath' <<
> dependencies.join(File::PATH_SEPARATOR) unless dependencies.empty?
> 65        source_paths = sources.select { |source| File.directory?(source) }
> 66# gem install syntax to get syntax highlighting
>
> I tries to find tools.jar on all of my install JDKs, but I can't.
> I found Mac OS X JDK doesn't provides tools.jar. See
> http://developer.apple.com/documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.html#//apple_ref/doc/uid/TP40001884-SW1
>
> Javac.compile should handle this case.
>
> Index: lib/buildr/java/compilers.rb
> ===================================================================
> --- lib/buildr/java/compilers.rb        (revision 694959)
> +++ lib/buildr/java/compilers.rb        (working copy)
> @@ -60,7 +60,7 @@
>         # but maybe the JRE.
>         tools_jar = [File.expand_path('lib/tools.jar', ENV['JAVA_HOME']),
> File.expand_path('../lib/tools.jar', ENV['JAVA_HOME'])].
>           find { |path| File.exist?(path) }
> -        dependencies << tools_jar if File.exist?(tools_jar)
> +        dependencies << tools_jar if tools_jar && File.exist?(tools_jar)
>         cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR)
> unless dependencies.empty?
>         source_paths = sources.select { |source| File.directory?(source) }
>         cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR)
> unless source_paths.empty?

Mime
View raw message