JPro-one / jpro-routing

Small web-framework for JPro
https://www.jpro.one
Apache License 2.0
6 stars 0 forks source link

Why jpro App can't be run using bundle JavaFX in JDK/JRE? #6

Open ctoabidmaqbool opened 1 year ago

ctoabidmaqbool commented 1 year ago

I use Zulu Java + JavaFX for all of my apps. jPro not runs with bundle JavaFx. Why not it simply ignores bundle Javafx and use it own JavaFX?

Any why to run jpro with bundle jdk by ignoring bundle jdk simpley?

D:\MyApp>set JAVA_HOME=D:\Programs\zulu17.34.19-ca-fx-jdk17.0.3-win_x64
D:\MyApp>set PATH=%JAVA_HOME%\bin;%PATH%
D:\MyApp>set GRADLE_HOME=D:\Programs\gradle-7.3.3-bin
D:\MyApp>set PATH=%GRADLE_HOME%\bin;%PATH%

D:\MyApp>gradle jproRun

> Task :MyApp:compileJava
Note: D:\MyApp\src\main\java\com\gluonhq\charm\down\plugins\impl\DesktopReceiptBillService.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :MyApp:compileAllReports
28 designs compiled in 5629 ms
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] c.g.c.b.i.Finalizer - Couldn't access Thread.inheritableThreadLocals. Reference finalizer threads will inherit thread local values.
[info] play.api.Play - Application started (Prod) (no global state)
[info] p.c.s.AkkaHttpServer - Enabling HTTP/2 on Akka HTTP server...
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /[0:0:0:0:0:0:0:0]:8081
[info] c.jpro.activity - Starting the server
[info] c.j.i.s.Initializer$ -  *** Starting JPro: https://www.jpro.one/ ***
[info] c.j.i.s.Initializer$ - OS: Windows 10
[info] c.j.i.s.Initializer$ - JPro: 2022.1.5
[info] c.j.i.s.Initializer$ - Java version: 17.0.3
[info] c.j.i.s.Initializer$ - JVM: 17.0.3 Azul Systems, Inc.
[info] c.j.i.s.Initializer$ - JavaFX jar: jrt:/javafx.graphics
[info] c.j.i.s.Initializer$ - redirected OUT / ERR
[info] c.j.i.s.Initializer$ - installed SLF4JBridge
[error] c.j.i.s.Initializer$ - JavaFX isn't loaded by the SystemClassLoader. This typically happens, when using a JDK/JRE which bundles JavaFX. Please use a JDK/JRE which does not bundle JavaFX.
[info] p.a.i.l.c.CoordinatedShutdownSupport - Starting synchronous coordinated shutdown with ServerStoppedReason reason and 2147508000 milliseconds timeout
<============-> 93% EXECUTING [10m 17s]
> :MyApp:jproRun
ctoabidmaqbool commented 1 year ago

If I use JDK which not bundle JavaFx code not compiles as Javafx libs not found, I simple don't want to use javafx libs or plugins in gradle.build file as it's included in zulu jdk

FlorianKirmaier commented 1 year ago

JPro provides its own JavaFX Fork. It is not possible to start these JDK/JREs without its bundled JavaFX.

In my opinion, it's bad practice to use these JDKs. It has the big disadvantage that changing the JavaFX version is much more complicated.

It should be simple to just switch the JDK/JRE.

ctoabidmaqbool commented 1 year ago

@FlorianKirmaier In my specific case, I use bundle Javafx with JDK (Zule) for desktop Applications. Because It's more easy to use bundle JFX and there is no need to add Javafx libs in class path (witch is little bit difficult). e.g. I am not using module.info and just add libs to class path.

In simple terms, I am not using javafx plugins noir adding javafx libs in dependencies tree for desktop applications. From now it's oky.

But jpro app not run (jproRun) with/without bundle jdk. Until I add javafx plugins or add javafx libs to depedencies?

I have two questions:

  1. Why jpro not use bundle JFX (zulu) if it's needed any?
  2. If jpro have it's own implementation of javafx libs then why it's needed other libs whether it's javafx mobile plugins or libs simply?
ctoabidmaqbool commented 1 year ago

For compiling code it's needed javafx libs should be on class path. I think jpro own javafx libs are included at runtime not compile time?

FlorianKirmaier commented 1 year ago

1.) JPro requires its own JavaFX build. 2.) Actually JPro doesn't need other JavaFX-jars. But when you compile, you have to compile against some JavaFX Jars. Theoretically, you could also compile against the JPro JavaFX Jars. But usually, it's more convenient to just compile against the official JavaFX-jars - because we are binary compatible to them.

If you compile your project on ZuluFX, and then run it on another JDK/JRE with JPro, it should work without adding any javafx-jars to the dependency. But that's complicated. Usually, it's easier to just add JavaFX as a dependency.