Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. JAVA_HOME is not defined correctly.
Forum Updated to NodeBB v4.3 + New Features

JAVA_HOME is not defined correctly.

Scheduled Pinned Locked Moved Mobile and Embedded
28 Posts 4 Posters 28.3k Views 1 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #6

    Since you just installed it, you could try to just logout/login to check wether your environment has been properly updated.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vanpivix
      wrote on last edited by
      #7

      I removed java 6, reinstalled java 7 and then logout/login

      I retry and I get
      @23:26:32: The process "/usr/bin/make" exited normally.
      23:26:32: Copy Qt app & libs to Android package ...
      23:26:33: Creating package file ...
      23:26:33: Package deploy: Running command '/usr/bin/ant clean debug'.
      Error: JAVA_HOME is not defined correctly.
      We cannot execute /etc/java-7-openjdk/bin/java
      Packaging Error: Command '/usr/bin/ant clean debug' failed.Exit code: 1
      Error while building/deploying project Test (kit: Android for arm (GCC 4.6, Qt 5.1.1))
      When executing step 'Packaging for Android'@

      So I have to set JAVA_HOME.
      Now, I have to add:

      @export JAVA_HOME=/usr/lib/jvm/SOMETHING@

      But something what? I post the content of /usr/lib/Jvm
      @default-java java-1.7.0-openjdk-amd64 java-6-openjdk-common
      java-1.6.0-openjdk java-6-openjdk java-7-openjdk-amd64
      java-1.6.0-openjdk-amd64 java-6-openjdk-amd64 java-7-openjdk-common
      @

      and then, I have to add the line in which file? .bashrc? .profile?

      Thank you for the help....

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #8

        Did you check the JDK location in Options -> Android from QtCreator ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vanpivix
          wrote on last edited by
          #9

          It's set to /etc/java-7-openjdk but there are not a bin folder in it and that's probably why I get

          @Error: JAVA_HOME is not defined correctly.
          We cannot execute /etc/java-7-openjdk/bin/java@

          So is that what I have to change? Change in what?

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #10

            Change it to point to the folder where you have your java executable installed

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • V Offline
              V Offline
              vanpivix
              wrote on last edited by
              #11

              Now the problem is elsewhere

              @BUILD FAILED
              /home/andrea/Android/adt-bundle-linux-x86_64-20130911/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
              /home/andrea/Android/adt-bundle-linux-x86_64-20130911/sdk/tools/ant/build.xml:734: Unable to find a javac compiler;
              com.sun.tools.javac.Main is not on the classpath.
              Perhaps JAVA_HOME does not point to the JDK.
              It is currently set to "/usr/lib/jvm/java-6-openjdk-amd64/jre"

              Total time: 1 second
              Packaging Error: Command '/usr/bin/ant clean debug' failed.Exit code: 1
              Error while building/deploying project Test (kit: Android for arm (GCC 4.6, Qt 5.1.1))
              When executing step 'Packaging for Android'
              23:57:23: Elapsed time: 00:03.@

              1 Reply Last reply
              0
              • V Offline
                V Offline
                vanpivix
                wrote on last edited by
                #12

                Maybe I should remove and reinstall java and all the components that I need to compile for android...

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13

                  Where is javac to be found ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • p3c0P Offline
                    p3c0P Offline
                    p3c0
                    Moderators
                    wrote on last edited by
                    #14

                    Can you post what you get when you fire "which java" command from the terminal ?

                    157

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      vanpivix
                      wrote on last edited by
                      #15

                      Ok, so:

                      @$ which java
                      /usr/bin/java
                      @

                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        vanpivix
                        wrote on last edited by
                        #16

                        If I retry from QtCreator, from Compile Output everything seems ok but I get:

                        Application Output
                        @Starting remote process.Unable to start 'org.qtproject.example.Test'.@

                        1 Reply Last reply
                        0
                        • p3c0P Offline
                          p3c0P Offline
                          p3c0
                          Moderators
                          wrote on last edited by
                          #17

                          i think you also need to install the jdk.
                          Try @apt-get install openjdk-6-jdk@

                          157

                          1 Reply Last reply
                          0
                          • V Offline
                            V Offline
                            vanpivix
                            wrote on last edited by
                            #18

                            Yep it's installed:

                            @sudo apt-get install openjdk-6-jdk
                            [sudo] password for andrea:
                            Lettura elenco dei pacchetti... Fatto
                            Generazione albero delle dipendenze
                            Lettura informazioni sullo stato... Fatto
                            openjdk-6-jdk è già alla versione più recente.
                            0 aggiornati, 0 installati, 0 da rimuovere e 0 non aggiornati.
                            @

                            1 Reply Last reply
                            0
                            • p3c0P Offline
                              p3c0P Offline
                              p3c0
                              Moderators
                              wrote on last edited by
                              #19

                              Try setting JAVA_HOME to "/usr/lib/jvm/java-6-openjdk-amd64/bin"
                              As it contains both javac and java (symbolic link to ../jre/bin/java )

                              157

                              1 Reply Last reply
                              0
                              • V Offline
                                V Offline
                                vanpivix
                                wrote on last edited by
                                #20

                                Ok so I have to add
                                @export JAVA_HOME="/usr/lib/jvm/java-6-openjdk-amd64/bin"@

                                but where? in .profile? .bashrc?
                                Thanks

                                1 Reply Last reply
                                0
                                • p3c0P Offline
                                  p3c0P Offline
                                  p3c0
                                  Moderators
                                  wrote on last edited by
                                  #21

                                  Yup. try in bashrc or /etc/environment

                                  157

                                  1 Reply Last reply
                                  0
                                  • V Offline
                                    V Offline
                                    vanpivix
                                    wrote on last edited by
                                    #22

                                    Done. Now if I run...

                                    "Application Output":http://pastebin.com/eqJCfW9p

                                    "Compile Output":http://pastebin.com/bGSZmun5

                                    I think it's not a Java problem anymore...

                                    1 Reply Last reply
                                    0
                                    • V Offline
                                      V Offline
                                      vanpivix
                                      wrote on last edited by
                                      #23

                                      I'm not understanding anything.

                                      Last update, every time I click on "run" I get

                                      Application Output:
                                      @Starting remote process.Unable to start 'org.qtproject.example.Test'.@

                                      and General Messages
                                      @Could not read qmake configuration file /home/andrea/Qt5.1.1/5.1.1/android_armv7/mkspecs/android-g++/qmake.conf.@

                                      Maybe this is the problem now, I've never checked this tab before...

                                      1 Reply Last reply
                                      0
                                      • p3c0P Offline
                                        p3c0P Offline
                                        p3c0
                                        Moderators
                                        wrote on last edited by
                                        #24

                                        Well from the compile output it seems that the APK has been created
                                        @/home/andrea/Code/QML/Test/android/bin/Test-debug.apk@
                                        But on deployment to the emulator it crashes due to some OpenGL issues.
                                        I donot have much detailed idea about this.
                                        But just try to deploy this APK on a physical device and see if it works.

                                        157

                                        1 Reply Last reply
                                        0
                                        • V Offline
                                          V Offline
                                          vanpivix
                                          wrote on last edited by
                                          #25

                                          I tried in a physical device and it works!!!!!!!

                                          But I can't reupload the apk every time to check if it's working well....so maybe I should open a new topic for this issue, what do you think?

                                          Thanks a lot for the help!

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved