Apparently the problem is this (from JDK 9 Release Notes[1]):

The application class loader is no longer an instance of
> java.net.URLClassLoader (an implementation detail that was never
> specified in previous releases). Code that assumes that
> ClassLoader::getSytemClassLoader returns a URLClassLoader object will
> need to be updated. Note that Java SE and the JDK do not provide an API for
> applications or libraries to dynamically augment the class path at run-time.


Consequently, the functions <addURL> and <getClassPath> in
`modules/jvm/src/java/org/scilab/modules/jvm/ClassPath.java` fail because
of the casting of ClassLoader to URLClassLoader. None of the class paths
actually gets passed to the main code, and all hell ensues. I could get
around this by manually passing paths to all the necessary *.jar files to
_JAVA_OPTIONS. There is likely a better way, but so far it beats me.

Cheers.

[1]
http://www.oracle.com/technetwork/java/javase/9-relnote-issues-3704069.html


On 22 February 2018 at 13:39, Atri Bhattacharya <badshah...@gmail.com>
wrote:

> Dear Clément,
>
> On Wed, 2018-02-21 at 15:25 +0000, Clément David wrote:
> > Hello Atri,
> >
> > Thanks for your work on porting Scilab to jdk9 ;
>
> You are welcome. It's mostly based on self-interest: I use scilab
> regularly (mostly on the command line though) on openSUSE Tumbleweed.
>
> > this NoClassDefFoundError usually comes from a mis-
> > compilation check the jar content and be sure to load it correctly.
>
> I think the jar content looks ok. I think it's some incompatibility
> between jdk 8 and 9 that prevents the classpath from being correctly
> used. The same binary works with jdk 8 (even though it is compiled
> against jdk 9) once the jre paths in the scilab script are
> appropriately adapted; but it doesn't with jdk 9.
>
> > About the patches, I just
> > started to review them and will push them on the 6.0 branch after
> > fixing the build on my machine;
>
> Many thanks. It will be great if these patches are upstreamed; it would
> certainly reduce my work (I maintain Scilab packages for openSUSE)
> during version upgrades.
>
> Best wishes.
>
>
> > Le mercredi 21 février 2018 à 13:19 +0100, Atri Bhattacharya a écrit
> > :
> > > Hi,
> > > After several patches to fix building against java 9, I have been
> > > finally able to get scilab 6.0.1 building on openSUSE Tumbleweed.
> > > However, during run time, I now see a ClassNotFoundError, as
> > > follows:
> > > --------------------
> > > :~> SCIVERBOSE=1 scilab
> > > SCILABBIN : scilab-bin
> > > DISABLE_JAVA_DETECTION : 0
> > > SCILAB_MODE : gui
> > > OS : Linux
> > > MODEL : x86_64
> > > IS_SCILAB_BINARY : 0
> > > Using specified vm: /usr/lib64/jvm/java
> > > JAVA_HOME : /usr/lib64/jvm/java
> > > SCI : /usr/share/scilab/
> > > SCIBIN : /usr/bin/scilab-bin
> > > PATH :
> > > /usr/share/scilab/:/usr/share/scilab//bin:/usr/bin:/home/badshah400
> > > /bin
> > > :/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin
> > > CLASSPATH :
> > > /usr/share/scilab//modules/core/jar/org.scilab.modules.core.jar
> > > EGL_DRIVER :
> > > LD_LIBRARY_PATH :
> > > /usr/lib64/jvm/java/lib/:/usr/lib64/jvm/java/lib/server/:/usr/lib64
> > > /jvm
> > > /java/lib/native_threads/
> > > DOCBOOK : /usr/share/xml/docbook/stylesheet/nwalsh/current/
> > > WARNING: An illegal reflective access operation has occurred
> > > WARNING: Illegal reflective access by
> > > org.scilab.modules.jvm.LibraryPath
> > > (file:/usr/share/scilab/modules/jvm/jar/org.scilab.modules.jvm.jar)
> > > to
> > > field java.lang.ClassLoader.sys_paths
> > > WARNING: Please consider reporting this to the maintainers of
> > > org.scilab.modules.jvm.LibraryPath
> > > WARNING: Use --illegal-access=warn to enable warnings of further
> > > illegal reflective access operations
> > > WARNING: All illegal access operations will be denied in a future
> > > release
> > > Could not access to the Main Scilab Class:
> > > Exception in thread "main" java.lang.NoClassDefFoundError:
> > > org/scilab/modules/core/Scilab
> > > Caused by: java.lang.ClassNotFoundException:
> > > org.scilab.modules.core.Scilab
> > >     at
> > > java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinC
> > > lass
> > > Loader.java:582)
> > >     at
> > > java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass
> > > (Cla
> > > ssLoaders.java:185)
> > >     at
> > > java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
> > >
> > > Scilab cannot create Scilab Java Main-Class (we have not been able
> > > to
> > > find the main Scilab class. Check if the Scilab and thirdparty
> > > packages
> > > are available).
> > > --------------
> > >
> > > All patches are available at [1], and also documented on
> > > http://bugzilla.scilab.org/show_bug.cgi?id=15328
> > > where unfortunately, I have not seen the needle move much over the
> > > recent days.
> > >
> > > Scilab does work with java 1.8.0 (have to adapt the JRE paths
> > > appropriately in bin/scilab); however, as soon as java 9 is used
> > > the
> > > above error is manifested. If someone can help fix this issue, that
> > > will be very helpful.
> > >
> > > openSUSE uses Java 9 by default now, which means as of now scilab
> > > is
> > > badly broken -- only scilab-cli works -- on openSUSE Tumbleweed and
> > > soon to be released Leap 15.0. Unless Scilab's compatibility issues
> > > are
> > > fixed, we will have to drop it from the distro unfortunately.
> > >
> > > Thanks and best wishes.
> > >
> > > [1] https://build.opensuse.org/package/show/home:badshah400:branche
> > > s:science/scilab
> > >
> >
> > _______________________________________________
> > dev mailing list
> > dev@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/dev
> --
> Atri Bhattacharya
> Thu 22 Feb 12:28:07 CET 2018
>
> Sent from openSUSE Tumbleweed on my laptop.
>



-- 
Atri
_______________________________________________
dev mailing list
dev@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/dev

Reply via email to