B4J Question How to run B4J .jar application on linux

vecino

Well-Known Member
Licensed User
Longtime User
Hello, I can run the applications created with B4J using the command:
java -jar something.jar
In linux, too.
But, if it has been created with B4J it cannot be run. It always shows the error that it needs javafx runtime.
What do I have to do to run in linux the applications created with B4J?
Thank you.
 

MichalK73

Well-Known Member
Licensed User
Longtime User
Problems:
1. You have a GUI application and you want to run it in linux console mode.
2. Wrong java version on linux
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Thanks, folks.
I've created a menu entry to run it and it doesn't work either.
I don't know if the reason is because it's openjdk-11
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Are executables (.jar) created with B4J compatible with windows and linux?
Is there anything to consider when compiling?
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hi, sorry for my lack of information, but I just don't know what to say. If I run it from the graphical environment (gnome) it doesn't do anything, and if I run it from the terminal, it shows the error that javafx is missing.

As for B4JPackager, it's that the instructions and files are not at all similar to the ones in the post and the downloaded zip file, so I don't know how it works.
In short, what I want is to run in linux the .jar application created with B4J. (If it's possible).

 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hello, I have installed different "java" and with all of them I get the same result.
That's why I asked before if it's necessary to take something into account when compiling from B4J to run later in linux graphical environment.

 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Well, I've uninstalled everything related to java.
I installed openjdk11, and it doesn't work.
I installed oraclejdk8, it does work.
Can it only work with oraclejdk8, and no other?
Thanks to all of you.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Technically, if all you are doing is running your JavaFX application, then you just need the JRE, not the complete JDK. With Java 8, the JavaFX is bundled. With Java 11, JavaFX is a separate entity and has to be installed on it's own. The B4J page on Anywhere Software's website offers a bundled download of JDK11+JavaFX. Under 8, a simple java -jar application.jar would launch an Java application. With 11, if you want to use the command line (and not the packager), you'll have to add some more parameters. For example, on Windows, I have the above mentioned Java 11 bundle installed in C:\OpenJDK. In order to launch a JavaFX application I would need to run
C:\OpenJDK\jdk-11.0.1\bin\java.exe --module-path C:\OpenJDK\jdk-11.0.1\javafx\lib --add-modules ALL-MODULE-PATH -jar application.jar
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I have jdk and javafx 11 installed, but it doesn't work.
The only thing that's worked so far is oracle 8, I don't know why.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I have jdk and javafx 11 installed
And how do you start your jar with Java 12? If you just do java -jar app.jar, it’s not going to work. See my post above
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
And how do you start your jar with Java 12? If you just do java -jar app.jar, it’s not going to work. See my post above
You mean this?
C:\OpenJDK\jdk-11.0.1\bin\java.exe --module-path C:\OpenJDK\jdk-11.0.1\javafx\lib --add-modules ALL-MODULE-PATH -jar application.jar
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Yes. Just use your file paths, not mine. Oh yea, Java 12 is a typo. I’m all thumbs on phones
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…