How to make java executable executable in background instead of foreground?

I wrote a shell script to run a set of experiments, so I don’t have to do it manually. The script runs the java.jar file 30 times and runs a set of these 30 times 17 times, changing several variables between them.

I call the program as follows:

java -Djava.library.path=/Users/me/Desktop/Cfiles/DynamicCTGLayout/build/Release  -jar [name of .jar file]

However, I cannot do anything in parallel while the program is running, because when this line is executed, the java executable appears at the front edge of the screen. In fact, when I work on something else, it is interrupted every 1-1.5 minutes. so I look at a few hours, I can’t actually use a computer.

Is there a way to call the executable so that it does not pop up on top of all other programs?

Regards, WhiteTiger

Edit: I am mainly looking for Mac OSX for Windows' equivalent

start /min java [arguments]
+3
source share
5 answers

Use javawinstead java(you may need to make sure it is on the way). This will launch it without a console.

javaw -Djava.library.path=/Users/me/Desktop/Cfiles/DynamicCTGLayout/build/Release -jar [name of .jar file]

+6
source

You can do this in unix by adding a character &at the end of the command line, it pushes the process to the background

+1
source

, JAR. , -Djava.awt.headless=true (. oracle docs ). , :

java -Djava.awt.headless=true -Djava.library.path=/Users/me/Desktop/Cfiles/DynamicCTGLayout/build/Release -jar [name of .jar file]
+1

If you are using a Linux (or an OS using X) cou, you can put the "fake" X server in place using Xvfb and set the DISPLAY variable for the JAVA application to use this error. Disadvantage: you cannot access the graphical interface of the running application (which, in my opinion, is not a problem in your case).

In one shell: Xvfb :2

On another shell: DISPLAY=:2 java -jar ...

0
source

On Windows, you can use:

start /min java [parameters]

This will start the program with the minimum values ​​and will not distract attention. I successfully tested it on Windows 7 Professional x64.

0
source

All Articles