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 (Software prerequisites)
 


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]

1.1 Hardware prerequisites[edit]

  • STM32MP157x-DKx Discovery kit More info green.png Or aSTM32MP157x-EV1 Evaluation board More info green.png
  • a keyboard and a mouse connected to the board

1.2 Software prerequisites[edit]

The STM32MP1 Distribution Package must be installed on your host. To do this follow the procedure described in the Install the STM32MP1 OpenSTLinux distribution article.

Info.png The Host OS Ubuntu release 18.04 and next is required

2 The yoctoproject meta-java[edit]

JAVA for Linux-based system for embedded system is available as a meta data in Yocto project.

  • Clone following git repository into [your STM32MP1 Distribution path]/layers/meta-st/""

  PC >git clone git://git.yoctoproject.org/meta-java

Depending on the Yocto release, select the right branch. (example : branch dunfell for the ecosystem release v2.0.0 More info.png)

PC $>cd meta-java
PC $>git checkout  remotes/origin/dunfell 

You can have the list of available Yocto branch with the command :

PC $>cd meta-java
PC $>git branch -a
 *master
 remotes/origin/HEAD -> origin/master
 remotes/origin/dora
 remotes/origin/dunfell
 remotes/origin/g0hl1n/jdk14
 remotes/origin/krogoth
 remotes/origin/master
 remotes/origin/master-next
 remotes/origin/morty
 remotes/origin/pyro
 remotes/origin/rocko
 remotes/origin/sumo
 remotes/origin/thud
 remotes/origin/warrior
 remotes/origin/zeus

  • If not done, setup your build environment
PC $> cd [your STM32MP1 Distribution path]
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 [your STM32MP1 Distribution path]/build-openstlinuxweston-stm32mp1
PC $> bitbake-layers add-layer [your STM32MP1 Distribution path]/meta-st/meta-java

  • Define at least the following variables in your local.conf file.
([your STM32MP1 Distribution path]/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 [your STM32MP1 Distribution path]/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 \
  openjdk-8-demo \

  • Build the image
PC $> cd [your STM32MP1 Distribution path]/build-openstlinuxweston-stm32mp1
PC $> bitbake st-image-weston

3 Compil and execution of some JAVA demo[edit]

  • 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. To execute in a linux weston console on the board, with a keyboard and a mouse.

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

Sampletree.png

<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]]</noinclude>

{{UnderConstruction}}ClonedFrom | stm32mpu}}</noinclude>

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==
===Hardware prerequisites===
*{{Board | type=157x-DKx}} Or a{{Board | type=157x-EV1}}
* a keyboard and a mouse connected to the board

===Software prerequisites===
The STM32MP1 Distribution Package must be installed on your host. To do this follow the procedure described in the  [[STM32MP1 Distribution Package - OpenSTLinux distribution#Download|Install the STM32MP1 OpenSTLinux distribution]]  article.
{{Info|The Host OS Ubuntu release 18.04 and next is required}}

==The yoctoproject meta-java ==
JAVA for Linux-based system for embedded system is available as a meta data in Yocto project.

* Clone following git repository into ''[your STM32MP1 Distribution path]/layers/meta-st/""<pre>

  PC >git clone git://git.yoctoproject.org/meta-java</pre>

Depending on the Yocto release, select the right branch. (example : branch '''dunfell''' for the {{EcosystemRelease | revision=2.0.0}})  

 {{PC$}}cd meta-java
 {{PC$}}git checkout  remotes/origin/dunfell 

You can have the list of available Yocto branch with the command : 
 {{PC$}}cd meta-java
 {{PC$}}git branch -a
  *master
  remotes/origin/HEAD -> origin/master
  remotes/origin/dora
  remotes/origin/dunfell
  remotes/origin/g0hl1n/jdk14
  remotes/origin/krogoth
  remotes/origin/master
  remotes/origin/master-next
  remotes/origin/morty
  remotes/origin/pyro
  remotes/origin/rocko
  remotes/origin/sumo
  remotes/origin/thud
  remotes/origin/warrior
  remotes/origin/zeus
</pre>


* If not done, setup your build environment
 {{PC$}} cd [your STM32MP1 Distribution path]
 {{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 [your STM32MP1 Distribution path]/build-openstlinuxweston-stm32mp1
 {{PC$}} bitbake-layers add-layer [your STM32MP1 Distribution path]/meta-st/meta-java

* Define at least the following variables in your local.conf file.

 ('''[your STM32MP1 Distribution path]/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 [your STM32MP1 Distribution path]/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<pre>

  openjdk-8 \
  openjdk-8-demo \</pre>


* Build the image
 {{PC$}} cd [your STM32MP1 Distribution path]/build-openstlinuxweston-stm32mp1
 {{PC$}} bitbake st-image-weston

==Compil and execution of some JAVA demo==

* '''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.
To execute in a linux weston console on the board, with a keyboard and a mouse.
 {{Board$}} cd /usr/lib/jvm/openjdk-8/demo/jfc/SampleTree
 {{Board$}} java -jar SampleTree.jar

[[File:Sampletree.png|link=]]
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
{{ArticleMainWriter| YvesC}}
+
{{ClonedFrom | stm32mpu}}
{{ReviewersList | NathalieS, BernardP, ChristopheP}}
 
{{ArticleApprovedVersion | Jean-ChristopheT | Nobody | No previous approved version | Automatic approval (article under construction) | 19Feb’19}}
 
[[Category:How to customize software]]
 
 
</noinclude>
 
</noinclude>
{{UnderConstruction}}
+
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==
  +
===Hardware prerequisites===
  +
*{{Board | type=157x-DKx}} Or a{{Board | type=157x-EV1}}
  +
* a keyboard and a mouse connected to the board
  +
 
  +
===Software prerequisites===
  +
The STM32MP1 Distribution Package must be installed on your host. To do this follow the procedure described in the  [[STM32MP1 Distribution Package - OpenSTLinux distribution#Download|Install the STM32MP1 OpenSTLinux distribution]]  article.
  +
{{Info|The Host OS Ubuntu release 18.04 and next is required}}
  +
 
  +
==The yoctoproject meta-java ==
  +
JAVA for Linux-based system for embedded system is available as a meta data in Yocto project.
  +
 
  +
* Clone following git repository into ''[your STM32MP1 Distribution path]/layers/meta-st/""
  +
<pre>
  +
  PC >git clone git://git.yoctoproject.org/meta-java
  +
</pre>
  +
Depending on the Yocto release, select the right branch. (example : branch '''dunfell''' for the {{EcosystemRelease | revision=2.0.0}}) 
  +
 
  +
{{PC$}}cd meta-java
  +
{{PC$}}git checkout  remotes/origin/dunfell
  +
 
  +
You can have the list of available Yocto branch with the command :
  +
{{PC$}}cd meta-java
  +
{{PC$}}git branch -a
  +
  *master
  +
  remotes/origin/HEAD -> origin/master
  +
  remotes/origin/dora
  +
  remotes/origin/dunfell
  +
  remotes/origin/g0hl1n/jdk14
  +
  remotes/origin/krogoth
  +
  remotes/origin/master
  +
  remotes/origin/master-next
  +
  remotes/origin/morty
  +
  remotes/origin/pyro
  +
  remotes/origin/rocko
  +
  remotes/origin/sumo
  +
  remotes/origin/thud
  +
  remotes/origin/warrior
  +
  remotes/origin/zeus
  +
 
  +
</pre>
  +
 
  +
* If not done, setup your build environment
  +
{{PC$}} cd [your STM32MP1 Distribution path]
  +
{{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 [your STM32MP1 Distribution path]/build-openstlinuxweston-stm32mp1
  +
{{PC$}} bitbake-layers add-layer [your STM32MP1 Distribution path]/meta-st/meta-java
  +
 
  +
* Define at least the following variables in your local.conf file.
  +
 
  +
('''[your STM32MP1 Distribution path]/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 [your STM32MP1 Distribution path]/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
  +
<pre>
  +
  openjdk-8 \
  +
  openjdk-8-demo \
  +
</pre>
  +
 
  +
* Build the image
  +
{{PC$}} cd [your STM32MP1 Distribution path]/build-openstlinuxweston-stm32mp1
  +
{{PC$}} bitbake st-image-weston
  +
 
  +
==Compil and execution of some JAVA demo==
  +
 
  +
* '''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.
  +
To execute in a linux weston console on the board, with a keyboard and a mouse.
  +
{{Board$}} cd /usr/lib/jvm/openjdk-8/demo/jfc/SampleTree
  +
{{Board$}} java -jar SampleTree.jar
  +
 
  +
[[File:Sampletree.png|link=]]