cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Creating a Snap which implements Java JRE in the ctrlX Core Devices (arm64)

Creating a Snap which implements Java JRE in the ctrlX Core Devices (arm64)

blendajazi
New Poster

Hi Community, 

i am trying to create snap which then implements Openjdk-jre-arm64. Java JRE should be a part of the snap, which means it should be defined in snapcraft.yaml file.

If anybody already created a snap which runs a Java Runtime Env on the ctrlX Device, i would appreciate help on this topic. 

This are my approaches for this task:

1.)  snapcraft.yaml

 

architectures:
  - build-on: amd64
    run-on: arm64

part:
   mypart:
        ...
        stage-packages:
      - on amd64 to arm64: [openjdk-11-jre] #i tried also [openjdk-11] 

 

i assume this way snapcraft.yaml file takes the snap available in the snap-store: https://snapcraft.io/openjdk

Test results: Doesent create a java arm64 package but a java amd64 package. 

2.) snapcraft.yaml

architectures:
  - build-on: amd64
    run-on: arm64

part:
   mypart:
     jre:
        plugin: dump
        source: https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/OpenJDK11U-jre_aarch64_linux_hotspot_11.0.11_9.tar.gz
        build-packages:
            - tar
            - gzip

  

Test results: it installs the right arm64 package into the ctrlX Core device. Though not working. 

3.) implement from repository

#package-repositories:
# - type: apt
# architectures: [arm64]
# formats: [deb, deb-src]
# components: [main]
# suites: [stable]
# key-id: not found
# url: http://ftp.de.debian.org/debian/pool/main/o/openjdk-11/openjdk-11-jre_11.0.11+9-1_arm64.deb
#http://ftp.de.debian.org/debian/pool/main/o/openjdk-11/openjdk-11-jre_11.0.11+9-1_arm64.deb

There is also a way to choose another repository or own hosted repository besides http://security.ubuntu.com/ubuntu/, which is the standard repo when snapcraft installs packages during building process.

Test results: no test results since i wasnt able to find the key-id (gpg) of the package.

NOTE:

I directed at any of these approaches the java jre into the $SNAP/usr/lib/jvm path. Which is the supposed place for a java runtime enviroment.

 

 

 

2 REPLIES 2

CodeShepherd
Community Moderator
Community Moderator

I will try to get some infos here.

DiluMarku
Established Member

Hi blendajazi,

I don't know if you still need help but this implementation works for me:

...

architectures:
  - build-on: amd64
    run-on: arm64

apps:
  java-server:
    command: bin/main
    ...
    environment:
      JAVA_HOME: $SNAP/usr/lib/jvm/java-11-openjdk-arm64
      PATH: $JAVA_HOME/jre/bin:$PATH

parts:
  preparations:
    plugin: nil
    source: .
    ...
    build-packages:
    - openjdk-11-jdk
    stage-packages:
      - openjdk-11-jre-headless:arm64

...

 

 

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist