Re: Weka at jdk17+

Eibe Frank <[email protected]>
Newsgroups gmane.comp.ai.weka
Message-ID <CADehzLUBxnc=whk4ri6qxpxAEGBbhFPWzNsBN_ZEfPCMXx=TWw@mail.gmail.com>
The following works for me (--add-opens needed to be used to make
warnings or failures regarding module boundaries go away since at
least Java 11):

C:\Users\eibe>java -version
openjdk version "17" 2021-09-14 LTS
OpenJDK Runtime Environment Zulu17.28+13-CA (build 17+35-LTS)
OpenJDK 64-Bit Server VM Zulu17.28+13-CA (build 17+35-LTS, mixed mode, sharing)

C:\Users\eibe> java --add-opens java.base/java.lang=ALL-UNNAMED -jar
"C:\Program Files\Weka-3-8-5\weka.jar"

There don't seem to be any issues regarding MTJ when running WEKA like
this. (Note that we are maintaining our own version of MTJ's base
library netlib-java at
https://svn.cms.waikato.ac.nz/svn/weka/netlib-java/ now because we had
to compile up support for Mac ARM anyway.)

Cheers,
Eibe

On Mon, 4 Oct 2021 at 02:41, Michael Hall <[email protected]> wrote:
>
> At least some Weka Package Manager breaks with jdk restrictions at jdk17 - see below. Are there any current plans to address this?
> It appears what is not allowed is related to loading the MTJ matrix library. That project doesn’t appear to have been active for 6 years
>
> https://github.com/fommil/matrix-toolkits-java/tree/master/src/main/java/no/uib/cipr/matrix
>
> So it doesn’t seem likely they will update for the new java release.
>
> As near as I can tell this involves 5 classes…
>
> /Applications/weka-3-9-5/src/main/java/weka/attributeSelection/PrincipalComponents.java:29: import no.uib.cipr.matrix.*;
> /Applications/weka-3-9-5/src/main/java/weka/classifiers/functions/GaussianProcesses.java:50: import no.uib.cipr.matrix.*;
> /Applications/weka-3-9-5/src/main/java/weka/classifiers/functions/GaussianProcesses.java:51: import no.uib.cipr.matrix.Matrix;
> /Applications/weka-3-9-5/src/main/java/weka/classifiers/functions/LinearRegression.java:28: import no.uib.cipr.matrix.*;
> /Applications/weka-3-9-5/src/main/java/weka/classifiers/functions/LinearRegression.java:29: import no.uib.cipr.matrix.Matrix;
> /Applications/weka-3-9-5/src/main/java/weka/estimators/MultivariateGaussianEstimator.java:23: import no.uib.cipr.matrix.*;
> /Applications/weka-3-9-5/src/main/java/weka/estimators/MultivariateGaussianEstimator.java:24: import no.uib.cipr.matrix.Matrix;
> /Applications/weka-3-9-5/src/main/java/weka/filters/unsupervised/attribute/PrincipalComponents.java:27: import no.uib.cipr.matrix.*;
>
> To what extent they are used or how complicated it would be I don’t know. I think I looked at this a little bit when I had problems with large matrices and it wasn’t simple looking.
>
> ND4J associated with Deeplearning4j seems a possible replacement that would likely see ongoing support for some time.
>
> https://deeplearning4j.konduit.ai/nd4j/tutorials/quickstart
>
> But searching does show a number of possible matrix libraries.
>
> My application for it’s own reasons is currently on jdk18. I think I saw jdk17 went general availability a little while back. It appears Weka is still java 1.8
> java.specification.version 1.8.
> Yet to enter the modular world.
>
> One quick change that might work most of the time would be to have Weka check the specification version and if it’s greater than 16 skip the MTJ related. Affecting only those using the above 5 classes.
>
> A related error for my application is…
>
> ava.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @74a10858
> at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
> at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
> at java.base/java.lang.reflect.Method.checkCanSetAccessible(Unknown Source)
> at java.base/java.lang.reflect.Method.setAccessible(Unknown Source)
> at weka.core.WekaPackageClassLoaderManager.injectClasses(WekaPackageClassLoaderManager.java:792)
> at weka.core.WekaPackageClassLoaderManager.injectAllClassesInFromStream(WekaPackageClassLoaderManager.java:690)
> at weka.core.WekaPackageClassLoaderManager.injectMTJCoreClasses(WekaPackageClassLoaderManager.java:118)
> at weka.core.WekaPackageManager.<clinit>(WekaPackageManager.java:255)
> at weka.core.ResourceUtils.readProperties(ResourceUtils.java:241)
> at weka.core.ResourceUtils.readProperties(ResourceUtils.java:184)
> at weka.core.Utils.readProperties(Utils.java:164)
> at weka.core.Capabilities.<clinit>(Capabilities.java:104)
> at weka.classifiers.trees.J48.getCapabilities(J48.java:250)
> at weka.classifiers.trees.J48.buildClassifier(J48.java:300)
> at weka.classifiers.evaluation.Evaluation.crossValidateModel(Evaluation.java:843)
> at weka.classifiers.evaluation.Evaluation.crossValidateModel(Evaluation.java:797)
> at weka.classifiers.Evaluation.crossValidateModel(Evaluation.java:369)
> at REPL.$JShell$16.do_it$($JShell$16.java:5)
>
> I was trying to do a simple J48 classification of the Iris dataset. This error doesn’t seem necessary.
>
> _______________________________________________
> Wekalist mailing list -- [email protected]
> Send posts to [email protected]
> To unsubscribe send an email to [email protected]
> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
_______________________________________________
Wekalist mailing list -- [email protected]
Send posts to [email protected]
To unsubscribe send an email to [email protected]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.