FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Create Single JAR file from a Module

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
emmbec



Joined: 27 Nov 2008
Posts: 49
Location: Queretaro, Mexico

PostPosted: Fri Jun 26, 2009 3:25 pm    Post subject: Create Single JAR file from a Module Reply with quote

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!
Back to top
View user's profile Send private message
emmbec



Joined: 27 Nov 2008
Posts: 49
Location: Queretaro, Mexico

PostPosted: Mon Jun 29, 2009 11:49 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Oliver Rettig
Posted via mailing list.





PostPosted: Tue Jun 30, 2009 1:07 pm    Post subject: Create Single JAR file from a Module Reply with quote

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

Quote:
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.
Back to top
Fabrizio Giudici
Posted via mailing list.





PostPosted: Tue Jun 30, 2009 1:55 pm    Post subject: Create Single JAR file from a Module Reply with quote

Oliver Rettig wrote:
Quote:
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


Quote:
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
address-removed - mobile: +39 348.150.6941
Back to top
tomwheeler



Joined: 03 Sep 2008
Posts: 564

PostPosted: Tue Jun 30, 2009 5:28 pm    Post subject: Create Single JAR file from a Module Reply with quote

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<address-removed> wrote:
Quote:
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/
Back to top
View user's profile Send private message
Fabrizio Giudici
Posted via mailing list.





PostPosted: Tue Jun 30, 2009 5:35 pm    Post subject: Create Single JAR file from a Module Reply with quote

Tom Wheeler wrote:
Quote:
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 Smile 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
address-removed - mobile: +39 348.150.6941
Back to top
Eser Rashawn



Joined: 04 Jul 2009
Posts: 3

PostPosted: Sat Jul 04, 2009 8:56 pm    Post subject: Create Single JAR file from a Module Reply with quote

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>

_________________
softphone
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB