Eclipse is unable to find JVM in Ubuntu 12 - java

When I open eclipse in Ubuntu it is showing the following error:
A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Eclipse. No Java virtual machine
was found after searching the following locations:
/opt/eclipse/jre/bin/java
java in your current PATH
These are the Environment variables I set in .bashrc file:
JAVA_HOME=/opt/jdk1.7.0
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
JRE_HOME=/opt/jdk1.7.0
PATH=$PATH:$HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
I have also checked in terminal:
asr#asr-desktop:~$ java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Server VM (build 21.0-b17, mixed mode)
asr#asr-desktop:~$ which java
/opt/jdk1.7.0/bin/java
asr#asr-desktop:~$ echo $JAVA_HOME
/opt/jdk1.7.0
asr#asr-desktop:~$ echo $PATH
/opt/softwares/apache-ant-1.7.1/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/vidyayugpc/bin:/opt/jdk1.7.0/bin:/home/vidyayugpc/bin:/opt/jdk1.7.0/bin
The eclipse is opening via command prompt only, I have tried to specify JVM location in eclipse.ini file by adding the below line
-vm
/opt/jdk1.7.0/bin/java
But its not running again showing the same error jvm is not found.Can any one help me here?

This work for me edit the eclipse.ini using any text editor and change your -vm path to real path of your JDK
-vm /opt/jdk1.6.0/bin/

You should set the Environment variables in /etc/profile or /etc/profile.d/ and reboot.

I don't know exactly, your path seems fine
If you set up the -vm parameter you have to point to the bin folder, please try this:
-vm /opt/jdk1.7.0/bin/

Related

java command works but javac command doesn't?

I have downloaded the jdk 1.8.0_131
when I open the command prompt and write the following command - java -version it gives me the output
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
but when I write the following command: javac -version it gives me the output
'javac' is not recognized as an internal or external command,
operable program or batch file.
I have edit the system variables path to - C:\Progra~1\Java\jdk1.8.0_131\bin;
and when I do the following command : "C:\Program Files\Java\jdk1.8.0_131\bin\javac" -version
it gives me the output:
javac 1.8.0_131
So i know I have installed the correct java version
I also checked the above folder and did find a javac.exe there. Please help.
Edit:
I finally solved the problem. What I was doing is editing the "Path" variable when what I had to do was make a new variable called "PATH" and the the following details :
Variable name : PATH
Variable value : c:\Program Files\Java\jdk1.8.0_xx\bin;[Existing Entries...
Have you tried restarting "cmd.exe" since adding the bin directory to your PATH?
If you confirm that your PATH includes the java bin directory and you can see the "javac.exe" binary in that location, then all should be set up correctly.
In Windows you need to add path to the jdk_your_version/bin to the PATH variable. Add this line to the PATH:
C:\Progra~1\Java\jdk1.8.0_131\bin;
Save it. Then restart CMD since it does not update the path automatically for the open cmd. Then you should be able to see that javac is working:
javac -version

Java not recognized on PowerShell

I'm using PowerShell on Windows 2012 server, and I deleted all the java commands from System32, reinstalled jdk, set JAVA_HOME and Path to point at the new installation. And I still get the following error:
java : The term 'java' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ java
+ ~~~~
+ CategoryInfo : ObjectNotFound: (java:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I deleted all the java commands from System32
This is why Windows can't find java.exe. The default JRE installation puts Java into your System32 directory, which is where CMD and Powershell usually find it.
You can fix this for your system by running the following from an admin shell. This creates a copy of java.exe in your Windows directory. (You can also probably get away with a soft link)
fsutil hardlink create (join-path $env:SystemRoot 'java.exe') (join-path $env:JAVA_HOME 'bin\java.exe')
If you don't want to modify your Windows directory (or can't), you can always set an alias to use in your Powershell session.
Set-Alias -Name java -Value (Join-Path $env:JAVA_HOME 'bin\java.exe')
Run that line in your current session and running java from the command line should work correctly. Add it to your $PROFILE if you want it to work from all future Powershell sessions.
PATH needs to point at the bin/ directory within the JDK/JRE installation
JAVA_HOME needs to point to the top level directory of the JDK/JRE
I suspect you're setting PATH to be the JDK/JRE folder which doesn't contain the java executable, as it's in the bin/ subdirectory...
1) My default JAVA_HOME is:
echo %JAVA_HOME%
D:\Program Files\Java\jdk1.7.0_25
<= The installer automagically configures this when you install a JRE
2) My default %PATH% does not include any Java
3) I'm able to run (but not compile) Java from a Windows command prompt:
java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
4) I'm also able to do exactly the same from inside Powershell (or from a .ps1 Powershell script):
PS D:\temp> java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

Error: could not find libjava.so, Error: could not find Java 2 Runtime Environment

I uninstalled java j2sdk1.4.2_12 java on my Linux Server and Install jdk1.6.0_21,
but when I am trying to run any script I am getting following Error
Error: could not find libjava.so
Error: could not find Java 2 Runtime Environment.
I already set classPath and Path like :
In vi ~/.bashrc
export JAVA_HOME=/home/java/jdk1.6.0_21/
export PATH=$PATH:/home/java/jdk1.6.0_21/bin
export set CLASSPATH=/usr/java/j2sdk1.4.2_12/lib/mysql-connector-java-5.1.6-bin.jar: /home/java/jdk1.6.0_21/jre/lib:/root/mis/mod:$CLASSPATH
ulimit -c unlimited
IN vi ~/.bash_profile
JAVA_HOME=/home/java/jdk1.6.0_21/
PATH=$PATH:$HOME/bin:$HOME/mis/mod:
PATH=/home/java/jdk1.6.0_21/bin:$PATH
CLASSPATH=$CLASSPATH:/home/java/jdk1.6.0_21/lib:.:
export JAVA_HOME
export PATH
export CLASSPATH
unset USERNAME
When I run following Commands
which java
/home/java/jdk1.6.0_21/bin/java
java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)
I am not getting where is the issue.
Can Any one help me ?
I encounter this issue before. It turns out there are 2 javac program sitting on my machine.
They are in /usr/bin/javac and /bin/javac. My system used the /bin/javac one. The right path for me is /usr/bin/javac. Removing /bin/javac helped
I faced the same issue, and it disppeared by just shutting down the CentOS VM and then starting again. Then type in javac command again to check.

Java runtime not found in OSX 10.9.1 while running solR

I want to run solR in mac OSX 10.9.1. So I installed JRE latest version. Then, I downloaded solR and expanded the folder. But when I try to run this jar file in example folder, I get this msg "no java runtime present", mentioned below.
Do I need to add JAVA_HOME env variable like we do in windows? If so, please tell me how.
Ananyas-MacBook-Pro:~ ananya$ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build
1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
Ananyas-MacBook-Pro:~ ananya$ cd /Users/ananya/Desktop/VT\ study/solr-4.6.1/example
Ananyas-MacBook-Pro:example ananya$ java -jar start.jar
No Java runtime present, requesting install.
Ananyas-MacBook-Pro:example ananya$
Thanks.
"Do I need to add JAVA_HOME env variable like we do in windows?"
Test to see if/where Java is on your path in a terminal:
echo $JAVA_HOME
If the path to Java is wrong or missing you can add and Environmental Variable to ~/.bash_profile like so
JAVA_HOME=/usr/bin/java #or whatever your path is
export PATH=$PATH:$JAVA_HOME/bin/
You can open ~/.bash_profile in a terminal with nano
nano ~/.bash_profile.
Nano hint: writeout means save.
You'll need to reopen your terminal to load the new path. Or, reload it with the source command.
source ~/.bash_profile
Alternatively, if you like saving keystrokes you can type
. ~/.bash_profile

running ant in cygwin return JAVA_HOME incorrect setting

$ ant --version
Error: JAVA_HOME is not defined correctly.
We cannot execute 헬愣헬愣0
헬愣헬愣0
Files
/bin/java
I extract Ant into a folder called Ant
C:\ANT
I set-up the environmental variables
ANT_HOME with the path C:\Ant
JAVA_HOME with the path C:\Program Files (x86)\Java\jdk1.6.0_32
I checked my Java path is set correctly
and does return the correct message.
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
How to solve this?
You can also in cygwin just go to
cd /cygdrive/c
ln -s /cygdrive/c/Program\ Files/jdk-xxx java
and update .bashrc
export JAVA_HOME="/cygdrive/c/java"
export ANT_HOME="/cygdrive/c/ant"
export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin
Not a final solution, but could not put in comments.
Install jdk to c:/apps/jdk1.6.0_32 (a path without space)
set JAVA_HOME=c:/apps/jdk1.6.0_32
set ANT_HOME=c:/ant (your already have this)
run $ANT_HOME/bin/ant
I've tried all these tips but nothing worked to solve the above mentioned issue:
Error: JAVA_HOME is not defined correctly.
Then I realized that at ENVIRONMENT VARIABLES menu, although JAVA_HOME path appeared without semi-colon (;) at the end of the string, viewing on the text editor panel, it was there, then removing the semi-colon everything worked fine !
BTW, I'm running under Windows 10.

Categories

Resources