At what point is it getting stuck? Your Java app should open a browser window pointing to Twitch. You should permit the app access, which redirects you back to the app’s callbackUri, which tells the app the it’s found the token and the authorization should be successful.
If you never get a browser window, then your code is breaking when it tries to open a browser. If it never gets past authorizing the app with Twitch (ie you’re redirected back and nothing happens), java.awt.Desktop.getDesktop().browse may be a blocking call that you need to initiate in a separate thread.