Can all Jruby apps be complied to class files ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Can all Jruby apps be complied to class files ?

amiracam
I've been playing with rawr which can compile jruby code to Java class files and subsequently generate an executable jar. I just want to be certain that any Jruby "application" code can be compiled to .class files.

thanks

Charles
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

Manuel Ramos Caro

Hi  I think that the the answer is yes. But you must be careful with native Ruby resources because the classes couldnt see it on some cases... I'm using Jrubyc to do that and Jruby complete jar as runtime environment onto a fatjar for distribution...

Reggards

El 26/09/2013 03:21, "Charles Monteiro" <[hidden email]> escribió:
I've been playing with rawr which can compile jruby code to Java class files and subsequently generate an executable jar. I just want to be certain that any Jruby "application" code can be compiled to .class files.

thanks

Charles
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

Mark McCraw
Hi Charles,

My experience is also yes.  I'm doing the same thing for several projects, and I'm using rawr as well.  I monkeyed around with warbler for awhile, but it seems more oriented towards creating ears and wars than jars, and I just couldn't get it to do what I needed it to do.  My experience with packaging ruby code as compiled class files in jars is that the classloading is a little wonky... it's not as straightforward as loading .rb files from a noncompressed file system (things like File.join(File.dirname(__FILE__), "whatever") don't really work), but its doable once you figure out the uris that represent paths to resources inside the jar.  If you run into problems with that, post back and I can try to share more concrete examples.

Mark


On Thu, Sep 26, 2013 at 4:27 AM, Manuel Ramos <[hidden email]> wrote:

Hi  I think that the the answer is yes. But you must be careful with native Ruby resources because the classes couldnt see it on some cases... I'm using Jrubyc to do that and Jruby complete jar as runtime environment onto a fatjar for distribution...

Reggards

El 26/09/2013 03:21, "Charles Monteiro" <[hidden email]> escribió:

I've been playing with rawr which can compile jruby code to Java class files and subsequently generate an executable jar. I just want to be certain that any Jruby "application" code can be compiled to .class files.

thanks

Charles
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

christian
I would be interested since I just added the feature to created executable jars out of a jruby project - that could be something to a compilation of ruby files as well. just thinking aloud . . .

- christian


On Thu, Sep 26, 2013 at 1:26 PM, Mark McCraw <[hidden email]> wrote:
Hi Charles,

My experience is also yes.  I'm doing the same thing for several projects, and I'm using rawr as well.  I monkeyed around with warbler for awhile, but it seems more oriented towards creating ears and wars than jars, and I just couldn't get it to do what I needed it to do.  My experience with packaging ruby code as compiled class files in jars is that the classloading is a little wonky... it's not as straightforward as loading .rb files from a noncompressed file system (things like File.join(File.dirname(__FILE__), "whatever") don't really work), but its doable once you figure out the uris that represent paths to resources inside the jar.  If you run into problems with that, post back and I can try to share more concrete examples.

Mark


On Thu, Sep 26, 2013 at 4:27 AM, Manuel Ramos <[hidden email]> wrote:

Hi  I think that the the answer is yes. But you must be careful with native Ruby resources because the classes couldnt see it on some cases... I'm using Jrubyc to do that and Jruby complete jar as runtime environment onto a fatjar for distribution...

Reggards

El 26/09/2013 03:21, "Charles Monteiro" <[hidden email]> escribió:

I've been playing with rawr which can compile jruby code to Java class files and subsequently generate an executable jar. I just want to be certain that any Jruby "application" code can be compiled to .class files.

thanks

Charles
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

keithrbennett
In reply to this post by Mark McCraw
One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files. Ian Dees, coauthor of the excellent JRuby book, explained this to me at CukeUpNYC a couple of weeks ago.

- Keith


On Sep 26, 2013, at 8:26 AM, Mark McCraw <[hidden email]> wrote:

Hi Charles,

My experience is also yes.  I'm doing the same thing for several projects, and I'm using rawr as well.  I monkeyed around with warbler for awhile, but it seems more oriented towards creating ears and wars than jars, and I just couldn't get it to do what I needed it to do.  My experience with packaging ruby code as compiled class files in jars is that the classloading is a little wonky... it's not as straightforward as loading .rb files from a noncompressed file system (things like File.join(File.dirname(__FILE__), "whatever") don't really work), but its doable once you figure out the uris that represent paths to resources inside the jar.  If you run into problems with that, post back and I can try to share more concrete examples.

Mark


On Thu, Sep 26, 2013 at 4:27 AM, Manuel Ramos <[hidden email]> wrote:

Hi  I think that the the answer is yes. But you must be careful with native Ruby resources because the classes couldnt see it on some cases... I'm using Jrubyc to do that and Jruby complete jar as runtime environment onto a fatjar for distribution...

Reggards

El 26/09/2013 03:21, "Charles Monteiro" <[hidden email]> escribió:

I've been playing with rawr which can compile jruby code to Java class files and subsequently generate an executable jar. I just want to be certain that any Jruby "application" code can be compiled to .class files.

thanks

Charles
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

Manuel Ramos Caro

Theres a posts line about end on July beginning August about this theres info about differents points of view and some resource links... As you said without a Jruby Interpreter Jar included or referenced its imposible to make a distribution...

Reggards

El 26/09/2013 15:48, "Keith Bennett" <[hidden email]> escribió:
One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files. Ian Dees, coauthor of the excellent JRuby book, explained this to me at CukeUpNYC a couple of weeks ago.

- Keith


On Sep 26, 2013, at 8:26 AM, Mark McCraw <[hidden email]> wrote:

Hi Charles,

My experience is also yes.  I'm doing the same thing for several projects, and I'm using rawr as well.  I monkeyed around with warbler for awhile, but it seems more oriented towards creating ears and wars than jars, and I just couldn't get it to do what I needed it to do.  My experience with packaging ruby code as compiled class files in jars is that the classloading is a little wonky... it's not as straightforward as loading .rb files from a noncompressed file system (things like File.join(File.dirname(__FILE__), "whatever") don't really work), but its doable once you figure out the uris that represent paths to resources inside the jar.  If you run into problems with that, post back and I can try to share more concrete examples.

Mark


On Thu, Sep 26, 2013 at 4:27 AM, Manuel Ramos <[hidden email]> wrote:

Hi  I think that the the answer is yes. But you must be careful with native Ruby resources because the classes couldnt see it on some cases... I'm using Jrubyc to do that and Jruby complete jar as runtime environment onto a fatjar for distribution...

Reggards

El 26/09/2013 03:21, "Charles Monteiro" <[hidden email]> escribió:

I've been playing with rawr which can compile jruby code to Java class files and subsequently generate an executable jar. I just want to be certain that any Jruby "application" code can be compiled to .class files.

thanks

Charles
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

James Britt
In reply to this post by amiracam
Charles Monteiro wrote:
> I've been playing with rawr which can compile jruby code to Java class files and subsequently generate an executable jar. I just want to be certain that any Jruby "application" code can be compiled to .class files.
>

Rawr does this by calling jrubyc to do the compilation.

James Britt



--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

James Britt
In reply to this post by keithrbennett
Keith Bennett wrote:
>   One thing to keep in mind is that although JRuby source files can be
> compiled to class files, they cannot be run without the JRuby
> interpreter.  That is, the JRuby jar file must be included in the
> distribution, and will be used at runtime to process those class files.

That's basically what Rawr does.  The resulting executable bundle
includes a jruby-complete.jar.

You also have to be sure that your project source code is not relying on
gems or other files that are not also going to be somehow included in
the resulting executable, since if you run the results on another
machine you cannot be sure of what is installed.



James Britt


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

amiracam
thanks all for the feedback.

I'll be honest I'm hitting a learning curb on the Jruby deployment / packaging stage, some of that is because its been ages since I have packaged a Java app and partly because the documentation for the packagers I have seen so far is not complete or assumes the user being familiar with Java packaging which is perhaps fair.

I have 3 active Jruby projects in only one of those cases do I have sole control over the deployment box, the other two I absolutely cannot expose source code and thus all app source must be compiled to .class files.

the projects are:

  1. sinatra on trinidad or torque box which leverages multiple gems, more of a service thing with minor use of views for admin purposes
  2. jrubyfx client app

Ideally I would like in both cases to come up  with all inclusive installer which installs :

  1. JRE i.e. not system install but for specific use by app
  2. Jruby complete jar + jars of app with .class files for app's ruby source + all necessary gems
  3. In the case of jrubyfx client I would also prefer a single executable for the app along with #1 & 2

I started with RAWR and tested with  trivial app that included ruby source and was able to generate the jar i.e.hello world type of thing, however trying to use the "compile ruby source" resulted in issues. I tried to use bundler's install -- deployment flag to generate the source for the gems locally in my project but could not figure out if it was possible to tell RAWR to compile to class files certain ruby code i.e. my app's source and not other ruby source i.e. source for gems


I guess I was hoping for some cookbook style recipe for the scenario where one wants to deploy a non trivial Jruby app without source. 

Maybe we can hash it out here and put it up on the wiki :)



Charles Monteiro



On Sep 26, 2013, at 11:25 AM, James Britt <[hidden email]> wrote:

Keith Bennett wrote:
 One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files.

That's basically what Rawr does.  The resulting executable bundle includes a jruby-complete.jar.

You also have to be sure that your project source code is not relying on gems or other files that are not also going to be somehow included in the resulting executable, since if you run the results on another machine you cannot be sure of what is installed.



James Britt


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

christian
In reply to this post by James Britt
well sorry for advertising jbundler but it does pack the jruby itselfm the bundled gems (from Gemfile) and the bundled jars (Jarfile) to create jar containing all those with executable set to bootstrap file to start the application.


On Thu, Sep 26, 2013 at 4:25 PM, James Britt <[hidden email]> wrote:
Keith Bennett wrote:
  One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files.

That's basically what Rawr does.  The resulting executable bundle includes a jruby-complete.jar.

You also have to be sure that your project source code is not relying on gems or other files that are not also going to be somehow included in the resulting executable, since if you run the results on another machine you cannot be sure of what is installed.




James Britt


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

amiracam
but does it have the option of compiling the app's ruby source to .class files ?

thanks

Charles Monteiro



On Sep 26, 2013, at 12:06 PM, christian <[hidden email]> wrote:

well sorry for advertising jbundler but it does pack the jruby itselfm the bundled gems (from Gemfile) and the bundled jars (Jarfile) to create jar containing all those with executable set to bootstrap file to start the application.


On Thu, Sep 26, 2013 at 4:25 PM, James Britt <[hidden email]> wrote:
Keith Bennett wrote:
  One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files.

That's basically what Rawr does.  The resulting executable bundle includes a jruby-complete.jar.

You also have to be sure that your project source code is not relying on gems or other files that are not also going to be somehow included in the resulting executable, since if you run the results on another machine you cannot be sure of what is installed.




James Britt


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

Manuel Ramos Caro

As i said before to get easily a class... Jrubyc
https://github.com/jruby/jruby/wiki/JRubyCompiler

Then you can proceed as a java jar on jdk including Jruby Complete jar on classpath of jre....

El 27/09/2013 03:25, "Charles Monteiro" <[hidden email]> escribió:
but does it have the option of compiling the app's ruby source to .class files ?

thanks

Charles Monteiro



On Sep 26, 2013, at 12:06 PM, christian <[hidden email]> wrote:

well sorry for advertising jbundler but it does pack the jruby itselfm the bundled gems (from Gemfile) and the bundled jars (Jarfile) to create jar containing all those with executable set to bootstrap file to start the application.


On Thu, Sep 26, 2013 at 4:25 PM, James Britt <[hidden email]> wrote:
Keith Bennett wrote:
  One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files.

That's basically what Rawr does.  The resulting executable bundle includes a jruby-complete.jar.

You also have to be sure that your project source code is not relying on gems or other files that are not also going to be somehow included in the resulting executable, since if you run the results on another machine you cannot be sure of what is installed.




James Britt


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

christian
In reply to this post by amiracam
I will add that feature right now - adding a jrubyc call in the sequence is actually straight forward. but it is NOT part of it yet.

even if I get it pushed today I need to call that feature experimental or at least beta state ;)




On Thu, Sep 26, 2013 at 5:24 PM, Charles Monteiro <[hidden email]> wrote:
but does it have the option of compiling the app's ruby source to .class files ?

thanks

Charles Monteiro



On Sep 26, 2013, at 12:06 PM, christian <[hidden email]> wrote:

well sorry for advertising jbundler but it does pack the jruby itselfm the bundled gems (from Gemfile) and the bundled jars (Jarfile) to create jar containing all those with executable set to bootstrap file to start the application.


On Thu, Sep 26, 2013 at 4:25 PM, James Britt <[hidden email]> wrote:
Keith Bennett wrote:
  One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files.

That's basically what Rawr does.  The resulting executable bundle includes a jruby-complete.jar.

You also have to be sure that your project source code is not relying on gems or other files that are not also going to be somehow included in the resulting executable, since if you run the results on another machine you cannot be sure of what is installed.




James Britt


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

amiracam
well I will be your beta tester and promise not to hold you liable for any damages to our production system :), thanks will you generator a gem for that as well ?
Charles Monteiro



On Sep 27, 2013, at 5:20 AM, christian <[hidden email]> wrote:

I will add that feature right now - adding a jrubyc call in the sequence is actually straight forward. but it is NOT part of it yet.

even if I get it pushed today I need to call that feature experimental or at least beta state ;)




On Thu, Sep 26, 2013 at 5:24 PM, Charles Monteiro <[hidden email]> wrote:
but does it have the option of compiling the app's ruby source to .class files ?

thanks

Charles Monteiro



On Sep 26, 2013, at 12:06 PM, christian <[hidden email]> wrote:

well sorry for advertising jbundler but it does pack the jruby itselfm the bundled gems (from Gemfile) and the bundled jars (Jarfile) to create jar containing all those with executable set to bootstrap file to start the application.


On Thu, Sep 26, 2013 at 4:25 PM, James Britt <[hidden email]> wrote:
Keith Bennett wrote:
  One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files.

That's basically what Rawr does.  The resulting executable bundle includes a jruby-complete.jar.

You also have to be sure that your project source code is not relying on gems or other files that are not also going to be somehow included in the resulting executable, since if you run the results on another machine you cannot be sure of what is installed.




James Britt


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email






Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

James Britt
In reply to this post by christian
christian wrote:
> well sorry for advertising jbundler but it does pack the jruby itselfm
> the bundled gems (from Gemfile) and the bundled jars (Jarfile) to create
> jar containing all those with executable set to bootstrap file to start
> the application.


Very cool.

Something to watch for when including third-party code into what should
be a standalone executable is that some some gems will call other gems
even though those other gems have not been specified in the gemspec or
in Gemfile.

The trick is to ensure that only files included in the packaged
executable are on the load path.

Basically, $: should only refer to the included jruby-complete jar and
the files explicitly included in the resulting executable bundle of code.


James

--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

christian
In reply to this post by christian
just pushed a jbundler-0.5.3 which can compile the ruby classes before packing them into the exectuable jar


On Fri, Sep 27, 2013 at 10:20 AM, christian <[hidden email]> wrote:
I will add that feature right now - adding a jrubyc call in the sequence is actually straight forward. but it is NOT part of it yet.

even if I get it pushed today I need to call that feature experimental or at least beta state ;)




On Thu, Sep 26, 2013 at 5:24 PM, Charles Monteiro <[hidden email]> wrote:
but does it have the option of compiling the app's ruby source to .class files ?

thanks

Charles Monteiro



On Sep 26, 2013, at 12:06 PM, christian <[hidden email]> wrote:

well sorry for advertising jbundler but it does pack the jruby itselfm the bundled gems (from Gemfile) and the bundled jars (Jarfile) to create jar containing all those with executable set to bootstrap file to start the application.


On Thu, Sep 26, 2013 at 4:25 PM, James Britt <[hidden email]> wrote:
Keith Bennett wrote:
  One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files.

That's basically what Rawr does.  The resulting executable bundle includes a jruby-complete.jar.

You also have to be sure that your project source code is not relying on gems or other files that are not also going to be somehow included in the resulting executable, since if you run the results on another machine you cannot be sure of what is installed.




James Britt


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email






Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

christian
In reply to this post by James Britt


Something to watch for when including third-party code into what should be a standalone executable is that some some gems will call other gems even though those other gems have not been specified in the gemspec or in Gemfile.

The trick is to ensure that only files included in the packaged executable are on the load path.

Basically, $: should only refer to the included jruby-complete jar and the files explicitly included in the resulting executable bundle of code.


that is quite tricky: jruby-complete.jar even includes the $HOME/.gem/jruby/1.x to Gem.path, i.e. any gem installed there will be found by 'require'

something like this:
Gem.path.delete_if{ |p| !p.match( /^file:/ ) }
in the bootstrap script could do the trick as well assuming all gems are located inside the jar in jruby.home/lib/ruby/shared/gems/

-christian

 

James


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

Eric West
In reply to this post by amiracam

Charles, I‘d be surprised if you haven’t turned this up searching already, but this article from the author of rawr is definitely the best explanation of it‘s usage I’ve seen: [Getting Started with Rawr](http://neurogami.com/blog/getting-started-with-rawr.html)

Similarly, I've written about how to use the javafx packaging tools on the jruby wiki. Javafx comes with a bunch of ant tasks for packaging apps, and they are upgraded in jdk8 so that you can use them to package any java app, including jruby apps. I've described that [here](https://github.com/jruby/jruby/wiki/Packaging-Native-Installers-with-the-JavaFX-Ant-Tasks)

As far as compiling to .class files go, there's a lot of information about how to do that out there. You'll probably want to do that in a rake task, as a prior step to building a jar, and then go from there to building the executable. There's a good example of doing both of these things in the Using Jruby book.

All of these things are going to take a bit of fiddling to get right on a per-app basis, which is probably why I doubt you will find the cookbook style instructions for the entire process that you are hoping for. Best of luck to you.



On Thu, Sep 26, 2013 at 11:02 AM, Charles Monteiro <[hidden email]> wrote:
thanks all for the feedback.

I'll be honest I'm hitting a learning curb on the Jruby deployment / packaging stage, some of that is because its been ages since I have packaged a Java app and partly because the documentation for the packagers I have seen so far is not complete or assumes the user being familiar with Java packaging which is perhaps fair.

I have 3 active Jruby projects in only one of those cases do I have sole control over the deployment box, the other two I absolutely cannot expose source code and thus all app source must be compiled to .class files.

the projects are:

  1. sinatra on trinidad or torque box which leverages multiple gems, more of a service thing with minor use of views for admin purposes
  2. jrubyfx client app

Ideally I would like in both cases to come up  with all inclusive installer which installs :

  1. JRE i.e. not system install but for specific use by app
  2. Jruby complete jar + jars of app with .class files for app's ruby source + all necessary gems
  3. In the case of jrubyfx client I would also prefer a single executable for the app along with #1 & 2

I started with RAWR and tested with  trivial app that included ruby source and was able to generate the jar i.e.hello world type of thing, however trying to use the "compile ruby source" resulted in issues. I tried to use bundler's install -- deployment flag to generate the source for the gems locally in my project but could not figure out if it was possible to tell RAWR to compile to class files certain ruby code i.e. my app's source and not other ruby source i.e. source for gems


I guess I was hoping for some cookbook style recipe for the scenario where one wants to deploy a non trivial Jruby app without source. 

Maybe we can hash it out here and put it up on the wiki :)



Charles Monteiro



On Sep 26, 2013, at 11:25 AM, James Britt <[hidden email]> wrote:

Keith Bennett wrote:
 One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files.

That's basically what Rawr does.  The resulting executable bundle includes a jruby-complete.jar.

You also have to be sure that your project source code is not relying on gems or other files that are not also going to be somehow included in the resulting executable, since if you run the results on another machine you cannot be sure of what is installed.



James Britt


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Can all Jruby apps be complied to class files ?

amiracam
Eric:

thanks, I will go thru all of this and the link you provided in the other email. 

We are a software vendor that develops enterprise financial apps our source cannot be exposed never mind the possibility of reverse engineering byte code. I just am not allowed to deploy anything that can be un-archived to show source. I think that in general Ruby and Jruby must be deployed typically in contexts that  are controlled by the IP owner and thus a generic solution for building a closed deliverable has not been fully thought out. 

I plan to put in github a couple projects that mimic the two deployment contexts i.e. a server side Sinatra app and a Jrubyfx client UI and figure out how to script a one button click build of a non-source code exposed deliverable i.e compiled to .class files.

Hope folks will chime in.

thanks


Charles Monteiro



On Oct 2, 2013, at 10:23 PM, Eric West <[hidden email]> wrote:

Charles, I‘d be surprised if you haven’t turned this up searching already, but this article from the author of rawr is definitely the best explanation of it‘s usage I’ve seen: [Getting Started with Rawr](http://neurogami.com/blog/getting-started-with-rawr.html)

Similarly, I've written about how to use the javafx packaging tools on the jruby wiki. Javafx comes with a bunch of ant tasks for packaging apps, and they are upgraded in jdk8 so that you can use them to package any java app, including jruby apps. I've described that [here](https://github.com/jruby/jruby/wiki/Packaging-Native-Installers-with-the-JavaFX-Ant-Tasks)

As far as compiling to .class files go, there's a lot of information about how to do that out there. You'll probably want to do that in a rake task, as a prior step to building a jar, and then go from there to building the executable. There's a good example of doing both of these things in the Using Jruby book.

All of these things are going to take a bit of fiddling to get right on a per-app basis, which is probably why I doubt you will find the cookbook style instructions for the entire process that you are hoping for. Best of luck to you.



On Thu, Sep 26, 2013 at 11:02 AM, Charles Monteiro <[hidden email]> wrote:
thanks all for the feedback.

I'll be honest I'm hitting a learning curb on the Jruby deployment / packaging stage, some of that is because its been ages since I have packaged a Java app and partly because the documentation for the packagers I have seen so far is not complete or assumes the user being familiar with Java packaging which is perhaps fair.

I have 3 active Jruby projects in only one of those cases do I have sole control over the deployment box, the other two I absolutely cannot expose source code and thus all app source must be compiled to .class files.

the projects are:

  1. sinatra on trinidad or torque box which leverages multiple gems, more of a service thing with minor use of views for admin purposes
  2. jrubyfx client app

Ideally I would like in both cases to come up  with all inclusive installer which installs :

  1. JRE i.e. not system install but for specific use by app
  2. Jruby complete jar + jars of app with .class files for app's ruby source + all necessary gems
  3. In the case of jrubyfx client I would also prefer a single executable for the app along with #1 & 2

I started with RAWR and tested with  trivial app that included ruby source and was able to generate the jar i.e.hello world type of thing, however trying to use the "compile ruby source" resulted in issues. I tried to use bundler's install -- deployment flag to generate the source for the gems locally in my project but could not figure out if it was possible to tell RAWR to compile to class files certain ruby code i.e. my app's source and not other ruby source i.e. source for gems


I guess I was hoping for some cookbook style recipe for the scenario where one wants to deploy a non trivial Jruby app without source. 

Maybe we can hash it out here and put it up on the wiki :)



Charles Monteiro



On Sep 26, 2013, at 11:25 AM, James Britt <[hidden email]> wrote:

Keith Bennett wrote:
 One thing to keep in mind is that although JRuby source files can be compiled to class files, they cannot be run without the JRuby interpreter.  That is, the JRuby jar file must be included in the distribution, and will be used at runtime to process those class files.

That's basically what Rawr does.  The resulting executable bundle includes a jruby-complete.jar.

You also have to be sure that your project source code is not relying on gems or other files that are not also going to be somehow included in the resulting executable, since if you run the results on another machine you cannot be sure of what is installed.



James Britt


--

Neurogami - Avant-garage Research & Development

http://www.neurogami.com

[hidden email]





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email