?
Solved

Example of modular Java code for non-web applications

Posted on 2010-09-13
2
Medium Priority
?
662 Views
Last Modified: 2012-05-10
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
Comment
Question by:michael_martinek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
jatyap earned 1000 total points
ID: 33668599
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
 

Author Closing Comment

by:michael_martinek
ID: 33668685
Exactly it. Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question