Hi,
I am trying to create and register a windows service with the following
code.
require “rubygems”
require “win32/service”
include Win32
svc = Service.new(:service_name => “rajiv_service_name”)
Error:
C:/Ruby/lib/ruby/gems/1.8/gems/win32-service-0.7.1-x86-mswin32-60/lib/win32/service.rb:368:in
initialize': Access is denied. (Win32::Service::Error) from C:/Users/Rajiv/Documents/NetBeansProjects/MusicClockService/lib/register_bar_1.rb:9:in
new’
from
C:/Users/Rajiv/Documents/NetBeansProjects/MusicClockService/lib/register_bar_1.rb:9
I tried changing to:
svc = Service.new(:service_name =>SERVICE_NAME,
:service_start_name => “HOME\Rajiv”,
:password => “my_pwd” )
but it still did not work.
Thanks,
Rajiv
Rajiv A. wrote:
Hi,
I am trying to create and register a windows service with the following
code.
require “rubygems”
require “win32/service”
include Win32
svc = Service.new(:service_name => “rajiv_service_name”)
Error:
C:/Ruby/lib/ruby/gems/1.8/gems/win32-service-0.7.1-x86-mswin32-60/lib/win32/service.rb:368:in
initialize': Access is denied. (Win32::Service::Error) from C:/Users/Rajiv/Documents/NetBeansProjects/MusicClockService/lib/register_bar_1.rb:9:in
new’
from
C:/Users/Rajiv/Documents/NetBeansProjects/MusicClockService/lib/register_bar_1.rb:9
I tried changing to:
svc = Service.new(:service_name =>SERVICE_NAME,
:service_start_name => “HOME\Rajiv”,
:password => “my_pwd” )
but it still did not work.
Thanks,
Rajiv
Just adding to the previous post, if it helps:
- I installed the win32-services gem using gem install win32-service
–platform=mswin32
- The doc. says that only :service_name is mandatory. So, it is bit
surprising that it does not work
- User Rajiv is Administrator
On Apr 15, 8:10 am, Rajiv A. [email protected] wrote:
Error:
svc = Service.new(:service_name =>SERVICE_NAME,
–platform=mswin32
- The doc. says that only :service_name is mandatory. So, it is bit
surprising that it does not work
- User Rajiv is Administrator
Is the prompt from where are you invoking the ruby script running with
elevated privileges?
On Vista and 7 even when user is Administrator it needs UAC elevation
to properly modify registry related to system
Luis L. wrote:
On Apr 15, 8:10�am, Rajiv A. [email protected] wrote:
Error:
svc = Service.new(:service_name =>SERVICE_NAME,
–platform=mswin32
- The doc. says that only :service_name is mandatory. So, it is bit
surprising that it does not work
- User Rajiv is Administrator
Is the prompt from where are you invoking the ruby script running with
elevated privileges?
On Vista and 7 even when user is Administrator it needs UAC elevation
to properly modify registry related to system
Thanks Luis !
I run the file from netbeans 6.8 and you set me on the right path.
Based on your answer, I poked about a bit and found
[Netbeans issue - JRuby - Ruby-Forum] where Philippe Rubyeye
provided an easy alternative(Running Netbeans as administrator).