LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-03-2008, 04:27 AM   #1
ussr_1991
LQ Newbie
 
Registered: Jan 2007
Location: Singapore
Distribution: Windows XP,Mac OS X 10.4
Posts: 24

Rep: Reputation: 15
Help on associating .java files onto jGrasp in Ubuntu 8.04 LTS


I would like to seek help on using double-click to open .java files using jGrasp IDE (Which is one used by my school) in Ubuntu Hardy.

For some reason, other than I managed to use Sun Java 6 Runtime to execute the jgrasp.jar, I managed to add it on the Applications Menu -> Programming by adding the command as: "jexec /bin/jgrasp/jgrasp.jar" without quotes as well as add an icon at "/bin/jgrasp/data/gric48.xpm".

Now the problem is, I must always come to this launcher to open jGrasp, even if my already created .java source code. I would like to open them using double-click , just like in my Mac or Windows Machine. Why Linux cant. I tried type the same code "jexec /bin/jgrasp/jgrasp.jar" without quotes on Open Using Applications (Using Right click) but the thing will not respond at all. (Terminates as soon as it is started.) . I am sure it is not jgrasp or Sun Java's installation error because no error message shown when running jGrasp using launcher. Now, I would like my java source code to be like any Open Office files, just double-click the file and jGrasp runs. All of my software are latest version, now what should I do??
 
Old 08-04-2008, 05:08 PM   #2
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
I can show you how to use a right-click. You'll need to use Nautilus-actions for this to work.

Write a little script like:

#! /bin/bash
FILE=$1
jgrasp $FILE
(you may need to specify the full command to run jgrasp if you haven't got a script called "jgraps" that launches jgrasp directly).

Save this to a file, call it whatever you like, run a chmod +x and place it wherever you like (I like to put this kind of stuff in a bin folder inside my home directory.)
Next, go to System > Preferences > Nautilus Actions Configuration. Click add and fill out the fields.
The next time you right-click a file, there should be an option to open it with jgrasp.
 
Old 08-05-2008, 03:57 AM   #3
ussr_1991
LQ Newbie
 
Registered: Jan 2007
Location: Singapore
Distribution: Windows XP,Mac OS X 10.4
Posts: 24

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jay73 View Post
I can show you how to use a right-click. You'll need to use Nautilus-actions for this to work.

Write a little script like:

#! /bin/bash
FILE=$1
jgrasp $FILE
(you may need to specify the full command to run jgrasp if you haven't got a script called "jgraps" that launches jgrasp directly).

Save this to a file, call it whatever you like, run a chmod +x and place it wherever you like (I like to put this kind of stuff in a bin folder inside my home directory.)
Next, go to System > Preferences > Nautilus Actions Configuration. Click add and fill out the fields.
The next time you right-click a file, there should be an option to open it with jgrasp.
Sorry, I cannot do it. I created a new file, with
Code:
#! /bin/bash
FILE=$1
jgrasp $FILE
and then save it as jGrasp and run terminal chmod +x /root/.nautilus/jGrasp (I tested it out on root) and what is next. I do not get the point of Nautilus Actions Configuration. Do you mean Applications-> System Tools -> Confiuration Editor? I cannot find exact word of Nautilus Actions Configuration.

And where can i add the key. This is like regedit to me, in GNU/Linux way.
 
Old 08-05-2008, 05:09 AM   #4
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
No, I mean System > Preferences > Nautilus Actions.

It should work. I wrote a little script the other day that copies files to my Apache folder. Here it is:
Quote:
#! /bin/bash

FILE=$1
zenity --entry \
--title="Move file to apache folder" \
--text="Enter your user password:" \
--entry-text "" \
--hide-text | sudo -S cp $FILE $HOME/Apache/
As you can see, it also pops up an authorization box to ask for my password.

The next step was adding the path to this script to Nautilus Actions. Now I can copy by right-clicking.
 
Old 08-07-2008, 03:02 AM   #5
ussr_1991
LQ Newbie
 
Registered: Jan 2007
Location: Singapore
Distribution: Windows XP,Mac OS X 10.4
Posts: 24

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jay73 View Post
No, I mean System > Preferences > Nautilus Actions.

It should work. I wrote a little script the other day that copies files to my Apache folder. Here it is:

As you can see, it also pops up an authorization box to ask for my password.

The next step was adding the path to this script to Nautilus Actions. Now I can copy by right-clicking.

Ok, I think I know the reason why. If LQ is / has a file server, I will definitely upload my screen shot to show that I really cannot find Nautilus Actions. However, I went to Google for it and realized that I would need to install a package called nautilus-actions. Ok, I bet that newbie will never find if there is no relavant computing experience at all. So I also install nautilus-gksu as well (I thought it can right click run as sudo etc like Vista "Run as Administrator", but it does not seemed so.)

So this was what i do:
Step 1:

#! /bin/bash
FILE=$1
jgrasp $FILE

Step 2: Using Terminal run chmod +x /home/samuel/.nautilus/jGrasp

Step 3: Install nautilus-action package, it is not installed by default.

Step 4:
In Menu Item & Action tab:
Label: Open with jGrasp
Tools hint: Opens java applications and source code with jGrasp
Icon: /bin/jgrasp/data/gric.ico
Directory: /home/samuel/.nautilus/jGrasp
Parameters: (Leave it blank)

In Conditions:
Filenames: java (Or .java, I tried both)
Match case: (Uncheck)
Mime types: Leave as defaults.
Appear if selection contains: "Only file"
Appear if selection has multiple files or folders: (Checked)

In Advance Conditions:
All check (Regardless where the file is saved, it can work. Is this the case, there is things like SMB, Local file etc. I think it means using whatever file sharing protcols, shall this script work. Am i wrong in my assumption here?)

So what is the problem here?
 
Old 08-07-2008, 03:13 AM   #6
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Quote:
Filenames: java (Or .java, I tried both)
have you tried *java ?

Also, I use %M as a parameter.

Last edited by jay73; 08-07-2008 at 03:15 AM.
 
Old 08-09-2008, 09:10 AM   #7
ussr_1991
LQ Newbie
 
Registered: Jan 2007
Location: Singapore
Distribution: Windows XP,Mac OS X 10.4
Posts: 24

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jay73 View Post
have you tried *java ?

Also, I use %M as a parameter.

Finally, it can be a success but too bad that the file will not open (So right click will give a jGrasp without the actual file open). Anyway, what makes me cannot understand is that why most of the file, be it executable or binary .doc / .ppt or open standard like .odt, .odp etc can avoid such hassle but .java!?


%M parameters will not even open jGrasp at all (But it is a valid parameter according to legend.)
 
Old 07-25-2009, 04:38 AM   #8
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Wheezy (Fluxbox WM)
Posts: 1,363
Blog Entries: 52

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
double click in Java

Sorry, I misunderstood the question, please ignore this post.

Last edited by neonsignal; 07-25-2009 at 04:44 AM.
 
Old 07-27-2009, 03:59 PM   #9
lbarowski
LQ Newbie
 
Registered: Jul 2009
Posts: 1

Rep: Reputation: 0
This thread is quite old, but to answer the question, you need to start jGRASP using the native executable and use that executable when sending filenames to be opened. The easiest way to do that is to start jGRASP using the bin/jgrasp script (/bin/jgrasp/bin/jgrasp for your installation location), which will find the appropriate native executable and run it. You can use the same script to send filenames.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: I update Ubuntu 6.06 LTS and 8.04 LTS ... one has SSH issues, one does not LXer Syndicated Linux News 0 05-20-2008 07:30 AM
Associating Files with Programs in Gnome Cinematography Linux - Software 2 05-25-2005 06:40 PM
Adjusting my profile for java/jGRASP use Beeker Linux - Software 4 03-15-2005 01:50 PM
Fedora Core 1 Associating .jar files with java -jar command pymehta Fedora 0 01-13-2005 05:26 AM
Associating Torrent Files JonBrant Mandriva 2 07-21-2004 10:10 PM


All times are GMT -5. The time now is 01:03 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration