Difference between revisions of "How to install JAVA JDK"

[quality revision] [pending revision]
m (Replaced content with "<noinclude> {{ArticleMainWriter| YvesC}} {{ReviewersList | NathalieS, BernardP, ChristopheP}} {{ArticleApprovedVersion | Jean-ChristopheT | Nobody | No previous approved v...")
(Tag: Replaced)
m
 
Under construction.png Coming soon

The goal of this page is to describe the way to install the openJDK on your STM32 MPU board and your desktop (native), in a Distribution Package Environment. It is the "open Standard Edition Java Development Kit" installation process. According to the openstlinux-weston software architecture, we use xwayland for all Java application based on X11, means AWT/SWING Java display/graphical applications. By default the Java Development Kit is installed on the rootfs partition of the target.

1 Prerequisites[edit]

2 Add the yoctoproject meta-java in your environment[edit]

JAVA for Linux-based system for embedded system is available as a meta data in yoctoproject. The tar file can be loaded from the Internet site yoctoproject [1]
Download the file release linked to your yocto baseline (example meta-java-rocko.tar.gz for the yocto branch rocko). You are able to select the last commit on the right branch, in the "summary" menu option on the "index:meta-java" page.

  • Untar the file in your distribution software environment :

In the following example we install the "meta-java" component for yocto rocko released in the "meta-st" folder. The <TOP-DIR> is the folder you installed your Distribution Package.

PC $> cd <TOP-DIR>/meta-st
PC $> tar -xf  meta-java-rocko.tar.gz

  • If not done, setup your build environment
PC $> cd <TOP-DIR>
PC $> source ./meta-st/script/envsetup.sh 
(Select for the DISTRO openstlinux-weston and for MACHINE stm32mp1)



  • Add the meta layer in your yocto environment
PC $> cd <TOP-DIR>/build-openstlinuxweston-stm32mp1
PC $> bitbake-layers add-layer <top-DIR>/meta-st/meta-java-rocko


  • Define at least the following variables in a distro include file or local.conf
(<TOP-DIR>/build-openstlinuxweston-stm32mp1/conf/local.conf)

#Possible provider: cacao-initial-native and jamvm-initial-native
PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native"

#Possible provider: cacao-native and jamvm-native
PREFERRED_PROVIDER_virtual/java-native = "jamvm-native"

#Optional since there is only one provider for now
PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"



  • Include in your image the openjdk-8 component
PC $> cd <TOP-DIR>/meta-st/meta-st-openstlinux/recipes-st/images

Edit the file st-image-weston.bb and add the following line under CORE_IMAGE_EXTRA_INSTALL
openjdk-8 \

  • Build the image
PC $> cd <TOP-DIR>/build-openstlinuxweston-stm32mp1
PC $> bitbake st-image-weston

3 Compil and execute some demo[edit]

The target has to be connected on ethernet, the target IP address <YOUR_TARGET_IP> is read with the following command to execute in a linux weston console.

Board $> ifconfig 





  • Go to deb package folder :
PC $> cd <TOP-DIR>/build-openstlinuxweston-stm32mp1/tmp-glibc/deploy/deb/cortexa7hf-neon-vfpv4

  • Copy the openjdk-8-demo package on the target :
PC $> scp openjdk-8-demo_102b14-r0_armhf.deb  root@<YOUR_TARGET_IP>:/home/root/

  • Install the openjdk-8-demo package  :

On a target linux console, executes the command :

Board $> dpkg -i openjdk-8-demo_102b14-r0_armhf.deb

  • forkjoin benchmark Java application
Board $> cd /usr/lib/jvm/openjdk-8/sample/forkjoin/mergesort
Board $> javac MergeDemo.java
Board $> java MergeDemo 200 100 3 1 1 3
Running with parameters: 200 100 3 1 1 3
Time in milliseconds. Y-axis: number of elements. X-axis parallelism used.
            1    2    3
    200:   10    7    8
    300:   17   12   12
    400:   20   14   14
  Total:   47   33   34

  • SampleTree Java application

Read the README.txt file for details

Board $> cd /usr/lib/jvm/openjdk-8/demo/jfc/SampleTree
Board $> java -jar SampleTree.jar

Sampletree.png

4 Reference list[edit]

  1. http://git.yoctoproject.org/cgit/cgit.cgi/meta-java/commit/ "link to get the Yocto meta-java tar file""
<noinclude>

{{ArticleMainWriter| YvesC}}
{{ReviewersList | NathalieS, BernardP, ChristopheP}}
{{ArticleApprovedVersion | Jean-ChristopheT | Nobody | No previous approved version | Automatic approval (article under construction) | 19Feb’19}}
[[The goal of this page is to describe the way to install the openJDK on your STM32 MPU board and your desktop (native), in a Distribution Package Environment.
It is the "open Standard Edition Java Development Kit" installation process.
According to the openstlinux-weston software architecture, we use '''xwayland''' for all Java application based on '''X11''', means '''AWT/SWING''' Java display/graphical applications.
By default the Java Development Kit is installed on the rootfs partition of the target.  

= Prerequisites =
*one MPU board
*the [[STM32MP1 Distribution Package]]
*an Internet connection
*a Computer with Linux OS Ubuntu

= Add the yoctoproject meta-java in your environment =
JAVA for Linux-based system for embedded system is available as a meta data in yoctoproject.
The tar file can be loaded from the Internet site yoctoproject  <ref>http://git.yoctoproject.org/cgit/cgit.cgi/meta-java/commit/ "link to get the Yocto meta-java tar file""</ref>
<br>

Download the file release linked to your yocto baseline (example '''meta-java-rocko.tar.gz''' for the yocto branch '''rocko''').
You are able to select the last commit on the right branch, in the '''"summary"''' menu option on the '''"index:meta-java"''' page.

* Untar the file in your distribution software environment :
In the following example we install the '''"meta-java"''' component for yocto rocko released in the '''"meta-st"''' folder.
The <TOP-DIR> is the folder you installed your Distribution Package.
 {{PC$}} cd <TOP-DIR>/meta-st
 {{PC$}} tar -xf  meta-java-rocko.tar.gz

* If not done, setup your build environment
 {{PC$}} cd <TOP-DIR>

 {{PC$}} source ./meta-st/script/envsetup.sh 
 (Select for the DISTRO openstlinux-weston and for MACHINE stm32mp1)

{{ReviewsComments|BPU: Ok for a first trial but it might be useful to indicate the way to do for a final integration (or to point on THE article)}}
{{ReviewsComments|YvesCOPPEAUX: It is the suggested process by Yocto to add/integrate a new software component to the distribution, it is up to the customer to create a new distribution included the new components, BUT we have do verify that this new component (here JAVA) is properly integrated to be include automatically at the creation of the new distribution, there is a dedicated page under construction here  [[STM32MP1 Distribution Package#Creating your own Linux distribution]]}} 

* Add the meta layer in your yocto environment 
 {{PC$}} cd <TOP-DIR>/build-openstlinuxweston-stm32mp1
 {{PC$}} bitbake-layers add-layer <top-DIR>/meta-st/meta-java-rocko

{{ReviewsComments|BPU: Ok for a first trial but it might be useful to indicate the way to do for a final integration (or to point on THE article). Proper way should be to define a new distro or to add this to ST distro}}
{{ReviewsComments|YvesCOPPEAUX:IDEM...}}
* Define at least the following variables in a distro include file or local.conf 
 (<TOP-DIR>/build-openstlinuxweston-stm32mp1/conf/local.conf)

 #Possible provider: cacao-initial-native and jamvm-initial-native
 PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native"

 #Possible provider: cacao-native and jamvm-native
 PREFERRED_PROVIDER_virtual/java-native = "jamvm-native"

 #Optional since there is only one provider for now
 PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"

{{ReviewsComments|BPU: Ok for a first trial but it might be useful to indicate the way to do for a final integration (or to point on THE article). Proper way should be to define a new layer and to add a bbappend on st-image-weston.bb}}
{{ReviewsComments|YvesCOPPEAUX: Ok to rework this, but I'm not fluent in Yocto and I don't know the right process, I thought to add these lines to the file /meta-st-openstlinux/conf/distro/include/openstlinux.inc}}

* Include in your image the '''openjdk-8''' component
 {{PC$}} cd <TOP-DIR>/meta-st/meta-st-openstlinux/recipes-st/images

 Edit the file st-image-weston.bb and add the following line under CORE_IMAGE_EXTRA_INSTALL
 openjdk-8 \

* Build the image
 {{PC$}} cd <TOP-DIR>/build-openstlinuxweston-stm32mp1
 {{PC$}} bitbake st-image-weston

=Compil and execute some demo=
The target has to be connected on ethernet, the target IP address <YOUR_TARGET_IP> is read with the following command to execute in a linux weston console.

 {{Board$}} ifconfig 

{{ReviewsComments|BPU: Why you don't simply flash the board with the built image ?}} 
{{ReviewsComments|YvesCOPPEAUX: The debug&test components have to be delivered in packages only, to install/remove dynamically, but we can also create dedicated image there is a example of image in the meta-java folder /meta-java/recipes-images/images/java-test-image.bb}} 

* Go to deb package folder :
 {{PC$}} cd <TOP-DIR>/build-openstlinuxweston-stm32mp1/tmp-glibc/deploy/deb/cortexa7hf-neon-vfpv4

* Copy the '''openjdk-8-demo''' package on the target :
 {{PC$}} scp openjdk-8-demo_102b14-r0_armhf.deb  root@<YOUR_TARGET_IP>:/home/root/

* Install the '''openjdk-8-demo''' package  :
On a target linux console, executes the command :
 {{Board$}} dpkg -i openjdk-8-demo_102b14-r0_armhf.deb

* '''forkjoin''' benchmark Java application
 {{Board$}} cd /usr/lib/jvm/openjdk-8/sample/forkjoin/mergesort
 {{Board$}} javac MergeDemo.java
 {{Board$}} java MergeDemo 200 100 3 1 1 3
 Running with parameters: 200 100 3 1 1 3
 Time in milliseconds. Y-axis: number of elements. X-axis parallelism used.
             1    2    3
     200:   10    7    8
     300:   17   12   12
     400:   20   14   14
   Total:   47   33   34

* '''SampleTree''' Java application
Read the README.txt file for details
 {{Board$}} cd /usr/lib/jvm/openjdk-8/demo/jfc/SampleTree
 {{Board$}} java -jar SampleTree.jar

[[File:Sampletree.png|link=]]

= Reference list =<references />

<noinclude>

[[Category:How to customize software]]</noinclude>

{{UnderConstruction}}
(One intermediate revision by the same user not shown)
Line 1: Line 1:
  +
The goal of this page is to describe the way to install the openJDK on your STM32 MPU board and your desktop (native), in a Distribution Package Environment.
  +
It is the "open Standard Edition Java Development Kit" installation process.
  +
According to the openstlinux-weston software architecture, we use '''xwayland''' for all Java application based on '''X11''', means '''AWT/SWING''' Java display/graphical applications.
  +
By default the Java Development Kit is installed on the rootfs partition of the target. 
  +
  +
= Prerequisites =
  +
*one MPU board
  +
*the [[STM32MP1 Distribution Package]]
  +
*an Internet connection
  +
*a Computer with Linux OS Ubuntu
  +
  +
= Add the yoctoproject meta-java in your environment =
  +
JAVA for Linux-based system for embedded system is available as a meta data in yoctoproject.
  +
The tar file can be loaded from the Internet site yoctoproject  <ref>http://git.yoctoproject.org/cgit/cgit.cgi/meta-java/commit/ "link to get the Yocto meta-java tar file""</ref>
  +
<br>
  +
Download the file release linked to your yocto baseline (example '''meta-java-rocko.tar.gz''' for the yocto branch '''rocko''').
  +
You are able to select the last commit on the right branch, in the '''"summary"''' menu option on the '''"index:meta-java"''' page.
  +
  +
* Untar the file in your distribution software environment :
  +
In the following example we install the '''"meta-java"''' component for yocto rocko released in the '''"meta-st"''' folder.
  +
The <TOP-DIR> is the folder you installed your Distribution Package.
  +
{{PC$}} cd <TOP-DIR>/meta-st
  +
{{PC$}} tar -xf  meta-java-rocko.tar.gz
  +
  +
* If not done, setup your build environment
  +
{{PC$}} cd <TOP-DIR>
  +
{{PC$}} source ./meta-st/script/envsetup.sh
  +
(Select for the DISTRO openstlinux-weston and for MACHINE stm32mp1)
  +
  +
{{ReviewsComments|BPU: Ok for a first trial but it might be useful to indicate the way to do for a final integration (or to point on THE article)}}
  +
{{ReviewsComments|YvesCOPPEAUX: It is the suggested process by Yocto to add/integrate a new software component to the distribution, it is up to the customer to create a new distribution included the new components, BUT we have do verify that this new component (here JAVA) is properly integrated to be include automatically at the creation of the new distribution, there is a dedicated page under construction here  [[STM32MP1 Distribution Package#Creating your own Linux distribution]]}}
  +
  +
* Add the meta layer in your yocto environment
  +
{{PC$}} cd <TOP-DIR>/build-openstlinuxweston-stm32mp1
  +
{{PC$}} bitbake-layers add-layer <top-DIR>/meta-st/meta-java-rocko
  +
  +
{{ReviewsComments|BPU: Ok for a first trial but it might be useful to indicate the way to do for a final integration (or to point on THE article). Proper way should be to define a new distro or to add this to ST distro}}
  +
{{ReviewsComments|YvesCOPPEAUX:IDEM...}}
  +
* Define at least the following variables in a distro include file or local.conf
  +
(<TOP-DIR>/build-openstlinuxweston-stm32mp1/conf/local.conf)
  +
  +
#Possible provider: cacao-initial-native and jamvm-initial-native
  +
PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native"
  +
  +
#Possible provider: cacao-native and jamvm-native
  +
PREFERRED_PROVIDER_virtual/java-native = "jamvm-native"
  +
  +
#Optional since there is only one provider for now
  +
PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"
  +
  +
{{ReviewsComments|BPU: Ok for a first trial but it might be useful to indicate the way to do for a final integration (or to point on THE article). Proper way should be to define a new layer and to add a bbappend on st-image-weston.bb}}
  +
{{ReviewsComments|YvesCOPPEAUX: Ok to rework this, but I'm not fluent in Yocto and I don't know the right process, I thought to add these lines to the file /meta-st-openstlinux/conf/distro/include/openstlinux.inc}}
  +
  +
* Include in your image the '''openjdk-8''' component
  +
{{PC$}} cd <TOP-DIR>/meta-st/meta-st-openstlinux/recipes-st/images
  +
  +
Edit the file st-image-weston.bb and add the following line under CORE_IMAGE_EXTRA_INSTALL
  +
openjdk-8 \
  +
  +
* Build the image
  +
{{PC$}} cd <TOP-DIR>/build-openstlinuxweston-stm32mp1
  +
{{PC$}} bitbake st-image-weston
  +
  +
=Compil and execute some demo=
  +
The target has to be connected on ethernet, the target IP address <YOUR_TARGET_IP> is read with the following command to execute in a linux weston console.
  +
  +
{{Board$}} ifconfig
  +
  +
{{ReviewsComments|BPU: Why you don't simply flash the board with the built image ?}}
  +
{{ReviewsComments|YvesCOPPEAUX: The debug&test components have to be delivered in packages only, to install/remove dynamically, but we can also create dedicated image there is a example of image in the meta-java folder /meta-java/recipes-images/images/java-test-image.bb}}
  +
  +
  +
* Go to deb package folder :
  +
{{PC$}} cd <TOP-DIR>/build-openstlinuxweston-stm32mp1/tmp-glibc/deploy/deb/cortexa7hf-neon-vfpv4
  +
  +
* Copy the '''openjdk-8-demo''' package on the target :
  +
{{PC$}} scp openjdk-8-demo_102b14-r0_armhf.deb  root@<YOUR_TARGET_IP>:/home/root/
  +
  +
* Install the '''openjdk-8-demo''' package  :
  +
On a target linux console, executes the command :
  +
{{Board$}} dpkg -i openjdk-8-demo_102b14-r0_armhf.deb
  +
  +
* '''forkjoin''' benchmark Java application
  +
{{Board$}} cd /usr/lib/jvm/openjdk-8/sample/forkjoin/mergesort
  +
{{Board$}} javac MergeDemo.java
  +
{{Board$}} java MergeDemo 200 100 3 1 1 3
  +
Running with parameters: 200 100 3 1 1 3
  +
Time in milliseconds. Y-axis: number of elements. X-axis parallelism used.
  +
            1    2    3
  +
    200:  10    7    8
  +
    300:  17  12  12
  +
    400:  20  14  14
  +
  Total:  47  33  34
  +
  +
* '''SampleTree''' Java application
  +
Read the README.txt file for details
  +
{{Board$}} cd /usr/lib/jvm/openjdk-8/demo/jfc/SampleTree
  +
{{Board$}} java -jar SampleTree.jar
  +
  +
[[File:Sampletree.png|link=]]
  +
  +
= Reference list =
  +
<references />
  +
 
<noinclude>
 
<noinclude>
{{ArticleMainWriter| YvesC}}
 
{{ReviewersList | NathalieS, BernardP, ChristopheP}}
 
{{ArticleApprovedVersion | Jean-ChristopheT | Nobody | No previous approved version | Automatic approval (article under construction) | 19Feb’19}}
 
 
[[Category:How to customize software]]
 
[[Category:How to customize software]]
 
</noinclude>
 
</noinclude>
{{UnderConstruction}}
 

Attachments

Discussions