Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

where-is-java

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

where-is-java

Lists all java versions installed conditionally

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Where is Java

finds all java versions on any platform syncronously.

API

import fs from 'fs'
import cp from 'child_process'
import WhereIsJava from 'where-is-java'
const listOfJavaVersions = WhereIsJava({ // all arguments are optional
  version: '>1.8',
  mustBeJDK: true,
  mustBeJRE: false,
  mustBe64Bit: true,
  mustBeArm: false
})

const myJava = listOfJavaVersions.find(java => java.default)
cp.spawnSync(myJava.home + '/bin/javac', ['MyJavaClass.java'])

Example Response

[
  {
    version: '17.0.2',
    vendor: 'Oracle Corporation',
    home: '/Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home',
    is64Bit: true,
    isArm: false,
    isX86: true,
    isJDK: true,
    default: true
  },
  {
    version: '17.0.1',
    vendor: 'Eclipse Adoptium',
    home: '/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home',
    is64Bit: true,
    isArm: true,
    isX86: false,
    isJDK: true
  },
  {
    version: '16.0.1',
    vendor: 'AdoptOpenJDK',
    home: '/Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home',
    is64Bit: true,
    isArm: false,
    isX86: true,
    isJDK: true
  },
  {
    version: '1.8.0_312',
    vendor: 'Temurin',
    home: '/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home',
    is64Bit: true,
    isArm: false,
    isX86: true,
    isJDK: false
  }
]

FAQs

Package last updated on 05 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc