I’m experimenting to see if I can get a gem that normally uses a jar
to use the .class files instead. If this works I could package the
gem with .class files instead of the jar and then more easily include
it in with jruby-complete.jar (avoiding the jar within a jar problem).
Specificall I’m trying to get the redcloth gem (that normally uses a
jar) working with the Java class files directly.
Does anyone know if this should work: include_class
‘RedclothScanService$Base’
I’m getting an: include_class’: undefined method
`RedclothScanService’ for main:Object (NoMethodError)
For the “Is your computer plugged in” question - Is lib (where the
classes live) on the classpath?
I modified the Rake task so the classes are copied to lib/ also:
[redcloth.git (nojar)]$ ls -l lib/
total 3360
-rw-r–r-- 1 stephen staff 24976 Jan 12 14:32
RedclothAttributes.class
-rw-r–r-- 1 stephen staff 560002 Jan 12 14:32 RedclothInline.class
-rw-r–r-- 1 stephen staff 9548 Jan 12 14:32
RedclothScanService$Base.class
-rw-r–r-- 1 stephen staff 597763 Jan 12 14:32
RedclothScanService$Transformer.class
-rw-r–r-- 1 stephen staff 5423 Jan 12 14:32
RedclothScanService.class
drwxr-xr-x 3 stephen staff 102 Jul 27 21:23 case_sensitive_require
drwxr-xr-x 7 stephen staff 238 Nov 20 17:59 redcloth
-rw-r–r–@ 1 stephen staff 1522 Jan 12 18:39 redcloth.rb
-rw-r–r-- 1 stephen staff 506272 Jan 12 14:32 redcloth_scan.jar
This is the statement I am trying to replace:
require ‘redcloth_scan’
I just want to replicate with a set of bare *.classes what require
does with a jar.
RedclothScanService implements BasicLibraryService – it’s adding
methods to RedCloth::TextileDoc
You can see the RedclothScanService.java code ragel generated here:
When JRuby requires a jar (and perhaps a class also?) and there is a
class in that jar that implements BasicLibraryService then it’s
basicLoad method get’s called.
The classes RedclothScanService$Base and
RedclothScanService$Transformer are static classes
which is why they appear as separate .class files.
This variation executes without complaining but the code still doesn’t
work.
I’m experimenting to see if I can get a gem that normally uses a
jar to use the .class files instead. If this works I could package
the gem with .class files instead of the jar and then more easily
include it in with jruby-complete.jar (avoiding the jar within a
jar problem).
Specificall I’m trying to get the redcloth gem (that normally uses
a jar) working with the Java class files directly.
So at least for the redcloth gem which includes redcloth_scan.jar in
it’s lib/ dir – if you instead just put the class files in lib/ and
replace: require ‘redcloth_scan’ with the three lines above it should
work fine when embedded into a jar with the rest of JRuby.