CLI Java Detection
This commit is contained in:
parent
948ae90e50
commit
f966f7b29f
1 changed files with 9 additions and 4 deletions
|
@ -38,6 +38,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
|
||||||
* @author Konloch
|
* @author Konloch
|
||||||
* @since 7/11/2021
|
* @since 7/11/2021
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ExternalResources
|
public class ExternalResources
|
||||||
{
|
{
|
||||||
private static final ExternalResources SINGLETON = new ExternalResources();
|
private static final ExternalResources SINGLETON = new ExternalResources();
|
||||||
|
@ -60,12 +61,16 @@ public class ExternalResources
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BytecodeViewer.sm.pauseBlocking();
|
BytecodeViewer.sm.pauseBlocking();
|
||||||
//TODO read the version output to verify it exists
|
//read the version output to verify it exists
|
||||||
ProcessBuilder pb = new ProcessBuilder("java", "-version");
|
ProcessBuilder pb = new ProcessBuilder("java", "-version");
|
||||||
pb.start();
|
Process p = pb.start();
|
||||||
|
p.waitFor();
|
||||||
|
|
||||||
Configuration.java = "java"; //java is set
|
if(readProcess(p).toLowerCase().contains("java version"))
|
||||||
return Configuration.java;
|
{
|
||||||
|
Configuration.java = "java"; //java is set
|
||||||
|
return Configuration.java;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) { } //ignore
|
catch (Exception e) { } //ignore
|
||||||
finally
|
finally
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue