@@ -296,11 +296,14 @@ def launch(self):
296296 elif not self .loginBox .text ().isalnum ():
297297 raise TypeError ("Username not alphanumeric!" )
298298
299- self .launchArgs = ["java" ]
299+ self .launchArgs = []
300+ if self .instanceConfig ["javaloc" ] != "" :
301+ self .launchArgs .append (self .instanceConfig ["javaloc" ])
302+ else :
303+ self .launchArgs .append ("java" )
300304 for arg in self .instanceConfig ["javaargs" ].split (" -" ):
301305 if not len (arg ) < 3 :
302306 self .launchArgs .append ("-" + arg )
303-
304307 if self .instanceConfig ["proxyskin" ] or self .instanceConfig ["proxysound" ] or self .instanceConfig ["proxycape" ]:
305308 self .proxy = utils .minecraftProxy (doSkinFix = self .instanceConfig ["proxyskin" ], doSoundFix = self .instanceConfig ["proxysound" ], doCapeFix = self .instanceConfig ["proxycape" ], loop = asyncio .new_event_loop ())
306309 self .proxy .start ()
@@ -347,7 +350,7 @@ def launch(self):
347350 self .launchArgs = []
348351 except Exception as e :
349352 # Tragic.
350- self .error ("Minecraft is unable to start. Make sure you have java and minecraft installed and an alphanumeric username set.\n Check your launch args if you have set any too." )
353+ self .error ("Minecraft is unable to start. Make sure you have java and minecraft installed and an alphanumeric username set.\n Check your launch args and java location if you have set any too." )
351354 utils .logger .info ("Rejected username: " + self .loginBox .text ())
352355 utils .logger .info (e )
353356
@@ -508,6 +511,23 @@ def createConfigTab(self):
508511 self .enableAutoProxyCape .setChecked (mainWin .instanceConfig ["proxycape" ])
509512 self .enableAutoProxyCape .move (150 , 137 )
510513
514+ self .javaLoc = QLineEdit (self .configTab , text = mainWin .instanceConfig ["javaargs" ])
515+ self .javaLoc .resize (310 , 24 )
516+ self .javaLoc .move (150 , 160 )
517+
518+ try :
519+ mainWin .instanceConfig ["javaloc" ]
520+ except :
521+ mainWin .instanceConfig ["javaloc" ] = ""
522+ self .javaLoc = QLineEdit (self .configTab , text = mainWin .instanceConfig ["javaloc" ])
523+ self .javaLoc .resize (310 , 24 )
524+ self .javaLoc .move (150 , 160 )
525+
526+ self .getJavDirButton = QPushButton ("..." , self .configTab )
527+ self .getJavDirButton .resize (24 , 22 )
528+ self .getJavDirButton .move (465 , 160 )
529+ self .getJavDirButton .clicked .connect (self .getJavDir )
530+
511531 # Labelz
512532 self .javaArgsLabel = QLabel (self .configTab , text = "Java arguments:" )
513533 self .javaArgsLabel .resize (100 , 20 )
@@ -549,11 +569,20 @@ def createConfigTab(self):
549569 self .enableAutoProxyCapeLabel2 .resize (250 , 20 )
550570 self .enableAutoProxyCapeLabel2 .move (170 , 132 )
551571
572+ self .javaArgsLabel = QLabel (self .configTab , text = "Java location:" )
573+ self .javaArgsLabel .resize (100 , 20 )
574+ self .javaArgsLabel .move (20 , 160 )
575+
552576 def getDir (self ):
553577 fileName , _ = QFileDialog .getOpenFileName (self , "Select a Mod ZIP File" , os .path .expanduser ("~" ), "Mod Archive (*.zip;*.jar)" )
554578 if fileName :
555579 self .modZipDir .setText (fileName )
556580
581+ def getJavDir (self ):
582+ fileName , _ = QFileDialog .getOpenFileName (self , "Select a JRE" , os .path .expanduser ("~" ), "JRE (*)" )
583+ if fileName :
584+ self .javaLoc .setText (fileName )
585+
557586
558587 # Fires when options window is closed.
559588 def closeEvent (self , event , * args , ** kwargs ):
0 commit comments