Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes creating a system that can work with plug ins Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "creating a system that can work with plug ins " Watch "creating a system that can work with plug ins " New topic
Author

creating a system that can work with plug ins

Georgios Chatziefstratiou
Ranch Hand

Joined: May 26, 2012
Posts: 83
Hi there

I want to implement a Java application with plug in function

Does any one know where to start.I don’t even know how to do it.

I have good knowledge of Java but never came on something like that any ides help tips where to start or how to implement it .

in some words how this will work is that It will be an application that run on web or not and some one can add plug ins with functionality s (new tools new functions new styles) if not maybe then it can be implement on a desktop application and how ?

how should i start?
After a lot of research i cannot find something to start any ideas where to?
How to create something that accepts plug ins to work.All the help is most welcome


thanks in advance
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7772
    
  21

Horche Gratsias wrote:I want to implement a Java application with plug in function
...
I have good knowledge of Java but never came on something like that any ides help tips where to start or how to implement it .

Interesting question.

I've never tried it - at least not in the way that I think you mean, but my first thoughts on the subject seem to be borne out by this page.

First: you have to come up with a protocol - by which I mean a set of methods or interfaces that ALL plugins have to adhere to.

Second: You'll need to design your project around interfaces rather than classes.

Third: You'll probably need some form of "registration" mechanism, so that existing code understands which plugins it actually has to work with.

As for the mechanics: Dunno; never tried it. But I suspect that you'll be spending a lot of time in the "abstract".

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2370
    
  28

Well the whole have Java servlets API is built around this very idea. It allows you to develop some piece of code that can service HTTP requests and plugin to the web container. You might want to study web containers more and borrow some ideas.


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41800
    
  62
If I may strut my own stuff, start here: http://www.javaranch.com/journal/200607/Journal200607.jsp#a1

That's a lightweight approach, though. For heavy-duty stuff you'd use OSGi these days.


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19692
    
  20

ServiceLoader is another useful tool that can be used these days to discover the plugin implementation classes, combined with a class loader to load the classes.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7772
    
  21

Ulf Dittmer wrote:If I may strut my own stuff, start here: http://www.javaranch.com/journal/200607/Journal200607.jsp#a1

Wow. Some page; and right on point. My kudos.

Winston
Georgios Chatziefstratiou
Ranch Hand

Joined: May 26, 2012
Posts: 83
Hi guys thanks for your help and suggestions.

I will look all your link sites and give you feedback.
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 946
    
  13

Ulf Dittmer wrote:If I may strut my own stuff, start here: http://www.javaranch.com/journal/200607/Journal200607.jsp#a1

That's a lightweight approach, though. For heavy-duty stuff you'd use OSGi these days.


That was fascinating. Thanks for that article.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14143
    
  18

There are complete frameworks such as OSGi and the Netbeans module framework which help you to create applications that can have plugins, complete with auto-update mechanisms etc. You might want to look into those, although they're both not frameworks that are really easy to understand.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 946
    
  13

I've been struggling to create a NetBeans plugin, but the learning trail at netbeans.org doesn't work with 7.2. There is a bug in 7.2 that prevents junit from installing and the GoogleToolbar tutorial example depends on it. I've spent the last 3 days looking for a solution to the junit problem and it appears that I'll have to wait for 7.3.

If you know of any articles/sites/books about netbeans plugin development, please point me in the right direction.

Georgios Chatziefstratiou
Ranch Hand

Joined: May 26, 2012
Posts: 83
Jk Robbins wrote:I've been struggling to create a NetBeans plugin, but the learning trail at netbeans.org doesn't work with 7.2. There is a bug in 7.2 that prevents junit from installing and the GoogleToolbar tutorial example depends on it. I've spent the last 3 days looking for a solution to the junit problem and it appears that I'll have to wait for 7.3.

If you know of any articles/sites/books about netbeans plugin development, please point me in the right direction.


yes i have notice that many code samples from netbeans.org don't work I really don't understand why ?
I still have to read all the material people said me here in forum when i am at the end i will give the feedback for all of them.
Georgios Chatziefstratiou
Ranch Hand

Joined: May 26, 2012
Posts: 83
Hi people .
thanks a lot for your help .
After Reading a lot the only think i can say is that the simplest way to do an application is by using the Netbeans pltaform or Eclipse platform.

I have read all the tutorials you give me and it's very hard to design it . The best way to do it is by using one of this platforms and olny for desktop applications.On something about web application it's even harder.
Alternative is to use a framework like play or something like that, then the best ways to implement it is by adding a new view on the current view.Hard to explain .Try to play Travian for example and you will understand it .



Thanks a lot for your help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating a system that can work with plug ins