8000 EV3: Try JAVA_HOME, then 1st available java in PATH on Windows by iakov · Pull Request #1842 · trikset/trik-studio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

EV3: Try JAVA_HOME, then 1st available java in PATH on Windows #1842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions installer/platform/trik-studio.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
@echo off
title TRIK Studio Safe Mode
FOR /F "tokens=* USEBACKQ" %%F IN (`where java 2^>NUL`) DO (SET JAVA_PATH=%%~dpF)
set PATH=%SystemRoot%;%SystemRoot%\system32;%JAVA_PATH%
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 ECHO Failed to enable extensions
TITLE TRIK Studio Safe Mode
rem if JAVA_HOME is missing try to find the first Java executable in PATH
IF DEFINED JAVA_HOME (ECHO JAVA_HOME is "%JAVA_HOME%" && set JAVA_PATH=%JAVA_HOME%\bin) ^
ELSE (
java -version 2>NUL
IF ERRORLEVEL 1 ECHO Missing working java.exe in PATH="%PATH%"
FOR /f "usebackq tokens=1* delims=:" %%F IN (`where java 2^>NUL ^| findstr /n "^"`) DO @IF %%F == 1 ( ECHO Using Java: "%%G" && SET JAVA_PATH=%%~dpG)
)
rem Clear PATH after Java detection attempt 4EBB
SET PATH=%SystemRoot%;%SystemRoot%\system32
IF "%JAVA_PATH%" == "" ( ECHO Failed to detect Java/JRE ) ELSE (SET PATH=%PATH%;%JAVA_PATH%&& java -version)
ENDLOCAL

%~dp0trik-studio.exe "%*"
Loading
0