B4J Question Upgraded JDK8 to JDK11

rdkartono

Member
Licensed User
Just today, my Eclipse upgraded automatically, then suddenly it wont open using existing JDK 8.
I am forced to upgrade to JDK 11.
Installed from Oracle JDK 11, and eclipse back to normal.

However, I examined that :
1. When exporting library to XML, Doclet showed some red warning :
javadoc: warning - The old Doclet and Taglet APIs in the packages
com.sun.javadoc, com.sun.tools.doclets and their implementations
are planned to be removed in a future JDK release. These
components have been superseded by the new APIs in jdk.javadoc.doclet.
Users are strongly recommended to migrate to the new APIs.


2. Then I tried to recompile a project with JDK 11 , downloaded from B4X.
Note : This project is created using B4XPages, and was running normally with JDK 8. This project use library from number 1 above.
I noticed B4J only can compile using javac OpenJDK 11 from this site.
When I tried using javac from Oracle JDK 11 , B4J showed some missing.

3. I ran the program from B4J in Debug and Release, can show normally.

4. But when I double click released JAR, nothing showed. It's like the JAR is not executing
I put JAVA_HOME environment variable and System Path of WIndows 10 to B4J JDK 11 path .

From some website , there is a hint to add OpenJDKPath environment variable , I also set to B4J JDK 11 path
From some website, also there is a hint to add PATH_TO_FX environment variable, I also set to B4J JDK 11 javafx lib path
However this released JAR is not executing .
Rebooting PC also has been done, but no affect.


5. From B4J, I tried to compile to Standalone Package.
The EXE result also wont show anything
then I tried run_debug.bat , and showed this :

C:\Users\rdkartono\Documents\B4J project\VC520PCControl\B4J\Objects\temp\build>cd bin

C:\Users\rdkartono\Documents\B4J project\VC520PCControl\B4J\Objects\temp\build\bin>java.exe @release_java_modules.txt -m b4j/gtc.vc520pccontrol.main
WARNING: Unknown module: javafx.controls specified to --add-opens
WARNING: Unknown module: javafx.base specified to --add-opens
WARNING: Unknown module: javafx.controls specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.controls specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.controls specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: java.desktop specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.base specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.base specified to --add-opens
Error: Unable to load main class gtc.vc520pccontrol.main in module b4j
java.lang.NoClassDefFoundError: javafx/application/Application

C:\Users\rdkartono\Documents\B4J project\VC520PCControl\B4J\Objects\temp\build\bin>pause
Press any key to continue . . .


Strange is, I tried a very new B4XPage project, which only showing a button and message box Hello, it can run very normal both in JAR and in Standalone EXE

What might wrong ?

Please advice. I felt pissed clicking Eclipse auto upgrade in the first place, causing me these unnecessary problems .
 

rdkartono

Member
Licensed User
I add compilation log for B4J Standalone :

B4JPackager11 Version 1.21
Exe name: VC520PCControl.exe
InputJar: C:\Users\rdkartono\Documents\B4J project\VC520PCControl\B4J\Objects\VC520PCControl.jar
Running: C:\Users\RDKART~1\DOCUME~1\B4JPRO~1\VC520P~1\B4J\Objects\temp\FindDosPath.exe
Running: C:\B4X Java\jdk-11.0.1\bin\jar
Package name: gtc.vc520pccontrol
Running: C:\B4X Java\jdk-11.0.1\bin\jdeps
.
Explicitly excluded modules: [javafx.web]
Included modules: [java.base]
Running: C:\B4X Java\jdk-11.0.1\bin\javac
Running: C:\B4X Java\jdk-11.0.1\bin\jar
.
Running: C:\B4X Java\jdk-11.0.1\bin\jlink
.
.
.
.
Running: C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\csc.exe
Running: explorer.exe
Done!
 
Upvote 0

agraham

Expert
Licensed User
Java 11 and later don't run from double clicking a jar, you need to use the B4J packager to run a jar standalone.

I also use a small app made with Basic4ppc to run later jars by copying and renaming the exe to the same name as the jar. It needs an environmental variable OpenJdkPath set to point to the JDK folder. Mine is OpenJdkPath=C:\jdk-14.0.1

it can run very normal both in JAR
It's probably running under Java 8 if you still have it installed and it is not erroring as it is simple program that doesn't use any later features.

If you are using BADoclet to create library xmls you need to continue using Java 8 as it producess malformed xml files under JDK11 and later. Erel told me that he will fix it sometime.
 

Attachments

  • RunSelfNamedJarOpenJdk_v4.zip
    92.3 KB · Views: 57
Upvote 0

rdkartono

Member
Licensed User
Sorry for long reply. I was out of office for two weeks site work.

So I decided to revert back to Java 8, and Eclipse 4.16.
I felt too much risk upgrading to Java 11 for now.
 
Upvote 0

KMatle

Expert
Licensed User
So I decided to revert back to Java 8, and Eclipse 4.16.
I felt too much risk upgrading to Java 11 for now.

Neither Eclipse nor Java 11 (downloaded from Oracle directly) has something to do with B4x. Please don't mix it.

As Erel mentioned you need to download the Java 11 package from B4x.com. There's no risk at all as I and thousands of others here use Java 11 for some time. Just create an extra folder, put the Java 11 package in it and set the path. Very simple.

1605516497884.png
 
Upvote 0

rdkartono

Member
Licensed User
Neither Eclipse nor Java 11 (downloaded from Oracle directly) has something to do with B4x. Please don't mix it.

As Erel mentioned you need to download the Java 11 package from B4x.com. There's no risk at all as I and thousands of others here use Java 11 for some time. Just create an extra folder, put the Java 11 package in it and set the path. Very simple.

View attachment 103031
Hi KMatle,

Sorry for the very long reply .
I did that too. But maybe my Eclipse library dont like java 11.

As I said before, the newly created B4J App using Java11, can run normally .
But previously coded app which contain library and codes from java 8, cant run .

So as I said, I back to Java 8, and reinstall Eclipse 4.16, and everything back to normal.
 
Upvote 0
Top