B4J Question How to create a jar for Linux?

Locutus

Member
Licensed User
Longtime User
I created a simple console server applet in B4J which runs fine under Windows but fails under Linux stating version differences and missing main class. I could not find a procedure for creating B4J jars and installing them under Linux. Is there a tutorial somewhere or relevant information?

What needs to be done to install and run a jar created in B4J in the Linux operating system?
 

Locutus

Member
Licensed User
Longtime User
The same jar file should be compatible with Windows , Mac and Linux. If you have created a console app then it depends on Java 6. Make sure that Java 6 (JRE) is installed and you are running the correct Java.

Call Java -version to print the java version.

The java version is indeed 1.6. Here is the error I got (I still had it up on screen in a console window I was surprised to find)

java -jar mysqlconsoletest.jar -cp ./Libraries/
Exception in thread "main" java.lang.UnsupportedClassVersionError: anywheresoftware/b4a/randomaccessfile/AsyncStreams : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
......Cut..........
at b4j.example.main.<clinit>(main.java:10)
Could not find the main class: b4j.example.main. Program will exit.

java -version
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1~deb7u1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
 
Upvote 0

jparkerri

Member
Licensed User
Longtime User
Installing Java 7 fixed the problem.

You will need to install Java 7. Seems like AsyncStreams was compiled with Java 7.

I have a JAR file from B4J and try to run it in Fedora 20. When I run it as "java -jar TDA.jar", I get a popup saying:
"This application requires a newer version of the Java runtime. Please download and install the latest Java runtime from java.com. Then restart the application."
It sends me to java where I download and install the indicated RPM which is jre_1.7.0_51-fcs.x86_64.
I also have the current versions of java installed. Here's the output of java -version:
java version "1.7.0_51"
OpenJDK Runtime Environment (fedora-2.4.5.1.fc20-x86_64 u51-b31)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

The jar runs fine on WIn7 where it was made.

The version on WIn7 is:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)


What else do I need to make it run on Linux? Thanks.
 
Upvote 0
Top