简体   繁体   中英

How to reset or kill JVM context?

I am running a simple java client through java <class file> command. The java command is actually invoked by a system process. This is on Unix.

We were facing problem with X11 Display. So we added export DISPLAY=:0.0 in the startup file and the Display problem was resolved. Now when the export DISPLAY=:0.0 line is removed from the startup file and the java client is run again, we are not able to revert to old state, ie, we no longer get the X11 Display error. So there is something that is persisting on the system. Is there any way to make sure the JVM context was killed before running the client?

We have killed the process that triggers the java client, then restarted the process to run the java client again. But not succeeded to go back to the old state.

[Edit] I forgot to mention that I have already tried "unset DISPLAY" in the stop file. The startup fie is run when the environment is brought up and the stop file is run when the environment is brought down. I have also tried headless mode but that doesn't work for our program.

If you have previously executed the export command in the current shell (from the startup file, even), then the value is in your environment. Unsetting it (or getting a new shell with a clean environment) is the only way to get rid of the environment setting.

I would suggested adding a line to your startup script to echo $DISPLAY, so that it will be obvious what is currently set while you're troubleshooting the problem.

If your process doesn't actually need the xwindows display, you should start the JVM in headless mode. Details are here .

You probably set the DISPLAY environment in the shell. Try typing "export DISPLAY=" or "unset DISPLAY".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM