How to use the content interface

I am creating hello world snap with java and maven (runs on my computer).
While trying to run the snap on the NanoPi-NEO2 with OS that based on ubuntu core 16 (friendlycore) I got the error:

/snap/smart-pi-snap/x1/usr/lib/jvm/default-java/bin/java: 8: /snap/smart-pi-snap/x1/usr/lib/jvm/default-java/bin/java: Syntax error: Unterminated quoted string
(smart-pi-snap is the name of the snap)

It seems that the there is no java on the device (and I can only install snaps) so I found

java-jre-ondra

which is

java 8 runtime snap

Info on the snap says

Java 8 run time snap, this snap is intented to be used by other snap_fileset
using content interface

But I cant understand how to use content interface.
snapcraft.yaml:

name: smart-pi-snap
#base: core18
version: '1.0.1'
summary: Hello World java maven
description: |
  Simple Hello World delivered with java in snap package.
  
grade: devel
confinement: devmode

architectures: [all]

parts:
  smart-pi-snap:
    plugin: maven
    source: .
    maven-options: [package]
    stage-packages: [openjdk-8-jre]

apps:
  smart-pi-snap:
    command: java -jar $SNAP/jar/HelloWorld.jar
    plugs:
      - content
1 Like

After digging a bit I have installed java run-time and managed to run java files from the terminal but still no luck with java based snaps.
I get the same error

/snap/MySnapName/x1/usr/lib/jvm/default-java/bin/java: 8: /snap/jMySnapName/x1/usr/lib/jvm/default-java/bin/java: Syntax error: Unterminated quoted string

This snap run on my main computer so it should be OK.
Does someone have a clue why it doesn’t run on Ubuntu core?, can it be because I am missing the base: core16 from the yamel file ?

You can’t specify content interface under the plugs property in the apps stanza, you have to use the global plugs property: https://docs.snapcraft.io/t/snapcraft-top-level-metadata/8334#heading--plugs-and-slots-for-an-entire-snap