Wednesday, May 8, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 8354  / 3 Years ago, mon, october 4, 2021, 5:04:06

I want to make a script that will execute .jar file on selected file. Later I will add that script to right-click menu via the tool Nautilus Actions or just place it into nautilus-scripts folder. I have a problem creating script.



When I am in a usual console screen and want to execute this jar file on any other file, I use this syntax



myfile.jar ./someotherfile.xml



and the jar file will write the output to the console screen.



So I created a file script.sh, added lines in it



#!/bin/bash
/home/username/myfile.jar $1


But it does not output anything. I know I am doing something wrong. Please help.



To sum, I need a script that will use selected file as a parameter, open the gnome-terminal, inside that terminal it will start JAR file and pass it the selected file.



I am confident that this is a very simple procedure, but I am total newbie with shell scripting.


More From » scripts

 Answers
2

You might also go for



!/bin/sh
gnome-terminal -x java -jar /home/askmoo/myfile.jar "$1"


in order to first open gnome terminal and then execute your java application in it. This way you would be able to get output printed out to the terminal.


[#44488] Tuesday, October 5, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
algicuade

Total Points: 317
Total Questions: 89
Total Answers: 106

Location: Saint Pierre and Miquelon
Member since Fri, Jan 28, 2022
2 Years ago
;