Qvatra
Qvatra

Reputation: 3857

start program from bash script

I have a batch file for windows containing following:

start "" javaw -jar %~p0/app.jar

How to get the same command in a Bash script?

Upvotes: 1

Views: 3166

Answers (3)

Jenson Jose
Jenson Jose

Reputation: 532

I assume its a Java Swing (GUI based) app. You should be able to execute it using this:

cd /path/to/app
java -jar myApp.jar

Simply paste this code as it is in your bash script. The "cd" should take care of path issues. Do note, that the terminal will be freed only when the Java app is exited.

Upvotes: 1

khachik
khachik

Reputation: 28703

root=`dirname "$0"` # in case if I got %~p0
nohup javaw -jar "$root/app.jar" &

starts javaw in background.

Upvotes: 2

Zombo
Zombo

Reputation: 1

Perhaps open

open javaw -jar ${0%/*}/app.jar

Upvotes: 1

Related Questions