I'runnig jar file(from an other java code) using .batch file that contain this cmd : java -jar monJar.jar
My problem that i have 2 screens devices and i want to run this jar always in second one.
Is there is java code to choose that screen.
But I would check if the array returned by getScreenDevices() contains at least two elements before using  (if not use the only element). If you run your application on a machine with only one screen you'll now get an ArrayIndexOutOfBoundsException.