I have a rails app and a jar file. I want my jar file to execute when the user presses a button on the webpage. Please tell me how to do that. Any help will be highly appreciated. Thanks in anticipation. :) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You can use system call to execute jar file. # Change to the directory where jar resides Dir.chdir("#{RAILS_ROOT}/public/<dirname>/") do # Execute jar retResult = system("<path to java> -jar <jarname> <args 1> <args 2> .. <args n> ") if retResult Jar executes succesfully else error in executing jar file. end #chdir Thanks Senling On Mar 29, 12:10 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a rails app and a jar file. > I want my jar file to execute when the user presses a button on the > webpage. > Please tell me how to do that. > > Any help will be highly appreciated. > Thanks in anticipation. :)-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks a lot for your reply, I tried to do that but not getting it... Can you please give an example to it... On Mar 29, 10:11 am, senling <senthilu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You can use system call to execute jar file. > > # Change to the directory where jar resides > Dir.chdir("#{RAILS_ROOT}/public/<dirname>/") do > > # Execute jar > retResult = system("<path to java> -jar <jarname> <args 1> <args > 2> .. <args n> ") > > if retResult > Jar executes succesfully > else > error in executing jar file. > > end #chdir > > Thanks > Senling > > On Mar 29, 12:10 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I have a rails app and a jar file. > > I want my jar file to execute when the user presses a button on the > > webpage. > > Please tell me how to do that. > > > Any help will be highly appreciated. > > Thanks in anticipation. :)-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thank you Senling. That worked perfectly fine. No need of an example now. :) On Mar 30, 1:01 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks a lot for your reply, > I tried to do that but not getting it... > Can you please give an example to it... > > On Mar 29, 10:11 am, senling <senthilu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > You can use system call to execute jar file. > > > # Change to the directory where jar resides > > Dir.chdir("#{RAILS_ROOT}/public/<dirname>/") do > > > # Execute jar > > retResult = system("<path to java> -jar <jarname> <args 1> <args > > 2> .. <args n> ") > > > if retResult > > Jar executes succesfully > > else > > error in executing jar file. > > > end #chdir > > > Thanks > > Senling > > > On Mar 29, 12:10 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I have a rails app and a jar file. > > > I want my jar file to execute when the user presses a button on the > > > webpage. > > > Please tell me how to do that. > > > > Any help will be highly appreciated. > > > Thanks in anticipation. :)-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, # create a diretory named ''jars'' (any name) inside public directory and move your jar file inside this directory. def exjar args1= "" args2 = "" Dir.chdir("#{RAILS_ROOT}/public/jars/") do # i''m using linux environment. If windows environment, change the path to the java according to the java directory installed in your machine. retResult = system("/home/user1/java/jdk1.6.0_07/bin/java -jar Sample.jar #{args1} #{args2}") end #chdir end If you get error while running this, please post the error here. Thanks Senling On Mar 30, 1:01 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks a lot for your reply, > I tried to do that but not getting it... > Can you please give an example to it... > > On Mar 29, 10:11 am, senling <senthilu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > You can use system call to execute jar file. > > > # Change to the directory where jar resides > > Dir.chdir("#{RAILS_ROOT}/public/<dirname>/") do > > > # Execute jar > > retResult = system("<path to java> -jar <jarname> <args 1> <args > > 2> .. <args n> ") > > > if retResult > > Jar executes succesfully > > else > > error in executing jar file. > > > end #chdir > > > Thanks > > Senling > > > On Mar 29, 12:10 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I have a rails app and a jar file. > > > I want my jar file to execute when the user presses a button on the > > > webpage. > > > Please tell me how to do that. > > > > Any help will be highly appreciated. > > > Thanks in anticipation. :)-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, # create a diretory named ''jars'' (any name) inside public directory and move your jar file inside this directory. def exjar args1= "" args2 = "" Dir.chdir("#{RAILS_ROOT}/public/jars/") do # i''m using linux environment. If windows environment, change the path to the java according to the java directory installed in your machine. retResult = system("/home/user1/java/jdk1.6.0_07/bin/java -jar Sample.jar #{args1} #{args2}") end #chdir end If you get error while running this, please post the error here. Thanks Senling On Mar 30, 1:01 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks a lot for your reply, > I tried to do that but not getting it... > Can you please give an example to it... > > On Mar 29, 10:11 am, senling <senthilu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > You can use system call to execute jar file. > > > # Change to the directory where jar resides > > Dir.chdir("#{RAILS_ROOT}/public/<dirname>/") do > > > # Execute jar > > retResult = system("<path to java> -jar <jarname> <args 1> <args > > 2> .. <args n> ") > > > if retResult > > Jar executes succesfully > > else > > error in executing jar file. > > > end #chdir > > > Thanks > > Senling > > > On Mar 29, 12:10 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I have a rails app and a jar file. > > > I want my jar file to execute when the user presses a button on the > > > webpage. > > > Please tell me how to do that. > > > > Any help will be highly appreciated. > > > Thanks in anticipation. :)-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hey Senling... Can you please tell me one more thing... I have posted a topic on this group about sending database table data to text files... I humbly request you to please reply to that. Here is the link... http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/ddd564cb70dbb202 On Mar 30, 6:16 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thank you Senling. > That worked perfectly fine. No need of an example now. :) > > On Mar 30, 1:01 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Thanks a lot for your reply, > > I tried to do that but not getting it... > > Can you please give an example to it... > > > On Mar 29, 10:11 am, senling <senthilu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > You can use system call to execute jar file. > > > > # Change to the directory where jar resides > > > Dir.chdir("#{RAILS_ROOT}/public/<dirname>/") do > > > > # Execute jar > > > retResult = system("<path to java> -jar <jarname> <args 1> <args > > > 2> .. <args n> ") > > > > if retResult > > > Jar executes succesfully > > > else > > > error in executing jar file. > > > > end #chdir > > > > Thanks > > > Senling > > > > On Mar 29, 12:10 am, Gautam <gdham...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I have a rails app and a jar file. > > > > I want my jar file to execute when the user presses a button on the > > > > webpage. > > > > Please tell me how to do that. > > > > > Any help will be highly appreciated. > > > > Thanks in anticipation. :)-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.