简体   繁体   中英

How Can I Use a Java Application Instead of Desktop?

I want to make a Java Application that will start automatically when I start the computer and will run instead of the desktop, so the desktop-terminal etc will be unreachable for users. The users must use nothing but the application and when they close the application, the computer also must be turned off automatically. How can I do such a thing for a simple Java Application (jar)?

Shortly, for ubuntu you have to:

  • Remove desktop environment, just look around for some guides, it depends by which desktop you have (GNOME, XFCE, KDE, etc). https://askubuntu.com/a/147870

  • Add a script in /etc/rc.d and link it in rcS.d https://unix.stackexchange.com/a/83752 .
    The script have to run your application, wait for end and shutdown, an example could be:

     #./bin/bash nohup java -jar MyApp.jar & wait /sbin/shutdown -r now

Try this in a virtual machine that you can reach in SSH or in some other ways, after you removed desktop environment, you cannot open a terminal.

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