Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Is this what the Java 9 module system designed to solve?

 
Greenhorn
Posts: 17
Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there,

I am writing an application in Java 8 at the moment and have hit a critical point.

Thus far I have got 3 jar files with the following functions:

- JavaFX GUI
- BaseX Database API which can query a BaseX database, create and run queries, and use JAXB to translate xml into Java Objects
- An abstraction for converting database output into MS Word or MS Excel documents
- 1 Jar per implementation of the above.

My brain starts to melt when putting all of these into a single application.

Do I keep these as separate jars (projects in Netbeans)? Or is this what the Java 9 module system designed to solve?
 
Rancher
Posts: 508
15
Notepad Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is difficult to say anything without knowing the application design (functionality and packaging) and the size. Also, how it is designed and the various components interact with each other.

If its a small application one can put the application together into a single jar file. For example, I have had an experience working with a small GUI application which stores data in a database. The application had about 80 classes organized in 6 packages. I had the application in two jar files one has the application's classes and a database implementation jar file. The application also had components like user manual and icon files. The application needed a JRE to run it by a user. It was sufficient that way for that application.

About using Java 9: It needs good understanding of how the modularity works and also various features provided by it - to think, design and implement an application using the module system. It needs a good study of how that system is to be used. I don't have any experience about using it yet. But, I have been studying and this is my first thought about it.
 
Saloon Keeper
Posts: 6592
161
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What, specifically, is the issue that you're uncertain about? Lots of applications consist of multiple jar files. If for some reason you need them packaged into a single jar file, then there are tools that will do that for you. That in itself is not a reason to combine them into a single NB project, or to consider modules.
 
Shaun Connelly-Flymn
Greenhorn
Posts: 17
Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your replies.

My application is quite small... I guess I am struggling with how to organise the project.

Each JAR has about 6 packages with about 6 to 12 classes per package.

I guess I find it easier to track dependencies when separated into JARs like I have at the moment: when I have copied in all packages into 1 project thus 1 JAR I find that a maintenace problem.

It is an application that I want to keep adding features to, and I guess I am trying to work out how best to do that by keeping all the concerns (Db access, GUI, Formatting etc) neatly separated.
 
Marshal
Posts: 70260
282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds to me like an application still in development; do yoiu need it in separate .jars? Can you unzip the .jars and then reassemble them into one .jar? It does sound that making the GUI .jars accessible only as “internal” parts of the app might be a good idea, in which case modules would help.
How much do you know about modules?
 
Shaun Connelly-Flymn
Greenhorn
Posts: 17
Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Modules in the Java 9 sense?
 
Tim Moores
Saloon Keeper
Posts: 6592
161
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:It does sound that making the GUI .jars accessible only as “internal” parts of the app might be a good idea.


If this was a library to be called by other people's code I could see a benefit in hiding the internal classes from client code. But for a GUI app - the code of which is unlikely to be called from elsewhere -, not so much.
 
Shaun Connelly-Flymn
Greenhorn
Posts: 17
Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for your responses... I think I was suffering from "analysis paralysis", and it has helped me go in a firm direction.

As it is just me coding this application, I think I was overcomplicating the design of a relatively small piece of work. I decided to merge all the packages from the various JARs into one larger JAR. Seems I was getting into bad habits with grouping classes by packages and had many more packages than I realised (some with 1 or 2 classes in).

It helped to talk, thank you for your responses.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic