tag:help.rubygems.org,2010-01-19:/discussions/questions/69-can-i-specify-that-a-gem-is-for-jruby-onlyRubyGems.org: Discussion 2011-09-23T14:58:40Ztag:help.rubygems.org,2010-01-19:Comment/78400972011-06-12T17:16:06Z2011-06-12T17:16:06ZCan I specify that a gem is for JRuby only?<div><p>Specifying the <code>java</code> platform usually does it, and
if you a build a gem from JRuby it should do that automatically.
You could also set the <code>platform</code> specifically:</p>
<p><a href=
"http://guides.rubygems.org/specification-reference/#platform">http://guides.rubygems.org/specification-reference/#platform</a>=</p></div>Nick Quarantotag:help.rubygems.org,2010-01-19:Comment/78400972011-06-13T17:31:20Z2011-06-13T17:31:21ZCan I specify that a gem is for JRuby only?<div><p>Ok, it sounds like I should simply add:</p>
<p>platform = "java"</p>
<p>to my gemspec. I'll try that. Thanks!</p></div>Adam Murraytag:help.rubygems.org,2010-01-19:Comment/78400972011-06-16T07:58:49Z2011-09-23T14:58:39ZCan I specify that a gem is for JRuby only?<div><p>spec.platform = "java" in the gemspec seems to simply append
"java" to the end of my gem name. It still installs into MRI
ruby.</p>
<p>Someone suggested I use gem's (native) extension mechanism to
write a script that would fail if not running under JRuby. But I
can't seem to get this to work. I always get the error "cannot
build native extension" even when my ext script does nothing.</p>
<p>I also tried building with both jgem and normal gem, but it
didn't seem to make a difference. Although it's not clear to me if
the local behavior when testing these things will be the same as
when installing from rubygems.org. I only used the gem command "for
real" so far. Next time I'll try to remember to build and push via
jgem and see if that helps.</p>
<p>Maybe there's a bug report or enhancement request in here
somewhere, but I guess it's not that big of a deal. I suppose if
people can't RTFM or figure out a gem that starts with "j" and ends
with "java" is intended for JRuby, that's not really not my problem
;)</p></div>Adam Murraytag:help.rubygems.org,2010-01-19:Comment/78400972011-06-19T15:23:26Z2011-06-19T15:23:26ZCan I specify that a gem is for JRuby only?<div><p>Hello, let us know if you need anything else.</p>
<p>Closing this now.</p>
<p>Cheers.</p></div>Luis Lavena