B4J Question How to run JAR from command line in Windows?

wimpie3

Well-Known Member
Licensed User
Longtime User
My app works perfectly in B4J (Windows), in both debug and release mode.

However, I can't seem to run the JAR file outside of B4J.

I'm trying this:
B4X:
C:\java\jdk-14.0.1\jdk-14.0.1\bin\javac.exe -jar C:\myapp\B4J\Objects\myapp.jar

JDK 14.0.1 is also the JDK I'm using in B4J.

I get this error:
B4X:
Error: JavaFX runtime components are missing, and are required to run this application

How is it possible the file runs perfectly inside B4J, but not using the command line?
 

Swissmade

Well-Known Member
Licensed User
Longtime User
My app works perfectly in B4J (Windows), in both debug and release mode.

However, I can't seem to run the JAR file outside of B4J.

I'm trying this:
B4X:
C:\java\jdk-14.0.1\jdk-14.0.1\bin\javac.exe -jar C:\myapp\B4J\Objects\myapp.jar

JDK 14.0.1 is also the JDK I'm using in B4J.

I get this error:
B4X:
Error: JavaFX runtime components are missing, and are required to run this application

How is it possible the file runs perfectly inside B4J, but not using the command line?
You missing JavaFX in version 14

Use this, It is with JavaFX


Maybe also set the Path so Windows can find your Java.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
How is it possible the file runs perfectly inside B4J, but not using the command line?
B4J adds all the required modules.

The simplest way to run the app is by building a standalone package.

Other ways:
1. Compile with Java 8. This will create an executable jar (depends on Java 8 being installed and configured as the default Java).
2. I don't recommend it but if you don't want a standalone package and are running it on a computer with B4J Java then you can follow these instructions: https://www.b4x.com/android/forum/t...les-to-minimize-disk-usage.121642/post-760317
 
Upvote 0

wimpie3

Well-Known Member
Licensed User
Longtime User
B4J adds all the required modules.

The simplest way to run the app is by building a standalone package.

Other ways:
1. Compile with Java 8. This will create an executable jar (depends on Java 8 being installed and configured as the default Java).
2. I don't recommend it but if you don't want a standalone package and are running it on a computer with B4J Java then you can follow these instructions: https://www.b4x.com/android/forum/t...les-to-minimize-disk-usage.121642/post-760317
Option number 2 worked perfectly, thank you Erel!
 
Upvote 0
Top