1

I'm having a problem executing a shell script in ubuntu, the script is set as executable and I enabled the execute instead of view option in Nautilus and the script does what it's meant to do which is launch a java jar, but it doesn't open the terminal and the app requires interaction from the terminal to function. How do I make it so that it runs the script from within terminal?

Also, I'm using Ubuntu 14.04 LTS and here is the script:

#!/bin/bash
java -jar example.jar
juanjalvarez
  • 63
  • 1
  • 9

1 Answers1

2

You can run your java command in a gnome-terminal this way:

gnome-terminal -x bash -c "java -version; bash"

Or to take your example:

gnome-terminal -x bash -c "java -jar example.jar; bash"

You could even specify where to run your command:

gnome-terminal --working-directory=WORKING_DIR -x bash -c "java -jar example.jar; bash"

Running a bash command after the java one allow gnome-terminal to stay open even after the command is completed.