Eclipse cannot find Java on Ubuntu

后端 未结 8 1111
自闭症患者
自闭症患者 2021-02-09 05:38

Java is properly installed in my Ubuntu 12.04 and the PATH variable is set in the .bashrc file.

The command java -version gives an expected out

相关标签:
8条回答
  • 2021-02-09 06:02

    You might need to edit your eclipse.ini file and mention the path there. Read this for more details.

    EDIT:

     -vm
    /opt/sun-jdk-1.6.0.02/bin/java
    

    This is how your vm argument should be in the .ini file. If not,change it. Be careful about the path though. Generally Java is installed in /opt,but check once on your system.

    Also, look at this question as well.

    0 讨论(0)
  • 2021-02-09 06:02

    Follow below step to define path variable available for all launcher for manually installed JDK

    Step:

    1-

     cd /etc/
    

    2-

    sudo vim ~/.profile
    

    3- Add below codes in your step2 open file

      PATH="$HOME/bin:$HOME/.local/bin:/usr/lib:$PATH"
    
      JAVA_HOME="/usr/lib/jvm/jdk1.7.0_79"
    
      export JAVA_HOME
    
      PATH=$PATH:$JAVA_HOME/bin
    
      export PATH
    

    4-Restart your system

    0 讨论(0)
  • 2021-02-09 06:03

    The Eclipse read me document has helped me solve this issue clearly.

    If this seems to solve the problem, it is likely that the problem really was related to the use of GCJ as the Java runtime for running Eclipse. The eclipse.ini file located within Eclipse's folder can be altered to automatically pass this argument to Eclipse at startup. An example of its content is presented below:

      -showsplash
      org.eclipse.platform
      -vm
      /opt/jdk-1.8/bin/java
      -vmargs
      -Xms256m
      -Xmx1024m
    

    So I had to put this the line before the -vmargs

    0 讨论(0)
  • 2021-02-09 06:06

    -vm /home/manash/Desktop/jdk-8u251-linux-x64/jdk1.8.0_251/bin

    0 讨论(0)
  • 2021-02-09 06:11

    Java in Ubuntu is usually located at /usr/lib/jvm/<your_java_version>, but ubuntu usually creates a symlink to the current version of java at /usr/lib/jvm/java-7-sun. The symlink may or may not exist depending on how you installed java on your machine, now that it is no longer available at the repos.

    Navigate to /usr/lib/jvm/ and type the ls command to find the appropriate folder java is located in. Once you have the location nailed down, look for a file named libjvm.so.

    In my machine, the -vm arg looks like this:

    -vm
    /usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so
    

    Make sure the path is in a new line below -vm or it won't work.

    0 讨论(0)
  • 2021-02-09 06:15

    It looks to me like you have set the PATH environment in your shell, but you are launching Eclipse using some menu item or shortcut, and the context is using a different PATH.

    One option is to change the eclipse.ini file as other answers say.

    Another option is to try to figure out why Eclipse is being launched with a different PATH to the one in your command path. (The "fix" might simply be to logout and login again to make the launcher pick up the updated PATH setting. Or launcher may be picking up the incorrect PATH setting from somewhere else.)

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