File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Modular java software using jars Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Modular java software using jars" Watch "Modular java software using jars" New topic

Modular java software using jars

Bill Lamboor

Joined: Oct 13, 2005
Posts: 4
Im currently developing a software application in java. This applicaton contains many modules.

What I would like to do ulitmatly is at the end of my project have:


My question is can I somehow have these modules communicate with eachoter? Meaning have module1, 2 and 3 act as one jar but in physically split in three? can this be done?

The reason I wish to do this is to example send client updates of module2.jar withouht having to worry about module1.jar and module3.jar. I don't want to have to send an update of the entire project it is to large.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 696
To have classes in one location use/reference classes in other locations requires that the classes be on the classpath.
There are several ways to set the classpath.
The Class-path: entry in the manifest of the jar file.
The commandline when java is executed.
Dynamically by using a ClassLoader in the program.
An environment variable. (worst choice)

How do you execute your application?
If its from a batch file or from a shortcut(Windows) then put all the jar files in the -classpath <files>;... option for the java.exe command.
If its by opening a jar file, use the manifest file entry.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15094

Put all the JARs in the classpath. It doesn't matter how you distribute your classes over the different JAR files, as long as they're all in the classpath.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Bill Lamboor

Joined: Oct 13, 2005
Posts: 4
I'm developing with JBuilder 8 and generating an executable .exe for windows os when packaging my app.
Bill Lamboor

Joined: Oct 13, 2005
Posts: 4
My apologies for the crosspot. I wasn't quite sure where to post this question. Im new on this site.

My no means was I trying to attract more attention.

I agree. Here's the link:
subject: Modular java software using jars
It's not a secret anymore!