Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Wednesday 7 August 2013

Avoiding classpath conflict with jruby-complete

Well the simplest thing to do, would be ditch to jruby-complete, except:-
  1. Shader sketches still refuse to run. 
  2. We would lose export. 
  3. We would lose ability to install to system without requiring an installed jruby.
For me 1. is the biggest problem, any exported sketches will probably still be unable to use gems, also installing without jruby also means no access to gems.

See this gist for work in progress https://gist.github.com/monkstone/6172815. I propose to work on this independently on my monkstone branch will need updating from master. 


Motivation we could potentially use rubygems with P2D and P3D modes (even PImage sketches could not be run with rubygems). If we radically exclude jruby-complete until export gem would be much smaller.

Well it seem possible solution is to put jruby-complete.jar in its own directory, and possibly use:-

RUBY_PLATFORM == 'java'

So the solution is:-

Move ruby-complete.jar to its own folder (so we no-longer 'require jruby-complete.jar' in app.rb)

Dir["#{RP5_ROOT}/lib/core/\*.jar"].each { |jar| require jar }

Consequently we need to adjust the path jruby-complete.jar. And in the first place make sure we extract it to its new location easy. Seems to work, we retain the --jruby flag, which should be default unless we haven't installed jruby or we want to run shader sketches.

However it occurs to me this is the ideal opportunity to set using an external jruby as the default. Now all we need is a flag "--nojruby"  for when we need/prefer to use the included jruby-complete (which will remain handy to support export of applications). The shader sketches are the only ones now requiring such a flag. However it will also be required if ruby-processing gets installed without using system jruby (in this case you won't be able to use gems with ruby-processing). 

Well I've done it now since version 2.1.2 the default is to run ruby-processing from an external jruby, to revert to using installed jruby-complete now use the --nojruby flag (replaces the --jruby flag which had the opposite effect).

No comments:

Post a Comment

Followers

Blog Archive

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2