convergedtarkus
convergedtarkus

Reputation: 697

Launching a .class file with java with a script

I'm trying to use a nautilus script in Ubuntu 11.04 to launch the currently selected file in java. So i'm trying to do java FileName in a script. Currently I have

!/bin/bash
test = 'java' + $@
/usr/bin/gnome-terminal -e test

My question is why this doesn't work. I've been able to get it to work if I pass a string of the full file name, like

!/bin/bash
/usr/bin/gnome-terminal -e '!/etc/etc/etc/test.class'

But that doesn't let me open the current file, so how can I pass the currently selected file into it, I also tried 'java' + test to, that didn't work either. Thanks for the help!

Upvotes: 0

Views: 293

Answers (1)

Jonathan M
Jonathan M

Reputation: 17451

Try this. The $ tells it $test is a variable, but $ is only used after the variable is assigned, so the second line is unchanged.

!/bin/bash
test = 'java ${@}'
/usr/bin/gnome-terminal -e $test 

Upvotes: 1

Related Questions