com.microsoft.java.debug.plugin.internal.ResolveJavaExecutableHandler Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2020 Microsoft Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Microsoft Corporation - initial API and implementation
*******************************************************************************/
package com.microsoft.java.debug.plugin.internal;
import java.io.File;
import java.util.List;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
import com.microsoft.java.debug.core.Configuration;
public class ResolveJavaExecutableHandler {
private static final Logger logger = Logger.getLogger(Configuration.LOGGER_NAME);
private static final String[] javaExecCandidates = {
"java",
"java.exe",
"javaw",
"javaw.exe",
"j9",
"j9.exe",
"j9w",
"j9w.exe"
};
private static final String[] javaBinCandidates = {
File.separator,
"bin" + File.separatorChar,
"jre" + File.separatorChar + "bin" + File.separatorChar
};
/**
* Resolve the java executable path from the project's java runtime.
*/
public static String resolveJavaExecutable(List