1

I am using a Java program to launch other non-Java applications, and I would like to be able to specify the screen position that the application opens up at. Currently, I'm using

Desktop.getDesktop().open(new File(file));

to open the applications (they are shortcuts). Another option could be to build a process using ProcessBuilder(). How can I specify the starting coordinates for the application? Is there a totally different approach I can use for opening programs that gives me this sort of control?

Zong
  • 6,160
  • 5
  • 32
  • 46
  • 1
    I don't think you can do that, it's up to the program to set their launch location, not the caller – gerrytan Dec 11 '13 at 21:47
  • Which OS are the shortcuts running in? (What kind of shortcuts are they?) –  Dec 11 '13 at 21:47

1 Answers1

0

You can't do it directly from Java, but you can try to use some workarounds. They will be OS based, so you loose the cross platform Java feature, but it should be a fair deal.

In Windows, a workaround could be implemented using a AutoHotKey script, so that Java will call that script instead of directly calling the external application. An AutoHotKey script can launch an application and move its window to a specified point on the screen (documentation here)

Here you can find another stackoverflow answer with a working ahk example.

Community
  • 1
  • 1
Giuseppe Bertone
  • 2,062
  • 15
  • 15