Add JAR to startup with terminal window
Hello all, i am fairly new to Linux, I've been reading a bit about how to add an application to the startup execution in RHEL. I found this:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Installation_Guide/s1-boot-init-shutdown-run-boot.html
But I would like for the application to open a terminal window automatically, is this possible? Any ideas?
I already have my JAR file...
Regards,
Hector
Responses
Hi Hector,
First of all, the documentation you refer to is for Red Hat Enterprise Linux 5 -- that's very old. Unless you have some very specific reason to run an old version of the system, you should install version 7.
As you say you want to open a terminal window, I assume you're asking about automatic startup in the graphical environment. In RHEL 7, applications that are automatically run on session start are configured through the following menu item: Applications -> System Tools -> Startup Applications.
There you click on "Add" a enter the required application. You say that you would like to have the application run in a terminal window. This is what your command should look like:
gnome-terminal -e java -jar your_jar_file
We're telling the session manager to start the gnome-terminal application (the default terminal emulator in RHEL 7) and to execute from it the java command with your JAR file.
If you need to set this up for all users on the system, see Adding an Autostart Application for All Users in the Desktop Migration and Administration Guide.
Gentlemen,
Are you talking about the same thing?
@Hector: starting a java application at server reboot time which requires input from a terminal screen is not a way a system administrator would be happy with. It could cause a server to hang, as the input would have to be provided from the console screen.
@Robert: Does your option need a full desktop, or would it also work with a ssh session with X11 forwarding opening just a single application?
Kind regards,
Jan Gerrit Kootstra
Hi Jan,
As I wrote in my first reply, I assumed that Hector wanted to run his application in a GUI environment (he mentioned a terminal 'window').
So, yes, the method I described requires a full GNOME session. To autostart an application in a command-line environment, I'd use ~/.bash_profile or something similar.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
