B4J Tutorial [IoT] Raspberry 2 & B4J from the scratch...

ilan

Expert
Licensed User
Longtime User
Ok i understand now what you mean. The b4j bridge can use different java version. So i start the bridge with a version that support javafx and like this i will be able to run b4j ui-apps.
 
Last edited:

Roycefer

Well-Known Member
Licensed User
Longtime User
If you are using Raspbian installed from NOOBS, then Java 8u0 comes pre-installed. Just use that. You can type
B4X:
java -version
in the terminal to see what Java version is installed. You can have whatever Java version you like on your PC, you only need Java 8u6 (or below) on the RasPi.
 

ilan

Expert
Licensed User
Longtime User

i installed java jdk 1.7 and run it but when i debug my simple UI app nothings happens. also in logs nothing happens.
and bridge is connected
 

Roycefer

Well-Known Member
Licensed User
Longtime User
If you didn't uninstall Java 8, then Java 8 will probably override your Java 7 installation. Do the "java -version" terminal command I posted to see what Java version is reported. Also, I wouldn't use Java 7 if all you're trying to do is get JavaFX to work. Use Java 8u0. It comes with the Raspbian image. If I recall, Java 7 doesn't come with JavaFX built-in, you have to install JavaFX separately. Java 8 has it built-in (up to version 8u6 for ARM).
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
If you didn't uninstall Java 8, then Java 8 will probably override your Java 7 installation
That's not correct. You do not need to uninstall the existing java or install the new one. Just copy the files to the board and run b4j-bridge with the full path to java: [IoT] Linux Embedded Boards - Gettings started

Are you able to run a non-ui app?

You should use java 8u6.
 

ilan

Expert
Licensed User
Longtime User
Just copy the files to the board and run b4j-bridge with the full path to java

just download the java version and copy the files doesnot work for me.

i installed java 1.7.0 with: sudo apt-get install oracle-java7-jdk

and tried to run a ui-app but nothing happend.

i am able to run a non-ui app with java 1.8.0 as you can see in the image



when i try t download the java version 8u6 (i donwload all linux versions jdk&jre because you did not said what version i should download and still no one worked)

when i copy the files and try to run the b4j-bridge with java 8u6 or even if i only ask for -version i get error

error 1: is "Permission denied"

then i changed the folder rights (incl all folder and files inside) to rwxr-xr-x

error 2: then i get this error: Exec format error



i waste maybe 8 hours on it. so i give up, i hope there will be support for ui-apps in the future since this will make those cheap boards really usefull for us.
i know we can run non-ui server apps on it but i think run real programs would make raspberry much more interesting for us b4x community.

if someone was able to run ui-app i would be happy to get more informations.
 

ta1dr

Member
Licensed User
Longtime User
I have same problem..
I bought RB pi 2 , 7" touch screen bla bla for my R&D project
project like a HMI I want read modbus ( LPG massflow meter) and display and write excel files
I wrote code B4J it works on PC but I want to work on RB2
Waiting for results with hope
 

ilan

Expert
Licensed User
Longtime User
You do not need to install Java. Follow the steps from this tutorial: https://www.b4x.com/android/forum/threads/60430/#content

Copy the tar file and unpack it.

as i said i have copied the files but i could not load the bridge with the java version i have downloaded.

first error was: you have no permission...
then i changed the directory rights and then i had another error: Exec format error

i have downloaded all jre linux java files and jdk linux java files and nothing worked.
only if i install a java version i can run b4j with that java version and thats why i tried java 1.7 (this is the only version i have installed)
all other versions i download then copy to my rsp2 via winSCP and try to run via putty

but i get errors!!
 

ta1dr

Member
Licensed User
Longtime User
thanks Erel
I download tar file on my pc and copy USB mem
after plud USB mem RB2 I see tar file ...this ok
but I didnt understand
copy tar file to RB2 download folder and after sudo tar bla bla
or which why..( sorry I am newbee for RB 2 also JAVA)

thanks again
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
then i changed the directory rights and then i had another error: Exec format error
You need to download the arm java.

Try this one:
1. Go to this page: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html#
2. Find this one: Linux ARM v6/v7 Hard Float ABI :


Note that the title is NOT Java SE Development Kit 8u60.

@ta1dr a tar file is like a zip file. You need to unpack it. This is done with the command:
B4X:
tar -xf <tar name>
You need to run it from a terminal. Press Tab to complete the file name (after you enter a few characters).

 

ilan

Expert
Licensed User
Longtime User
ok, i have downloaded the same file as you show in the image above jdk-8-linux-arm-vfp-hflt.tar.gz (NOT ...Kit 8u60)

then i connect to the bridge with this java version and when i run in debug mode nothing happens. no logs... nothing



what am i doing wrong??
 

ta1dr

Member
Licensed User
Longtime User
Thank you Erel for patiently answered I will try when goto workshop...
 

KMatle

Expert
Licensed User
Longtime User
sudo stands for super user do, which is the admin of the RB. The normal user "pi" has just basic rights and may not change deeper system settings. So almost all commands start with sudo xxxx (like to start the B4J-bridge which I show later)

Important:

The user "pi" ist a Standard user like in windowd (not admin) which is allowed to create directories and some other things ONLY in his user directories.

Best practice: Start every command with sudo

To Keep it simple: Please use the Noobs package (not "some Image I found on the net"). With this I had no Problems (even Java was updated to 1.8 automatically).
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…