简体   繁体   English

jruby关于rails和jar文件

[英]jruby on rails and jar files

How can run an executable jar file through a jruby on rails application? 如何通过Rails应用程序上的jruby运行可执行的jar文件? Where would I include the code to run my jar file? 我将在哪里包含运行jar文件的代码?

I have looked all over but have yet to see a defined method for doing this type of thing and I'm also very new to rails. 我环顾四周,但尚未看到一种定义的方法来做这种事情,而且我对Rails也很陌生。

Apparently, you can do 3 things to run an external command: 显然,您可以做三件事来运行外部命令:

  • Kernel.system "command" Kernel.system“命令”
  • %x[command] %x [命令]
  • command

So, in your case your Ruby code would probably be: 因此,在您的情况下,您的Ruby代码可能是:

`java -jar <name of jar>.jar`

And it would work. 它会起作用。 It might be that you have to add the full path for Java here, but you might have to try that out yourself. 可能是您必须在此处添加Java的完整路径,但您可能必须自己尝试一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM