Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Help getting program to run as root in shortcut, Java program
timo1023
post Jul 22 2006, 09:57 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 22-July 06
Member No.: 6,819



I can't seem to figure out how to get my .jar program to run as root. I know root is bad, but I need to run it as root all the time. I want to create a shortcut to do this for me, but I can't figure out. I think it has something to do with sudo, but I have no idea where to begin.

Thanks.

Btw, I'm using Ubuntu (You can't log in as root, only sudo)
Go to the top of the page
 
+Quote Post
g33k
post Jul 23 2006, 04:07 AM
Post #2


./configure
***

Group: Support Specialist
Posts: 84
Joined: 18-June 06
Member No.: 6,568



First open up a terminal and then log as root using this
CODE
su

Then enter the root password..and then you can run the jar files using
CODE
java -jar <my_program.jar>

If you want a shortcut i think you will need a shell script..open any text editor and then type this
CODE
#!/bin/sh
su -c "java -jar <my_program.jar>"

then save this file as myprog.sh..then link this file to /bin or /usr/bin with
CODE
su
chmod +x <path to the .sh file>
ln -s <full path to the sh file> /bin/myprog

Now you can invoke your java program using the shortcut
CODE
myprog


--------------------
-- a *certified* n00b

"The best is Yet to come !"

My Desktop : OpenSuSE 10.1 | FVWM-Crystal | MPD | Gaim | Opera | Mrxvt
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 18th October 2017 - 06:17 AM