Order of jars on classpath of module

Answered

On my java project I added whole  folder with jars to module dependencies ("JARs or directories..") . In this folder I've  couple jars. What will be order of those jars on runtime classapth?    My guess would be alphabetical but it seems to be random ...  I know that I can add each jar separately and define order manually but what if I add whole directory of jars. Are those jars ordered in anyway ?  

I'm working on Idea 14.1.5 

 

2 comments
Comment actions Permalink

When you add a directory with JARs to a library order of these JARs in classpath is system-dependent. If order of these jar files is important for your application you indeed need to either create separate libraries or move these jar files to separate directories and create libraries pointing to these directories.

0
Comment actions Permalink

Don't you think that much better would be to sort them alphabetically ?  It would make configuration more predictable ..  Now on different machines it can work differently. I guess it is possible that order may be affected by  some changes in the system.

 

Anyway,   for sure the best option is not to have dependency on order of jars

0

Please sign in to leave a comment.