0

[Ubuntu 14.04 no desktop] I have a java console application, and I need to run all time (1st problem), as well as I can re-access the console whenever I want (2nd problem).

To solve the second problem, I use a screen, then run the jar file in it. So that I can re-attach the screen to access my console app.

I am now stuck with the 1st issue. I want to make the screen (along with the java app running inside) autostart with OS. Because I need the app running all time. Anyone give me an idea? I appreciate all your help. Thanks.

0

I would suggest you make a start script for your java application. Starting script: /usr/local/bin/myapp-start.sh Make the script executable and place it in usr/local/bin and simply run it as any other application or add it to startp

example script:

#!/bin/bash

java -jar my_app.jar 

To autostart you can add a line in .bash and make a .desktop file in ~/.config/autostart/

[Desktop Entry]
Type=Application
Exec=command
Name=name
Comment=whatever 
EOF
2
  • Thanks for your reply. But I want to re-attach my app whenever I want. Is there a way to do that without using screen? – Henry Tran Nov 17 '15 at 2:04
  • Yes if you have a starting script placed where the OS searches for executable you can run it from terminal like any other application. By typing the script name in terminal my_script.sh just make sure it is executable. – Maokei Nov 17 '15 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.