• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 665
  • Last Modified:

Example of modular Java code for non-web applications

Greetings,

I'm looking for an example of simple modular code in Java. After quite some researching, I'm only finding complex examples and "full" packages which also utilize larger frameworks and such. It seems like there would be a much simpler solution.

I'm assuming some usage of reflection and such. The modules don't need security considerations; they will only be provided and written by in-house developers. The reflection and interfacing is cake, but what I'm largely confused about is how to get the classes loaded dynamically at run-time when the JAR files may be dropped in place at any time.
0
michael_martinek
Asked:
michael_martinek
1 Solution
 
jatyapCommented:
Since you mention that the JAR files can be dropped in place, I'm assuming you want to have something similar to how the Eclipse IDE handles their plugins?

Well, first off, you will need to specify a directory (or group of directories) which your application will treat as a plugin/dropin repository.

I'm not sure if this is what you want, but the following link shows how to load classes from JAR files at runtime. You can also call invoke on the methods, etc. (Basically whatever you can do with reflection)

http://www.javaworld.com/javaworld/javatips/jw-javatip70.html
0
 
michael_martinekAuthor Commented:
Exactly it. Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now