public static String getModuleName(Path file) {
		try {
			Set<ModuleReference> refs = ModuleFinder.of(file).findAll();
			if (!refs.isEmpty()) {
				return refs.iterator().next().descriptor().name();
			}
		} catch (FindException ex) {
			// Ignore
		}
		return null;
	}
WARNING: This file MUST be compiled with Java 9+
src/main/java9/dev/jbang/util/ModuleUtil9.java