Create Single JAR file fron a Module

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

Create Single JAR file fron a Module

by emmbec :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi I created a NetBeans Platform application with lots of modules, it has a very nice GUI and it works perfectly fine, however I have been asked to create some sort of API that I can use inside Matlab to call some functionalities of my NetBeans Platform application from within it, functionalities that are not GUI related. I already know how to call a JAR file from Matlab, however what I don't know is how to create a single JAR file for an specific module.



Let me explain a little more what I want to achieve, I have one module (Module A) that includes like three more modules and some NetBeans platform APIs. What module A does is basically wrapps up all of the other module features into a single class, and I would like to create a single JAR file for Module A, that includes ALL the other modules and NetBeans JARs, so that I can use that single JAR file inside Matlab.



Can I create a single JAR file for a module that includes all of its libraries on that same JAR?



I looked at some post where they said that I could do simething like this:




Code:
<target name="-pre-jar">

        <unjar src="${file.reference.MyObject.jar}" dest="${build.classes.dir}"/>

</target>





But I don't know what to write in the file.reference section... [Embarassed]



Any help is highly appreciated.



Thanks!





Create Single JAR file from a Module

by emmbec :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok I beleive it is not possible then, what I did right now was to create a new Java Project and then included the built JARs that I need from my NetBeans Platform application into that project, this way if I make any change in the Platform application I will just need to build that Platform application and then go to my Java project and recompile with the pre-jar options to get a single JAR file with all of the classes and objects I need. Its a bit messy but this way I can have my API separated from my platform project but include the necessary module classes that I need for my API.



Thanks anyway, hope this helps someone else.





Re: Create Single JAR file from a Module

by Oliver Rettig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hallo,

I had a simlar problem. And I descided to create normal java SE projects for
the APIs I also want to use in the Matlab environment. Then I create Library-
wrapper modules for them to use them in my netbeans app. This works well.  
There is a nice blog from Geertjan which describes how to change the build
scripts etc. to manage that after changes all is up to date: The wrapper
module links to the jar in the se project etc.
I don not remember the link the blog but I think you can find it.

best regards
Oliver

> Ok I beleive it is not possible then, what I did right now was to create a
> new Java Project and then included the built JARs that I need from my
> NetBeans Platform application into that project, this way if I make any
> change in the Platform application I will just need to build that Platform
> application and then go to my Java project and recompile with the pre-jar
> options to get a single JAR file with all of the classes and objects I
> need. Its a bit messy but this way I can have my API separated from my
> platform project but include the necessary module classes that I need for
> my API.
>
>
>
> Thanks anyway, hope this helps someone else.


Re: Create Single JAR file from a Module

by Fabrizio Giudici :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oliver Rettig wrote:

> Hallo,
>
> I had a simlar problem. And I descided to create normal java SE projects for
> the APIs I also want to use in the Matlab environment. Then I create Library-
> wrapper modules for them to use them in my netbeans app. This works well.  
> There is a nice blog from Geertjan which describes how to change the build
> scripts etc. to manage that after changes all is up to date: The wrapper
> module links to the jar in the se project etc.
> I don not remember the link the blog but I think you can find it.
>
> best regards
> Oliver
>
>  
>> Ok I beleive it is not possible then, what I did right now was to create a
>> new Java Project and then included the built JARs that I need from my
>> NetBeans Platform application into that project, this way if I make any
>> change in the Platform application I will just need to build that Platform
>> application and then go to my Java project and recompile with the pre-jar
>> options to get a single JAR file with all of the classes and objects I
>> need. Its a bit messy but this way I can have my API separated from my
>> platform project but include the necessary module classes that I need for
>> my API.
>>
>>    
I'm trying to solve this stuff in the opposite way: having a JSE project
which delivers a JAR, plus an already packed NBM. At the moment I'm
playing with a specific Maven plugin, but I know for sure there's an Ant
extension written by Tim Boudreau... I seem to recall he blogged about
that quite a few time ago. Tim?

--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@... - mobile: +39 348.150.6941


Re: Create Single JAR file from a Module

by tomwheel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am not Tim, of course, but is this the Ant extension you have in mind?

  http://weblogs.java.net/blog/timboudreau/archive/2007/02/generate_a_netb.html

On Tue, Jun 30, 2009 at 8:30 AM, Fabrizio
Giudici<fabrizio.giudici@...> wrote:
> I'm trying to solve this stuff in the opposite way: having a JSE project
> which delivers a JAR, plus an already packed NBM. At the moment I'm playing
> with a specific Maven plugin, but I know for sure there's an Ant extension
> written by Tim Boudreau... I seem to recall he blogged about that quite a
> few time ago. Tim?


--
Tom Wheeler
http://www.tomwheeler.com/

Re: Create Single JAR file from a Module

by Fabrizio Giudici :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tom Wheeler wrote:
> I am not Tim, of course, but is this the Ant extension you have in mind?
>
>   http://weblogs.java.net/blog/timboudreau/archive/2007/02/generate_a_netb.html
>  
Yes :-) Tim or Tom didn't make any difference in this case :-D

--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@... - mobile: +39 348.150.6941


Create Single JAR file from a Module

by Eser Rashawn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I created a NetBeans Platform application with lots of modules, it has a very nice GUI and it works perfectly fine, however I have been asked to create some sort of API that I can use inside Matlab to call some functionalities of my NetBeans Platform application from within it, functionalities that are not GUI related. I already know how to call a JAR file from Matlab, however what I don't know is how to create a single JAR file for an specific module.Let me explain a little more what I want to achieve, I have one module (Module A) that includes like three more modules and some NetBeans platform APIs. What module A does is basically wrapps up all of the other module features into a single class, and I would like to create a single JAR file for Module A, that includes ALL the other modules and NetBeans JARs, so that I can use that single JAR file inside Matlab.

Can I create a single JAR file for a module that includes all of its libraries on that same JAR?

I looked at some post where they said that I could do simething like this:



Code:

<target name="-pre-jar">



        <unjar src="${file.reference.MyObject.jar}" dest="${build.classes.dir}"/>



</target>