Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to force the resolution of a window created by a java ".jar" file?

I've got this application .jar provided by an outside source which launches a GUI. Unfortunately the original developers did not consider the possibility that this is on a laptop that has a maximum resolution of 1366x768. By default, the window is too tall and runs off the top and bottom of the screen (centered).

The program is wrapped by a small .exe and I'm wondering if I could say:

java -jar *.jar width=x height=y

or

*.exe --width x --height y

or something?

like image 640
UndeadBob Avatar asked Dec 05 '25 04:12

UndeadBob


1 Answers

In Java, there are two kinds of parameters:

  • program parameters: the program is coded to search those parameters and react accordingly. Of course, there are no "standard" values, it will only work if the programmer did thinking of checking for a "width" parameter and decided to use that to resize the windows

  • VM parameters, which are passed to the JVM and not to the program. Again dependent of the VM implementation, I have never seen any parameter that limits the size of a window (and if there were one, the most likely result would be that the exception would fail when it tried to open a window too big). For example: http://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html

Additionally, fixed size GUI are considered bad design (for reasons that you have already noticed) and the odds are, that even if you modify the application (v.g., decompiling it), changing the size of the windows will lead to other issues (like controls being outside the window, or the window getting disorganized).

Note: Since your comment states that resizing the window does allow for everything to be displayed nicely, then maybe it is doable to decompile the code and recompile it with more flexible settings. Also, unzip the .jar and search if you are lucky enough that the size is defined in some .properties file (which are plain text).

like image 104
SJuan76 Avatar answered Dec 06 '25 21:12

SJuan76