How to find out if I use java.exe from a jdk, a jre or a javaEE installation?

Discussion in 'Java' started by Robin Wenger, Aug 12, 2011.

  1. Robin Wenger

    Robin Wenger Guest

    Assume I am working on a unknown computer (from a friend/colleague) where some pre-installed Java installations exist.

    When I type on a command prompt/terminal:

    java -version

    the output tells me if java.exe is part of a JavaSE or JavaEE installation.
    But it does NOT tell me if I use

    java.exe from the jdk path/part or the jre path/part.

    How can I find out (in Win) WHICH java.exe I used in detail?

    Keep in mind that there could be further applications/developments tool which might bring their own
    jdk/jre installation.

    So java.exe could be called from these additional installations as well.

    Robin
     
    Robin Wenger, Aug 12, 2011
    #1
    1. Advertising

  2. On Aug 12, 7:33 am, (Robin Wenger) wrote:
    > Assume I am working on a unknown computer (from a friend/colleague) wheresome pre-installed Java installations exist.
    >
    > When I type on a command prompt/terminal:
    >
    > java -version
    >
    > the output tells me if java.exe is part of a JavaSE or JavaEE installation.
    > But it does NOT tell me if I use
    >
    > java.exe from the jdk path/part or the jre path/part.
    >
    > How can I find out (in Win) WHICH java.exe I used in detail?
    >
    > Keep in mind that there could be further applications/developments tool which might bring their own
    > jdk/jre installation.
    >
    > So java.exe could be called from these additional installations as well.
    >
    > Robin


    Something like http://www.flounder.com/whereis.htm ?
     
    kedar mhaswade, Aug 12, 2011
    #2
    1. Advertising

  3. Robin Wenger

    markspace Guest

    Re: How to find out if I use java.exe from a jdk, a jre or a javaEEinstallation?

    On 8/12/2011 7:33 AM, Robin Wenger wrote:
    > How can I find out (in Win) WHICH java.exe I used in detail?


    It's "where java" on windows, and I think whereis on *nix.

    If you mean programatically, just access the class/sdk component or
    other service. If you get an exception, it wasn't installed. Some
    programs (like ant) require you to set the JAVA_HOME environment
    variable to identify which SDK you want to use (some users have more
    than one). I prefer using command line arguments or cofig files;
    polluting the environment with lots of tedious variables is a last resort.
     
    markspace, Aug 12, 2011
    #3
  4. Robin Wenger

    Lew Guest

    Please do not multi-post.

    Robin Wenger wrote:
    > Assume I am working on a unknown computer (from a friend/colleague) where some pre-installed Java installations exist.
    >
    > When I type on a command prompt/terminal:
    >
    > java -version
    >
    > the output tells me if java.exe is part of a JavaSE or JavaEE installation.
    > But it does NOT tell me if I use
    >
    > java.exe from the jdk path/part or the jre path/part.
    >
    > How can I find out (in Win) WHICH java.exe I used in detail?
    >
    > Keep in mind that there could be further applications/developments tool which might bring their own
    > jdk/jre installation.
    >
    > So java.exe could be called from these additional installations as well.
    >
    > Robin
     
    Lew, Aug 12, 2011
    #4
  5. Robin Wenger

    Luuk Guest

    Re: How to find out if I use java.exe from a jdk, a jre or a javaEEinstallation?

    On 12-08-2011 16:33, Robin Wenger wrote:
    > Assume I am working on a unknown computer (from a friend/colleague) where some pre-installed Java installations exist.
    >
    > When I type on a command prompt/terminal:
    >
    > java -version
    >
    > the output tells me if java.exe is part of a JavaSE or JavaEE installation.
    > But it does NOT tell me if I use
    >
    > java.exe from the jdk path/part or the jre path/part.
    >
    > How can I find out (in Win) WHICH java.exe I used in detail?
    >
    > Keep in mind that there could be further applications/developments tool which might bring their own
    > jdk/jre installation.
    >
    > So java.exe could be called from these additional installations as well.
    >
    > Robin
    >


    I knew there was a tool called WHEREIS.EXE but thats very old....

    After looking a bit furthere i found this site:
    http://blogs.msdn.com/b/oldnewthing/archive/2005/01/20/357225.aspx

    If you create a batchfile (whereis.bat) with the following (on one line!):
    @for %%e in (%PATHEXT%) do @for %%i in (%1%%e) do @if NOT
    "%%~$PATH:i"=="" echo %%~$PATH:i

    tha you could do:
    C:\>whereis.bat java
    C:\Windows\System32\java.exe

    hmmmm, who dit put this java stuff in my windows-folder..... ;(

    --
    Luuk
     
    Luuk, Aug 13, 2011
    #5
  6. Robin Wenger

    Luuk Guest

    Re: How to find out if I use java.exe from a jdk, a jre or a javaEEinstallation?

    On 13-08-2011 12:42, Luuk wrote:
    > On 12-08-2011 16:33, Robin Wenger wrote:
    >> Assume I am working on a unknown computer (from a friend/colleague) where some pre-installed Java installations exist.
    >>
    >> When I type on a command prompt/terminal:
    >>
    >> java -version
    >>
    >> the output tells me if java.exe is part of a JavaSE or JavaEE installation.
    >> But it does NOT tell me if I use
    >>
    >> java.exe from the jdk path/part or the jre path/part.
    >>
    >> How can I find out (in Win) WHICH java.exe I used in detail?
    >>
    >> Keep in mind that there could be further applications/developments tool which might bring their own
    >> jdk/jre installation.
    >>
    >> So java.exe could be called from these additional installations as well.
    >>
    >> Robin
    >>

    >
    > I knew there was a tool called WHEREIS.EXE but thats very old....
    >
    > After looking a bit furthere i found this site:
    > http://blogs.msdn.com/b/oldnewthing/archive/2005/01/20/357225.aspx
    >
    > If you create a batchfile (whereis.bat) with the following (on one line!):
    > @for %%e in (%PATHEXT%) do @for %%i in (%1%%e) do @if NOT
    > "%%~$PATH:i"=="" echo %%~$PATH:i
    >
    > tha you could do:
    > C:\>whereis.bat java
    > C:\Windows\System32\java.exe
    >
    > hmmmm, who dit put this java stuff in my windows-folder..... ;(
    >


    oops, it was a multi-post....
    so, indeed WHERE (like markspace suggested) would be better!

    --
    Luuk
     
    Luuk, Aug 13, 2011
    #6
  7. Robin Wenger

    Steve Guest

    Re: How to find out if I use java.exe from a jdk, a jre or a javaEEinstallation?

    On 8/12/2011 10:33 AM, Robin Wenger wrote:
    >
    > How can I find out (in Win) WHICH java.exe I used in detail?


    I find cygwin a very handy tool when programming on windows. The basic
    installation is very quick to download and install. Even faster is the
    GNU Utilities ( *nix commands/programs ported to window ). I just put
    them in a C:\Util folder and put that in my path.

    Once you have either of those set up all you need to do is type this at
    a command prompt:

    which java
     
    Steve, Aug 18, 2011
    #7
  8. Robin Wenger

    Lew Guest

    Steve wrote:
    > Robin Wenger wrote:
    >> How can I find out (in Win) WHICH java.exe I used in detail?

    >
    > I find cygwin a very handy tool when programming on windows. The basic
    > installation is very quick to download and install. Even faster is the
    > GNU Utilities ( *nix commands/programs ported to window ). I just put
    > them in a C:\Util folder and put that in my path.
    >
    > Once you have either of those set up all you need to do is type this at
    > a command prompt:
    >
    > which java


    Cygwin and "which" were suggested to him early on, in his other multipost. This is an example of why multiposting is bad.

    --
    Lew
     
    Lew, Aug 18, 2011
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roedy Green
    Replies:
    5
    Views:
    14,553
    J Lafortune
    Jul 12, 2012
  2. Ulf Meinhardt
    Replies:
    0
    Views:
    6,492
    Ulf Meinhardt
    Aug 10, 2006
  3. Artur McCennon
    Replies:
    0
    Views:
    435
    Artur McCennon
    Jul 22, 2009
  4. Jochen Brenzlinger
    Replies:
    5
    Views:
    993
    Roedy Green
    Sep 2, 2011
  5. Roedy Green
    Replies:
    13
    Views:
    2,720
    Roedy Green
    Sep 2, 2012
Loading...

Share This Page