There is no tools.jar on Mac OS X JDK

View: New views
5 Messages — Rating Filter:   Alert me  

There is no tools.jar on Mac OS X JDK

by Eung-ju Park :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?


Re: There is no tools.jar on Mac OS X JDK

by lacton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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?

Re: There is no tools.jar on Mac OS X JDK

by lacton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Committed revision 695005.  That should fix the issue on OS X.  Can you confirm?

The next step for me is to extend the tools_jar logic to the apt
method.  First, I want to add some tests.

Lacton

On Sat, Sep 13, 2008 at 7:15 PM, lacton <lacton@...> wrote:

> 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@...> 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?

Re: There is no tools.jar on Mac OS X JDK

by Eung-ju Park :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, It works well on my OS X. Thank you.

On Sun, Sep 14, 2008 at 4:06 AM, lacton <lacton@...>wrote:

> Committed revision 695005.  That should fix the issue on OS X.  Can you
> confirm?
>
> The next step for me is to extend the tools_jar logic to the apt
> method.  First, I want to add some tests.
>
> Lacton
>
> On Sat, Sep 13, 2008 at 7:15 PM, lacton <lacton@...>
> wrote:
> > 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@...> 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?
>



--
* LukeSkywalker: Is the dark side stronger?
* MasterYoda: No...no...no. Quicker, easier, more seductive.

Re: There is no tools.jar on Mac OS X JDK

by lacton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Great. :-)

Lacton

On Sun, Sep 14, 2008 at 2:38 PM, Eung-ju Park <eungju@...> wrote:

> Yes, It works well on my OS X. Thank you.
>
> On Sun, Sep 14, 2008 at 4:06 AM, lacton <lacton@...>wrote:
>
>> Committed revision 695005.  That should fix the issue on OS X.  Can you
>> confirm?
>>
>> The next step for me is to extend the tools_jar logic to the apt
>> method.  First, I want to add some tests.
>>
>> Lacton
>>
>> On Sat, Sep 13, 2008 at 7:15 PM, lacton <lacton@...>
>> wrote:
>> > 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@...> 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?
LightInTheBox - Buy quality products at wholesale price!