BinkanSalaryman / Discord-Audio-Stream-Bot

A simple discord audio streaming bot.
228 stars 38 forks source link

Use Java 11 with both 16 and 11 installed #49

Closed FoxyLight closed 3 years ago

FoxyLight commented 3 years ago

Ok this may be a dumb question but I've searched and searched and cannot figure it out. I had java 11 installed and the bot worked perfectly. Now I've hat to install java 16 as well to run a minecraft server. I've tried messing with JAVA_HOME and path locations to see if I can get the bot to use 11 and the MC server to use 16. Is there any way I can accomplish this. I've reached my level of competence and would be grateful for any assistance.

This is what I get when trying to run the bot. image

Thank you,

FoxyLight

This is also my app.log file: app.log

BinkanSalaryman commented 3 years ago

Hey, what you mentioned should be possible if you slightly adjust the startup command (which is basically the entire content of either .bat file) to use a specific java version. You would need to specify the path to the intended java executable to prevent it from using the JAVA_HOME or PATH environment variable to resolve the full, absolute path - Create a backup of the batch file in question and change line 2 from

start javaw -Djava.library.path=.......etc.......

to something like this

start "C:/path/to/java 11/javaw.exe" -Djava.library.path=.......etc.......

(quotation marks around the path are necessary if it contains whitespace characters)

FoxyLight commented 3 years ago

Hey thx for the response @BinkanSalaryman. Yeah this is basically what I ended up doing just a couple hours ago in just slightly different way. Was going to come and close the ticket. What I did was setup a new JAVA11_HOME system variable pointing to the java 11 dir. Renamed javaw in that dir to javaw11. And then just edited you bat file to call javaw11 instead. Maybe an amateurish workaround but it worked and I can run both bot and server simultaneously now.

Thanks for the response and for the bot, my wife and I use it to listen to audiobooks together when we're away so its an amazing tool for us to stay connected. Really appreciate it.