Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Usage



This article explains the basic usage of the library. To see how to use the grapical interface, see Graphical interface.

Create a JarDependencies

Main Article: JarDependencies

The simplest way to use this class is simply to create one JarDependencies and provide it a directory containing classes, or one jar file:
  File myJarFile = "D:/Java/libraries/theJarFile.jar";
  JarDependencies depend = new JarDependencies(<myJarFile>);
It is also possible to create it by providing the directory, and the root name of the file name. For example:
  File myDirectory = "D:/Java/libraries";
  JarDependencies depend = new JarDependencies(<myDirectory>, <"theJarFile">);

Check dependencies on other libraries

It is then possible to use it in any application. One simple thing to do is checking if the JarDependencies has dependencies from another one. For example:
  JarDependencies depend = new JarDependencies(<myJarFile>);
  JarDependencies anotherDepend = new JarDependencies(<aSecondJarFile>);
  boolean isDependingOn = depend.isDependingOn(anotherDepend);

Check dependencies on a set of packages

Main Article: DependencyChecker

The DependencyChecker check if a Jar file or a JarDependencies has dependencies to a set of packages.

For example:
   Set<String> set = new HashSet<>();
   set.add("java.util");
   DependencyChecker checker = new DependencyChecker();
   boolean dependsOn = checker.check(<myJarFile>, set);

Check dependencies on Swing or JavaFX

To check the dependency on Swing or JavaFX:
  JarDependencies depend = new JarDependencies(<myJarFile>);
  boolean isDependingOnSwing = DependencyUtilities.dependOnSwing(depend);
  boolean isDependingOnJavaFX = DependencyUtilities.dependOnJavaFX(depend);

Java module system compatibility


The JavaModulesUtilities class allows to check that one or several Jar files are compatible with the Java module system

Utility classes

Main Article: Utility classes

Several utility classes are provided by the library:
  • The DependencyPrinter class allows to print the list of dependencies from one JarDependency and another
  • The JavaModulesUtilities class allows to check that one or several Jar files are compatible with the Java module system
  • The CompactProfiles class allows to check that one Jar file is compatible with a specific Java compact profile (from compact1 to compact3)
  • The JarManifestUtilities class allows to check that the jar files declared in the Class-Path attribute in a Jar file Manifest exist

See also


Categories: general

Copyright 2019 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 licence