• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How is ecliplse finding java path, if its not set ?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have installed JDK1.6.0_25 on windows 7 - 64 bit.

I have installed eclipse indigo on same system. I did not set JAVA_HOME or path to java.exe in PATH system variable. When I start eclipse, its picking up path to java. Just to test that its not picking up any other java path which may be installed on machine, I uninstalled the java I just installed. Now upon starting of eclipse, it throws an error message that JRE or JDK must be available for eclipse to run.

So, if I am not setting path to jre in PATH variable or JAVA_HOME, ow is eclipse obtaining that path ? Is there any mechanism , if yes whats that ?

Thanks
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is probably a C:\Windows\System32\java.exe that gets installed. You can check this with File Explorer, or by getting to a command line and typing:

>where java
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:There is probably a C:\Windows\System32.exe that gets installed.


And the java.exe in that directory uses the Windows registry to decide which version of Java to run. It's possible that Eclipse also uses that registry entry.
Can't remember the exact name of the registry entry at the moment, but I'm sure you can find it with a bit of googling.
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

You should always set a PATH when you install Java. It makes life much easier.
I shall duplicate this thread in the IDEs forum and maybe even transfer it there.
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joanne Neal wrote:

Knute Snortum wrote:There is probably a C:\Windows\System32.exe that gets installed.


And the java.exe in that directory uses the Windows registry to decide which version of Java to run.



The java.exe in my C:\Windows\System32 is exactly the same size as the one in C:\Program Files\Java\jre8\bin. I think the latest JRE version just gets copied to System32.

If you don't have a "-vm" option in your eclipse.ini, then Eclipse starts using whatever default Java is on your system. You can determine what this is with "where java" at the command line. It's usually C:\Windows\System32\java.exe unless you've played with your PATH variable (or you're not on Windows!)
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right that they do appear to be the same executable, but they work differently.
If I run java -version I get the same output from both
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)


However, if I rename the registry entry I referred to earlier (it's HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment) the output from the java.exe in the JRE bin directory remains the same, but the output from the one in C:\Windows\System32 is
Error: opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.


So the registry key does play a part and so Eclipse could be using it to find the JRE.
Maybe the java.exe checks for supporting files (bin, lib directories, etc) and if it doesn't find them then it checks the registry.
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That post made up my mind, Joanne definitely no longer beginner's stuff.
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Joanne, I didn't know that.
 
anjana soni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this something new ? Because earlier, when I did not set path for java.exe in PATH variable, eclipse would give error. But now its picking value from registry.

Thanks
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible that before you installed only the JDK and didn't do a separate JRE install? I think if you do only the first, you don't get a java.exe in C:\Windows\System32.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic