L2JMobius

Master Class Ch. 2 Missing methods for ScriptingFileManager (java 19 or lower)

Keikei · 1 · 1683

Offline Keikei

  • Vassal
  • *
    • Posts: 5
It seems Oracle added these methods to compile java code with javac.
Class: ScriptingFileManager.java

Code: [Select]
@Override
public Iterable<Set<Location>> listLocationsForModules(Location location) throws IOException {
return this._wrapped.listLocationsForModules(location);
}

@Override
public String inferModuleName(Location location) throws IOException {
return this._wrapped.inferModuleName(location);
}

Without overriding these methods the server throws "UnsupportedOperation" exception and you have to downgrade your java version.
(Tested with java 19 and with --enable-preview option).

Greetings.

BONUS - Configure enable/disable preview java features:

ScriptEngine.ini
Code: [Select]
# Enable preview features: --enable-preview
previewFeatures = true

JavaExecutionContext.java
Code: [Select]
// Set options.
addOptionIfNotNull(_options, getProperty("source"), "-source");
addOptionIfNotNull(_options, getProperty("sourcepath"), "-sourcepath");
addOptionIfNotNull(_options, getProperty("g"), "-g:");

// Enable experimental/preview java features
if ("true".equalsIgnoreCase(getProperty("previewFeatures"))) {
_options.add("--enable-preview");
}