Determining the version of Java SDK on the Mac

后端 未结 6 538
面向向阳花
面向向阳花 2021-01-31 01:21

I have a MacBook Pro running Snow Leopard; how can I see what version of the Java SDK is installed on my Mac?

相关标签:
6条回答
  • 2021-01-31 01:53

    On modern macOS, the correct path is /Library/Java/JavaVirtualMachines.

    You can also avail yourself of the command /usr/libexec/java_home, which will scan that directory for you and return a list.

    0 讨论(0)
  • 2021-01-31 01:58

    In /System/Library/Frameworks/JavaVM.framework/Versions you'll see all the installed JDKs. There is a symbolic link named CurrentJDK pointing the active JDK.

    0 讨论(0)
  • 2021-01-31 01:59

    Open a terminal and type: java -version, or javac -version.

    If you have all the latest updates for Snow Leopard, you should be running JDK 1.6.0_20 at this moment (the same as Oracle's current JDK version).

    0 讨论(0)
  • 2021-01-31 01:59

    Run this command in your terminal:

    $ java -version
    
    java version "1.8.0_181"
    Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
    Cristians-MacBook-Air:~ fa$ 
    
    0 讨论(0)
  • 2021-01-31 02:04

    The simplest solution would be open terminal

    $ java -version
    

    it shows the following

    java version "1.6.0_65"
    
    1. Stefan's solution also works for me. Here's the exact input:

    $ cd /System/Library/Frameworks/JavaVM.framework/Versions

    $ ls -l

    Below is the last line of output:

    lrwxr-xr-x   1 root  wheel   59 Feb 12 14:57 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
    

    1.6.0.jdk would be the answer

    0 讨论(0)
  • 2021-01-31 02:17

    Which SDKs? If you mean the SDK for Cocoa development, you can check in /Developer/SDKs/ to see which ones you have installed.

    If you're looking for the Java SDK version, then open up /Applications/Utilities/Java Preferences. The versions of Java that you have installed are listed there.

    On Mac OS X 10.6, though, the only Java version is 1.6.

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