cognitect-labs / REBL-distro

REBL-distro
368 stars 9 forks source link

ClassNotFoundException: javafx.application.Platform #35

Closed didibus closed 5 years ago

didibus commented 5 years ago

Running on OpenSuse with:

$ java -version 
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (IcedTea 3.12.0) (build 1.8.0_212-b4 suse-1.2-x86_64)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

It seems that JavaFx can't be found:

Clojure 1.10.0                                                      
user=> Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)                                                                                      
        at java.lang.Class.forName(Class.java:348)                                                                                      
        at clojure.lang.RT.classForName(RT.java:2207)           
        at clojure.lang.RT.classForName(RT.java:2216)                                                                                   
        at clojure.lang.RT.loadClassForName(RT.java:2235)       
        at clojure.lang.RT.load(RT.java:453)            
        at clojure.lang.RT.load(RT.java:428)                
        at clojure.core$load$fn__6824.invoke(core.clj:6126)
        at clojure.core$load.invokeStatic(core.clj:6125)       
        at clojure.core$load.doInvoke(core.clj:6109)                                                                                    
        at clojure.lang.RestFn.invoke(RestFn.java:408)  
        at clojure.core$load_one.invokeStatic(core.clj:5908)
        at clojure.core$load_one.invoke(core.clj:5903)     
        at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
        at clojure.core$load_lib.invokeStatic(core.clj:5947)
        at clojure.core$load_lib.doInvoke(core.clj:5928)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.core$load_libs.invokeStatic(core.clj:5985)
        at clojure.core$load_libs.doInvoke(core.clj:5969)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.core$require.invokeStatic(core.clj:6007)
        at clojure.core$require.doInvoke(core.clj:6007)
        at clojure.lang.RestFn.invoke(RestFn.java:457)
        at cognitect.rebl.impl.monaco$loading__6706__auto____15422.invoke(monaco.clj:3)
        at cognitect.rebl.impl.monaco__init.load(Unknown Source)
        at cognitect.rebl.impl.monaco__init.<clinit>(Unknown Source) 
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at clojure.lang.RT.classForName(RT.java:2207)
        at java.lang.Class.forName(Class.java:348)                                                                             
        at clojure.lang.RT.classForName(RT.java:2207)        
        at clojure.lang.RT.classForName(RT.java:2216)               
        at clojure.lang.RT.loadClassForName(RT.java:2235)                                                                               
        at clojure.lang.RT.load(RT.java:453)                                                                                            
        at clojure.lang.RT.load(RT.java:428)                                                                                            
        at clojure.core$load$fn__6824.invoke(core.clj:6126)     
        at clojure.core$load.invokeStatic(core.clj:6125)                                                                                
        at clojure.core$load.doInvoke(core.clj:6109)            
        at clojure.lang.RestFn.invoke(RestFn.java:408)  
        at clojure.core$load_one.invokeStatic(core.clj:5908)
        at clojure.core$load_one.invoke(core.clj:5903)     
        at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
        at clojure.core$load_lib.invokeStatic(core.clj:5947)                                                                            
        at clojure.core$load_lib.doInvoke(core.clj:5928)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)     
        at clojure.core$apply.invokeStatic(core.clj:667)   
        at clojure.core$load_libs.invokeStatic(core.clj:5985)  
        at clojure.core$load_libs.doInvoke(core.clj:5969)   
        at clojure.lang.RestFn.applyTo(RestFn.java:137) 
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.core$require.invokeStatic(core.clj:6007)
        at clojure.core$require.doInvoke(core.clj:6007)      
        at clojure.lang.RestFn.invoke(RestFn.java:930)   
        at cognitect.rebl.ui$loading__6706__auto____15576.invoke(ui.clj:3)
        at cognitect.rebl.ui__init.load(Unknown Source) 
        at cognitect.rebl.ui__init.<clinit>(Unknown Source)
        at java.lang.Class.forName0(Native Method)     
        at java.lang.Class.forName(Class.java:348)    
        at clojure.lang.RT.classForName(RT.java:2207)                                                                                   
        at clojure.lang.RT.classForName(RT.java:2216)           
        at clojure.lang.RT.loadClassForName(RT.java:2235)                                                                               
        at clojure.lang.RT.load(RT.java:453)      
        at clojure.lang.RT.load(RT.java:428)      
        at clojure.core$load$fn__6824.invoke(core.clj:6126)
        at clojure.lang.RT.load(RT.java:428)                                                                                   
        at clojure.core$load$fn__6824.invoke(core.clj:6126)  
        at clojure.core$load.invokeStatic(core.clj:6125)            
        at clojure.core$load.doInvoke(core.clj:6109)                                                                                    
        at clojure.lang.RestFn.invoke(RestFn.java:408)                                                                                  
        at clojure.core$load_one.invokeStatic(core.clj:5908)                                                                            
        at clojure.core$load_one.invoke(core.clj:5903)          
        at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)                                                                         
        at clojure.core$load_lib.invokeStatic(core.clj:5947)    
        at clojure.core$load_lib.doInvoke(core.clj:5928)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)     
        at clojure.core$apply.invokeStatic(core.clj:667)   
        at clojure.core$load_libs.invokeStatic(core.clj:5985)  
        at clojure.core$load_libs.doInvoke(core.clj:5969)                                                                               
        at clojure.lang.RestFn.applyTo(RestFn.java:137) 
        at clojure.core$apply.invokeStatic(core.clj:667)    
        at clojure.core$require.invokeStatic(core.clj:6007)
        at clojure.core$require.doInvoke(core.clj:6007)        
        at clojure.lang.RestFn.invoke(RestFn.java:436)      
        at cognitect.rebl$ui.invokeStatic(rebl.clj:77)  
        at cognitect.rebl$ui.doInvoke(rebl.clj:74)      
        at clojure.lang.RestFn.invoke(RestFn.java:421)     
        at cognitect.rebl$repl.invokeStatic(rebl.clj:121)    
        at cognitect.rebl$repl.invoke(rebl.clj:96)       
        at cognitect.rebl$_main.invokeStatic(rebl.clj:125)                                                                              
        at cognitect.rebl$_main.invoke(rebl.clj:124)    
        at clojure.lang.AFn.applyToHelper(AFn.java:152)    
        at clojure.lang.AFn.applyTo(AFn.java:144)      
        at clojure.lang.Var.applyTo(Var.java:705)     
        at clojure.core$apply.invokeStatic(core.clj:665)                                                                                
        at clojure.main$main_opt.invokeStatic(main.clj:491)     
        at clojure.main$main_opt.invoke(main.clj:487)                                                                                   
        at clojure.main$main.invokeStatic(main.clj:598)
        at clojure.main$main.doInvoke(main.clj:561)
        at clojure.lang.RestFn.applyTo(RestFn.java:137) 
        at clojure.core$require.invokeStatic(core.clj:6007)                                                                     
        at clojure.core$require.doInvoke(core.clj:6007)      
        at clojure.lang.RestFn.invoke(RestFn.java:436)              
        at cognitect.rebl$ui.invokeStatic(rebl.clj:77)                                                                                  
        at cognitect.rebl$ui.doInvoke(rebl.clj:74)                                                                                      
        at clojure.lang.RestFn.invoke(RestFn.java:421)                                                                                  
        at cognitect.rebl$repl.invokeStatic(rebl.clj:121)       
        at cognitect.rebl$repl.invoke(rebl.clj:96)                                                                                      
        at cognitect.rebl$_main.invokeStatic(rebl.clj:125)      
        at cognitect.rebl$_main.invoke(rebl.clj:124)    
        at clojure.lang.AFn.applyToHelper(AFn.java:152)     
        at clojure.lang.AFn.applyTo(AFn.java:144)          
        at clojure.lang.Var.applyTo(Var.java:705)              
        at clojure.core$apply.invokeStatic(core.clj:665)                                                                                
        at clojure.main$main_opt.invokeStatic(main.clj:491)
        at clojure.main$main_opt.invoke(main.clj:487)       
        at clojure.main$main.invokeStatic(main.clj:598)    
        at clojure.main$main.doInvoke(main.clj:561)            
        at clojure.lang.RestFn.applyTo(RestFn.java:137)     
        at clojure.lang.Var.applyTo(Var.java:705)       
        at clojure.main.main(main.java:37)              
Caused by: java.lang.ClassNotFoundException: javafx.application.Platform
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)                                                                
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)         
        at java.lang.Class.forName(Class.java:348)     
        at clojure.lang.RT.classForName(RT.java:2207) 
        at clojure.lang.RT.classForNameNonLoading(RT.java:2220)                                                                         
        at cognitect.rebl.fx$loading__6706__auto____15137.invoke(fx.clj:3)
        at cognitect.rebl.fx__init.load(Unknown Source)                                                                                 
        at cognitect.rebl.fx__init.<clinit>(Unknown Source)
        ... 99 more  

Any ideas?

Thank You

didibus commented 5 years ago

It seems this is because the OpenJDK 8 build that comes with OpenSuse does not include JavaFX. Similarly, AdoptOpenJDK 8 does not include JavaFX yet either. I'm going to try either Zulu's or Amazon's and report back.

didibus commented 5 years ago

It did not work with Amazon Corretto 8, I got error:

$ clj -R:rebl -m cognitect.rebl                                                                    [23/23]
Clojure 1.10.0                                                                                                                          
user=> #error {                                                                                                                         
 :cause Can't load library: /usr/lib/jvm/java-1.8.0-amazon-corretto/jre/lib/amd64/libjfxwebkit.so                                       
 :via                                                                                                                                   
 [{:type javafx.fxml.LoadException                                                                                                      
   :message                                                                                                                             
file:/home/didier/bin/REBL-0.9.218.jar!/cognitect/rebl/rebl.fxml:42                                                                     

   :at [javafx.fxml.FXMLLoader constructLoadException FXMLLoader.java 2601]}                                                            
  {:type java.lang.RuntimeException                                                                                                     
   :message java.lang.reflect.InvocationTargetException                                                                                 
   :at [javafx.fxml.JavaFXBuilder$ObjectBuilder build JavaFXBuilderFactory.java 278]}                                                   
  {:type java.lang.reflect.InvocationTargetException                                                                                    
   :message nil                                                                                                                         
   :at [sun.reflect.NativeMethodAccessorImpl invoke0 NativeMethodAccessorImpl.java -2]}                                                 
  {:type java.lang.UnsatisfiedLinkError                                                                                                 
   :message Can't load library: /usr/lib/jvm/java-1.8.0-amazon-corretto/jre/lib/amd64/libjfxwebkit.so                                   
   :at [java.lang.ClassLoader loadLibrary ClassLoader.java 1827]}]                                                                      
 :trace                                                                                                                                 
 [[java.lang.ClassLoader loadLibrary ClassLoader.java 1827]                                                                             
  [java.lang.Runtime load0 Runtime.java 809]                                                                                            
  [java.lang.System load System.java 1086]                                                                                              
  [com.sun.glass.utils.NativeLibLoader loadLibraryFullPath NativeLibLoader.java 201]                                                    
  [com.sun.glass.utils.NativeLibLoader loadLibraryInternal NativeLibLoader.java 94]
  [com.sun.glass.utils.NativeLibLoader loadLibrary NativeLibLoader.java 39]
  [com.sun.webkit.WebPage lambda$static$0 WebPage.java 133]
  [java.security.AccessController doPrivileged AccessController.java -2]       
  [com.sun.webkit.WebPage <clinit> WebPage.java 132]                                                                                    
  [javafx.scene.web.WebEngine <init> WebEngine.java 881]                                                                                
  [javafx.scene.web.WebEngine <init> WebEngine.java 868]                                                                                
  [javafx.scene.web.WebView <init> WebView.java 273]                                                                                    
  [javafx.scene.web.WebViewBuilder build WebViewBuilder.java 60]                                                                        
  [sun.reflect.NativeMethodAccessorImpl invoke0 NativeMethodAccessorImpl.java -2]
  [sun.reflect.NativeMethodAccessorImpl invoke NativeMethodAccessorImpl.java 62]
  [sun.reflect.DelegatingMethodAccessorImpl invoke DelegatingMethodAccessorImpl.java 43]
  [java.lang.reflect.Method invoke Method.java 498]
  [sun.reflect.misc.Trampoline invoke MethodUtil.java 71]
  [sun.reflect.GeneratedMethodAccessor2 invoke nil -1]
  [sun.reflect.DelegatingMethodAccessorImpl invoke DelegatingMethodAccessorImpl.java 43]
  [java.lang.reflect.Method invoke Method.java 498]
  [sun.reflect.misc.MethodUtil invoke MethodUtil.java 275]
  [javafx.fxml.JavaFXBuilder$ObjectBuilder build JavaFXBuilderFactory.java 270]
  [javafx.fxml.FXMLLoader$ValueElement processEndElement FXMLLoader.java 763]
  [javafx.fxml.FXMLLoader processEndElement FXMLLoader.java 2823]
  [javafx.fxml.FXMLLoader loadImpl FXMLLoader.java 2532]
  [javafx.fxml.FXMLLoader loadImpl FXMLLoader.java 2441]
  [javafx.fxml.FXMLLoader load FXMLLoader.java 2409]
  [cognitect.rebl.ui$init$fn__15791 invoke ui.clj 407]
  [clojure.lang.AFn run AFn.java 22]
  [com.sun.javafx.application.PlatformImpl lambda$null$5 PlatformImpl.java 295]
  [java.security.AccessController doPrivileged AccessController.java -2]
  [com.sun.javafx.application.PlatformImpl lambda$runLater$6 PlatformImpl.java 294]
  [com.sun.glass.ui.InvokeLaterDispatcher$Future run InvokeLaterDispatcher.java 95]
  [com.sun.glass.ui.gtk.GtkApplication _runLoop GtkApplication.java -2]
  [com.sun.glass.ui.gtk.GtkApplication lambda$null$10 GtkApplication.java 245]
  [java.lang.Thread run Thread.java 748]]}
didibus commented 5 years ago

It worked with the Zulu OpenJDK, here is how to do it:

NOTE THIS IS FOR A JDK 8 INSTALL, I did not try any other version

  1. Download the .tar.gz archive here (adapt to your architecture as needed): https://www.azul.com/downloads/zulu-community/?&version=java-8-lts&os=linux&architecture=x86-64-bit&package=jdk-fx
  2. Extract it to a folder inside ~/bin or wherever you prefer. The archive has a top level folder already, so don't double folder it.
  3. Edit your .bashrc or .zshrc or wtv shell rc file you use, so that you add in it:
    export PATH=~/bin/zulu8.40.0.25-ca-fx-jdk8.0.222-linux_x64/bin:$PATH
    export JAVA_HOME=~/bin/zulu8.40.0.25-ca-fx-jdk8.0.222-linux_x64/
  4. Adapt your paths as needed.

That's it, now launching with clj will pick up the Zulu JVM, and OpenJFX should be availaible again.