-
Notifications
You must be signed in to change notification settings - Fork 159
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
Add java check to launcher #635
base: master
Are you sure you want to change the base?
Add java check to launcher #635
Conversation
Added the 32/64-Bit check. As of yet I only tested the I used these links to find out how to do the checks for Windows: |
Looks good, but I have one suggestion; can you check for the lack of "64-bit" in the output, rather than the presence of "32-bit"? From what I've seen, some 32-bit versions of Java don't list that they are 32-bit in their |
0291314
to
d1b3190
Compare
Good idea! I inverted the checks! :) Still only tested it on linux though, because I have no easy access to Mac or Windows right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried the changes on Windows today, and they don't work. Specifically, the 32 vs. 64-bit check doesn't work properly, and actually causes the batch file to exit early. However, I discovered a simple way of checking it:
@echo off
java -version 2>&1 | findstr /i "64-Bit" >nul:
if errorlevel 1 (
echo 32-Bit
) else (
echo 64-Bit
)
echo Press any key to exit...
pause >nul
Could you incorporate something like this into the Windows launcher? It doesn't have to exactly match this; I'm mainly just asking you to use java -version 2>&1 | findstr /i "64-Bit" >nul:
and then check the errorlevel
.
launcher/launcher_WINDOWS.bat
Outdated
where java >nul 2>nul | ||
if %errorlevel%==1 ( | ||
@echo Java is not installed. | ||
exit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing with the exits in the Windows launcher too.
Also, I tried it on a Mac that never had Java installed, and calling
This is apparently enough for the first part of the script to pass. It still fails out, but it thinks that 32-bit Java is installed instead of no Java being installed. I think this is an acceptable issue, but if you have any good ideas on how to catch this case, feel free to incorporate them into your Mac launcher. |
I'll see that I set up access to windows and macOs so I can test all launcher scripts. On linux at least the terminal doesn't close when you call exit. I thought for at least on a Mac it would be the same. |
On Windows and Mac, users don't use the launcher by opening them from the terminal/command prompt. They double-click on the scripts, and it will automatically open a terminal/command prompt window to run the script. If you call |
I finally got around to test each launcher on their respective systems. For Mac, I added the exit buffers, On Mac, I also changed the java-version message to "Wrong Java version: No Java or Java 32-Bit instead of 64-Bit is installed.". So in the case of the prompt when no Java is installed, the error message at least reads correctly. On Windows, the |
9f49428
to
70df48c
Compare
So issues like these won't happen: #606
I also want to look into how to check whether java 32-bit is installed and report that as well, so issues like these #615 #608 happen less frequent. People just don't read the wiki that often.
I don't know whether the
launcher_MAC.command
syntax is correct and have no way to check right now. I just assumed it's bash as well.