• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Getting java working on UBTouch

Scheduled Pinned Locked Moved App Development
17 Posts 7 Posters 2.8k Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      ComLarsic
      last edited by ComLarsic 21 Apr 2020, 08:24

      Hello everyone, i have been busy trying to get java working an ubuntu touch.

      The approach i am using is by packaging OpenJDK binaries with the click package and linking to it in the .desktop file.

      i got this approach working in amd64 with "clickable desktop" and even made a working window/UI in swing.

      however i have run into some problems with arm64 and armf.

      first of all i don't have a phone that supports armf UBTouch so i can't test the build, i was hoping someone here could test it for me?

      Second of all, i cant seem to find any arm64 binaries for openjdk that work portably, does anyone know where to find it or how to cross-compile it for arm64 on amd64?

      Heres a screenshot of the amd64 build:
      Screenshot from 2020-04-21 10-23-43.png

      Click downloads:
      armf(https://drive.google.com/open?id=1tNf9r9V_w7saZM1IE385tDng35TqvuKk)
      amd64(https://drive.google.com/open?id=1EGq5kHdh7KdtqCKrpBJB2SzWZjWYnIfg)
      arm64(https://drive.google.com/open?id=1IGhc0XXfiUH8eL8FiEmoxAC_kkLTyBes)

      Source code(https://github.com/ComLarsic/Java-Template-UT)

      Update: so i found available arm64 binaries but after installing the updated click package on my oneplus3t it immediately closes itself, does anyone maybe know why?

      C W 2 Replies Last reply 21 Apr 2020, 10:36 Reply Quote 4
      • C Offline
        Capsia @ComLarsic
        last edited by 21 Apr 2020, 10:36

        @ComLarsic Hi, I've tested it on armhf (Nexus 5 dev) and I can confirm the behavior. The app closes itself immediately.

        C 1 Reply Last reply 21 Apr 2020, 10:58 Reply Quote 0
        • C Offline
          ComLarsic @Capsia
          last edited by 21 Apr 2020, 10:58

          @Capsia I figured as much, it seems to me that either OpenJDK or the app itself doesn't have access to the correct files it needs. i might have to change the apparmor permissions a bit.

          1 Reply Last reply Reply Quote 0
          • W Offline
            wdehoog @ComLarsic
            last edited by 21 Apr 2020, 11:19

            @ComLarsic Some time ago I tried to run librespot-java using various versions of openjdk. They all caused kernel crashes (related to pulse audio) and made my phone reboot (opo). Sorry, no java for me.

            C 1 Reply Last reply 21 Apr 2020, 11:34 Reply Quote 0
            • C Offline
              ComLarsic @wdehoog
              last edited by 21 Apr 2020, 11:34

              @wdehoog i am not getting any kernel crashes, the app just closes itself.
              i have ran openjdk directly using the terminal before and everything seemed to be running fine. maybe its a device specific problem?

              1 Reply Last reply Reply Quote 0
              • D Offline
                dobey
                last edited by 21 Apr 2020, 14:03

                Java does not have Mir or Wayland backends, and therefore works on your PC because you are using X11, while the phone is not. I'm pretty sure you would see an error about DISPLAY if you check the log file.

                You will need to add X-Ubuntu-XMir-Enable=true to your .desktop file.

                Also, you really should not include the binaries in your git repo, but instead pull them in during the clickable build process, so you can avoid having architecture-dependent things in the repo. You should avoid duplicating data/source files otherwise, too.

                C 2 Replies Last reply 21 Apr 2020, 14:06 Reply Quote 0
                • C Offline
                  ComLarsic @dobey
                  last edited by 21 Apr 2020, 14:06

                  @dobey Ah ok! thanks for the tips!

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    ComLarsic @dobey
                    last edited by 23 Apr 2020, 10:39

                    @dobey i tried adding thr line to the .desktop file but it still closes on launch.

                    you mentioned something about a log file, i am sorry if this is a bit of a newbie question but where could i find the log file?

                    A 1 Reply Last reply 23 Apr 2020, 11:36 Reply Quote 0
                    • A Offline
                      AppLee @ComLarsic
                      last edited by 23 Apr 2020, 11:36

                      @ComLarsic
                      Hi,

                      You can use this app as a convenience : https://open-store.io/app/logviewer.neothethird
                      And you can have a look in .cache/upstart/

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        ComLarsic
                        last edited by 25 Apr 2020, 11:33

                        After adding the line to the desktop file i seem to still not be able to run the app.

                        i checked the .desktop file in /home/phablet/.local/share/applications

                        and tried running the line behind Exec=
                        Manually in the terminal like so:
                        aa-exec-click -p javatest.comlarsic_JavaTest_1.5.0 -- JavaBin/bin/java -jar main.jar
                        and i get the error aa-exec: ERROR: profile 'javatest.comlarsic_JavaTest_1.5.0' does not exist

                        Here is the .desktop file that shows in the applications folder:

                        [Desktop Entry]
                        Name=Java-test
                        Exec=aa-exec-click -p javatest.comlarsic_JavaTest_1.5.0 -- JavaBin/bin/java -jar main.jar
                        Icon=/opt/click.ubuntu.com/.click/users/phablet/javatest.comlarsic/assets/logo.svg
                        Terminal=false
                        Type=Application
                        X-Ubuntu-Touch=true
                        X-Ubuntu-XMir-Enable=true
                        Path=/opt/click.ubuntu.com/.click/users/phablet/javatest.comlarsic
                        X-Ubuntu-Old-Icon=assets/logo.svg
                        X-Ubuntu-Application-ID=javatest.comlarsic_JavaTest_1.5.0
                        X-Ubuntu-UAL-Source-Desktop=/opt/click.ubuntu.com/.click/users/phablet/javatest.comlarsic/JavaTest.desktop
                        

                        what seems to be going wrong here?

                        D 1 Reply Last reply 25 Apr 2020, 13:42 Reply Quote 0
                        • D Offline
                          dobey @ComLarsic
                          last edited by 25 Apr 2020, 13:42

                          @ComLarsic Try uninstalling the app, and then installing it again. Or change the version number and building a new click, and installing that.

                          You did edit the original .desktop file and build a new click, rather than editing the .desktop in ~/.local/share/applications/ right?

                          C 1 Reply Last reply 25 Apr 2020, 17:19 Reply Quote 0
                          • C Offline
                            ComLarsic @dobey
                            last edited by 25 Apr 2020, 17:19

                            @dobey no, i did not edit the .desktop in the applicion folder manually. i have tried reinstalling it and i still get the same error. i will try to rebuild it and completly remove the app using UTTweak tool

                            1 Reply Last reply Reply Quote 0
                            • E Offline
                              Elleo
                              last edited by 23 Jun 2020, 12:16

                              I just had a bit of a play with this and was able to get it working with just the following changes to the original repository:

                              1. Set X-Ubuntu-XMir-Enable=true in the .desktop file
                              2. Remove the policy groups from the AppArmor profile and set "template": "unconfined", instead

                              It seems x-mir-helper isn't able to launch confined, perhaps there should be a discussion about adding an AppArmor policy for these use cases?

                              Photo of a Java application running on BQ Aquaris 4.5

                              D 1 Reply Last reply 23 Jun 2020, 13:30 Reply Quote 1
                              • D Offline
                                dobey @Elleo
                                last edited by 23 Jun 2020, 13:30

                                @Elleo said in Getting java working on UBTouch:

                                It seems x-mir-helper isn't able to launch confined, perhaps there should be a discussion about adding an AppArmor policy for these use cases?

                                If that's true, probably a good idea to open an issue about it at https://github.com/ubports/apparmor-easyprof-ubuntu

                                E 2 Replies Last reply 23 Jun 2020, 13:32 Reply Quote 1
                                • E Offline
                                  Elleo @dobey
                                  last edited by 23 Jun 2020, 13:32

                                  @dobey Okay, will do!

                                  1 Reply Last reply Reply Quote 0
                                  • E Offline
                                    Elleo @dobey
                                    last edited by 23 Jun 2020, 13:37

                                    @dobey Opened here: https://github.com/ubports/apparmor-easyprof-ubuntu/issues/16

                                    1 Reply Last reply Reply Quote 0
                                    • B Offline
                                      Bigdaddyweldz
                                      last edited by 8 Apr 2022, 01:09

                                      is that a working version of java for a nexus arm7

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post