Setting the JAVA_HOME environment variable in Ubuntu

后端 未结 9 1877
渐次进展
渐次进展 2020-12-16 02:20

I\'m pretty new on ubuntu, at some point in the terminal I\'m running:

mortar local:illustrate pigscripts/retail-recsys.pig purchase_input -f params/retail.p         


        
相关标签:
9条回答
  • 2020-12-16 02:21

    First, you need to decide which installed version of Java to use? No fear, you can pick any you have -

    update-java-alternatives -l
    

    One "easy" solution is to add this to "$HOME/.bashrc",

    export JAVA_HOME=$(update-java-alternatives -l | head -n 1 | awk -F ' ' '{print $NF}')
    

    This picks the first installed JDK and takes it's JAVA_HOME (the third field) - on my system that's

    /usr/lib/jvm/java-1.7.0-openjdk-amd64
    
    0 讨论(0)
  • 2020-12-16 02:21

    put the line export JAVA_HOME=/usr/lib/jvm/java-xxx-oracle in your .profile file at home directory. Note that you have to replace xxx. You may need to logout and login again

    0 讨论(0)
  • 2020-12-16 02:21

    In Debian/Ubuntu/Linux Mint, we could add to .bashrc export JAVA_HOME=$(update-java-alternatives -l | head -n 1 | sed 's/\s//g')

    0 讨论(0)
  • 2020-12-16 02:21

    you can type java in terminal,if it does not work means your did not install java.if it works, type javac in terminal.if javac dose not work,you should set the java environment variable,if it works ,there maybe something wrong with you program.

    0 讨论(0)
  • 2020-12-16 02:30

    By far, the ultimate guide to doing this is here. You don't need to set PATH as much as you just need to adjust the default 'java alternative' location.

    0 讨论(0)
  • 2020-12-16 02:34

    Normally you can set paths in

    ~/.bashrc

    with export JAVA_HOME=/usr/lib/jvm/java-version

    However you may followe instructions from here for a comprehensive instruction.

    0 讨论(0)
提交回复
热议问题