Unreal Engine 4 : Error: JAVA_HOME is not defined correctly

Unreal Engine 4 : Error: JAVA_HOME is not defined correctly

Test on:
- Mac OSX Yosemite
- Java 1.6
- Apache Ant 1.9.4
- Android NDK 10c
- Android SDK
- Unreal Engine 4.8.3

[Error]
MainFrameActions: Packaging (Android (DXT)): mono: ====8/30/2015 9:11:35 PM====PERFORMING FINAL APK PACKAGE OPERATION================================================
MainFrameActions: Packaging (Android (DXT)): mono: Making .apk with Ant... (note: it's safe to ignore javac obsolete warnings)
MainFrameActions: Packaging (Android (DXT)): mono: Error: JAVA_HOME is not defined correctly.
MainFrameActions: Packaging (Android (DXT)): mono:   We cannot execute $(/usr/libexec/java_home)/bin/java
MainFrameActions: Packaging (Android (DXT)): mono: UnrealBuildTool Exception: ERROR: /bin/sh failed with args -c '"/Applications/apache-ant-1.9.4/bin/ant" -quiet debug'

[Solved]
1. Check on your mac by take a look into this path "/Library/Java/Home", if inside "Home" folder contain "bin/java" execute file, it's be ok. If not please download and install Java JDK.


1.1


1.2


2. Then open Terminal and type "java -version" and press "Enter", Let's see your java version, it's be ok.


3. Then type "nano -e .bash_profile" and press "Enter", Let's see on this line.

export JAVA_HOME=$(/usr/libexec/java_home)

change it to be as below

export JAVA_HOME=$(/Library/Java/Home)


4. Press "Control + X", then press "Y" and after that press "Enter", the .bash_profile was saved.

5. On Unreal Editor, Repacking again by goto


6. Choose default your project folder and click "Open", then the compile processing, just wait until the log told you "BUILD SUCCESSFUL".


It's work :)

Comments

  1. not
    export JAVA_HOME=$(/Library/Java/Home)
    just
    export JAVA_HOME=/Library/Java/Home
    bcoz its link

    ReplyDelete
  2. The post made me to post reply. Very convincing content on your blog. Keep doing the collective work about information.
    Thanks
    Dedicated hosting provider

    ReplyDelete
  3. Step1: After downloading and installing Java JDK I still dont have a Home folder in /Library/Java/ How do I fix this?

    ReplyDelete
    Replies
    1. the path is not the same as what's displayed. I think:
      /Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Still getting this error:

    UATHelper: Packaging (Android (DXT)): ERROR: /bin/sh failed with args -c '"/Users/USERNAME/Documents/Unreal Projects/MyProject2/Intermediate/Android/APK/gradle/gradlew" :app:assembleDebug'
    UATHelper: Packaging (Android (DXT)): (see /Users/USERNAME/Library/Logs/Unreal Engine/LocalBuildLogs/Log.txt for full exception trace)
    PackagingResults: Error: /bin/sh failed with args -c '"/Users/USERNAME/Documents/Unreal Projects/MyProject2/Intermediate/Android/APK/gradle/gradlew" :app:assembleDebug'
    UATHelper: Packaging (Android (DXT)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
    UATHelper: Packaging (Android (DXT)): RunUAT ERROR: AutomationTool was unable to run successfully.
    PackagingResults: Error: AutomationTool was unable to run successfully.
    PackagingResults: Error: Unknown Error
    LogSlate: Window 'Output Log' being destroyed

    ReplyDelete

Post a Comment