You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Ittay Dror <it...@gmail.com> on 2008/11/26 06:23:32 UTC

adding classpath to Java.module

Hi,


Is there a way of adding a jar to the Java classpath, after it is 
already loaded,  so that I can then use its classes? If not, what is the 
proper way of adding java code that an extension can then use?


Thanks,

Ittay


-- 
--
Ittay Dror <it...@gmail.com>


Re: adding classpath to Java.module

Posted by Assaf Arkin <ar...@intalio.com>.
On Wed, Nov 26, 2008 at 11:00 AM, Ittay Dror <it...@tikalk.com> wrote:
>
>
> Assaf Arkin wrote:
>
>> On Wed, Nov 26, 2008 at 10:42 AM, Ittay Dror <it...@tikalk.com> wrote:
>>
>>>
>>> what if i need to load a jar (created) during the build ?
>>>
>>
>> Your extension can create a class loader and load whatever it needs.
>>
>
> which is the second part of my question. do you recommend any particular way
> of doing that?  i can create a url classloader through rjb , then add the
> jar to it, then ask it for the class i want, but it looks like too verbose.
> on the other hand, if i want to write  a utility class to do that for me,
> then i need to compile it and then java is already loaded and doesn't know
> about it.

If you only need to compile these files once, one option is to run
javac on them, the other is to pre-compile.  We pre-compile all the
Java classes that ship with Buildr.

Assaf

>>
>> Assaf
>>
>>
>>>
>>> Assaf Arkin wrote:
>>>
>>>>
>>>> On Tue, Nov 25, 2008 at 9:23 PM, Ittay Dror <it...@gmail.com>
>>>> wrote:
>>>>
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>>
>>>>> Is there a way of adding a jar to the Java classpath, after it is
>>>>> already
>>>>> loaded,  so that I can then use its classes? If not, what is the proper
>>>>> way
>>>>> of adding java code that an extension can then use?
>>>>>
>>>>>
>>>>
>>>> The JVM is only loaded during the build, so extensions can add JARs to
>>>> the classpath if they need to:
>>>> http://incubator.apache.org/buildr/more_stuff.html#using_java_libraries
>>>>
>>>> Assaf
>>>>
>>>>
>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Ittay
>>>>>
>>>>>
>>>>> --
>>>>> --
>>>>> Ittay Dror <it...@gmail.com>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> Ittay Dror <it...@tikalk.com>
>>> Tikal <http://www.tikalk.com>
>>> Tikal Project <http://tikal.sourceforge.net>
>>>
>>>
>>>
>>
>>
>
> --
> Ittay Dror <it...@tikalk.com>
> Tikal <http://www.tikalk.com>
> Tikal Project <http://tikal.sourceforge.net>
>
>

Re: adding classpath to Java.module

Posted by Ittay Dror <it...@tikalk.com>.

Assaf Arkin wrote:

> On Wed, Nov 26, 2008 at 10:42 AM, Ittay Dror <it...@tikalk.com> wrote:
>   
>> what if i need to load a jar (created) during the build ?
>>     
>
> Your extension can create a class loader and load whatever it needs.
>   
which is the second part of my question. do you recommend any particular 
way of doing that?  i can create a url classloader through rjb , then 
add the jar to it, then ask it for the class i want, but it looks like 
too verbose. on the other hand, if i want to write  a utility class to 
do that for me, then i need to compile it and then java is already 
loaded and doesn't know about it.
> Assaf
>
>   
>> Assaf Arkin wrote:
>>     
>>> On Tue, Nov 25, 2008 at 9:23 PM, Ittay Dror <it...@gmail.com> wrote:
>>>
>>>       
>>>> Hi,
>>>>
>>>>
>>>> Is there a way of adding a jar to the Java classpath, after it is already
>>>> loaded,  so that I can then use its classes? If not, what is the proper
>>>> way
>>>> of adding java code that an extension can then use?
>>>>
>>>>         
>>> The JVM is only loaded during the build, so extensions can add JARs to
>>> the classpath if they need to:
>>> http://incubator.apache.org/buildr/more_stuff.html#using_java_libraries
>>>
>>> Assaf
>>>
>>>
>>>       
>>>> Thanks,
>>>>
>>>> Ittay
>>>>
>>>>
>>>> --
>>>> --
>>>> Ittay Dror <it...@gmail.com>
>>>>
>>>>
>>>>
>>>>         
>>>       
>> --
>> Ittay Dror <it...@tikalk.com>
>> Tikal <http://www.tikalk.com>
>> Tikal Project <http://tikal.sourceforge.net>
>>
>>
>>     
>
>   

-- 
Ittay Dror <it...@tikalk.com>
Tikal <http://www.tikalk.com>
Tikal Project <http://tikal.sourceforge.net>


Re: adding classpath to Java.module

Posted by Assaf Arkin <ar...@intalio.com>.
On Wed, Nov 26, 2008 at 10:42 AM, Ittay Dror <it...@tikalk.com> wrote:
> what if i need to load a jar (created) during the build ?

Your extension can create a class loader and load whatever it needs.

Assaf

>
> Assaf Arkin wrote:
>>
>> On Tue, Nov 25, 2008 at 9:23 PM, Ittay Dror <it...@gmail.com> wrote:
>>
>>>
>>> Hi,
>>>
>>>
>>> Is there a way of adding a jar to the Java classpath, after it is already
>>> loaded,  so that I can then use its classes? If not, what is the proper
>>> way
>>> of adding java code that an extension can then use?
>>>
>>
>> The JVM is only loaded during the build, so extensions can add JARs to
>> the classpath if they need to:
>> http://incubator.apache.org/buildr/more_stuff.html#using_java_libraries
>>
>> Assaf
>>
>>
>>>
>>> Thanks,
>>>
>>> Ittay
>>>
>>>
>>> --
>>> --
>>> Ittay Dror <it...@gmail.com>
>>>
>>>
>>>
>>
>>
>
> --
> Ittay Dror <it...@tikalk.com>
> Tikal <http://www.tikalk.com>
> Tikal Project <http://tikal.sourceforge.net>
>
>

Re: adding classpath to Java.module

Posted by Ittay Dror <it...@tikalk.com>.
 what if i need to load a jar (created) during the build ?

Assaf Arkin wrote:
> On Tue, Nov 25, 2008 at 9:23 PM, Ittay Dror <it...@gmail.com> wrote:
>   
>> Hi,
>>
>>
>> Is there a way of adding a jar to the Java classpath, after it is already
>> loaded,  so that I can then use its classes? If not, what is the proper way
>> of adding java code that an extension can then use?
>>     
>
> The JVM is only loaded during the build, so extensions can add JARs to
> the classpath if they need to:
> http://incubator.apache.org/buildr/more_stuff.html#using_java_libraries
>
> Assaf
>
>   
>> Thanks,
>>
>> Ittay
>>
>>
>> --
>> --
>> Ittay Dror <it...@gmail.com>
>>
>>
>>     
>
>   

-- 
Ittay Dror <it...@tikalk.com>
Tikal <http://www.tikalk.com>
Tikal Project <http://tikal.sourceforge.net>


Re: adding classpath to Java.module

Posted by Assaf Arkin <ar...@intalio.com>.
On Tue, Nov 25, 2008 at 9:23 PM, Ittay Dror <it...@gmail.com> wrote:
> Hi,
>
>
> Is there a way of adding a jar to the Java classpath, after it is already
> loaded,  so that I can then use its classes? If not, what is the proper way
> of adding java code that an extension can then use?

The JVM is only loaded during the build, so extensions can add JARs to
the classpath if they need to:
http://incubator.apache.org/buildr/more_stuff.html#using_java_libraries

Assaf

>
>
> Thanks,
>
> Ittay
>
>
> --
> --
> Ittay Dror <it...@gmail.com>
>
>