1

I have an executable jar file but no access to the code so I cannot use any method to like myFrame.toFront(); or myFrame.someThingElse(); to bring the window to the front.

But every time I do java -jar something.jar a window opens behind everything that is already on the screen so I would like to bring the GUI to the front of the screen using a command line argument.

dimo414
  • 47,227
  • 18
  • 148
  • 244
I J
  • 47
  • 6
  • Which OS? Windows? – Rob Audenaerde Nov 02 '16 at 15:25
  • Mac OSX I was packaging the jar for both but the the problem appears to occur only to Mac users. – I J Nov 02 '16 at 15:31
  • "*but no access to the code*" "*I was packaging the jar*" could you clarify your situation further? If you are creating the jar you must have *some* sort of access to the code being executed. You could, for instance, insert a `.toFront()` call with [bytecode manipulation](http://stackoverflow.com/q/37124239/113632) or define your own `main()` method that delegates to the existing `main()` method and uses reflection to make the calls you need. – dimo414 Nov 02 '16 at 17:10
  • I am not creating the jar file it is given to me so I am just trying to package it as an app for Mac – I J Nov 02 '16 at 21:32

0 Answers0