require java false for jRuby osx - jruby

I have installed jRuby. I don't know what's the issue have. I installed jRuby with rbenv on OSX.
echo $JAVA_HOME has not output
❯ rbenv versions
system
1.9.3-p125
* 2.2.3 (set by /usr/local/var/rbenv/version)
jruby-9.0.5.0
~
❯ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
~
❯ rbenv shell jruby-9.0.5.0
~
❯ rbenv version
jruby-9.0.5.0 (set by RBENV_VERSION environment variable)
~
❯ ruby -v
jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [darwin-x86_64]
~
❯ jirb
irb(main):001:0> require 'java'
=> false
irb(main):002:0>

you are using JRuby require 'java' would have raised an error on MRI
ruby -v output confirms that a JVM was found (no need for JAVA_HOME)

Related

Shadow cljs doesn’t see java on Macbook M1

I used npx create-cljs-project my-app and revived error when I tried to start with npm start
I have tried few java ask version, but I get same error anyway.
shadow-cljs - config: /Users/tomaszsikora/dev/my-app/shadow-cljs.edn
Execution error (UnsatisfiedLinkError) at java.lang.ClassLoader/loadLibrary (ClassLoader.java:2398).
Can't load library: /var/folders/x7/k_6f989d60z2k0pz_cz_3y_40000gn/T/jna1171015707293329039.tmp
Full report at:
/var/folders/x7/k_6f989d60z2k0pz_cz_3y_40000gn/T/clojure-11795200488797552517.edn
and it starts like this, but it's too long to paste here.
{:clojure.main/message
"Execution error (UnsatisfiedLinkError) at java.lang.ClassLoader/loadLibrary (ClassLoader.java:2398).\nCan't load library: /var/folders/x7/k_6f989d60z2k0pz_cz_3y_40000gn/T/jna14133068692257536681.tmp\n",
:clojure.main/triage
{:clojure.error/class java.lang.UnsatisfiedLinkError,
:clojure.error/line 2398,
:clojure.error/cause
"Can't load library: /var/folders/x7/k_6f989d60z2k0pz_cz_3y_40000gn/T/jna14133068692257536681.tmp",
:clojure.error/symbol java.lang.ClassLoader/loadLibrary,
:clojure.error/source "ClassLoader.java",
:clojure.error/phase :execution},
:clojure.main/trace
{:via
[{:type java.lang.UnsatisfiedLinkError,
:message
"Can't load library: /var/folders/x7/k_6f989d60z2k0pz_cz_3y_40000gn/T/jna14133068692257536681.tmp",
:at [java.lang.ClassLoader loadLibrary "ClassLoader.java" 2398]}],
:trace
java version
tomaszsikora#DeadBook-Void my-app % java --version
openjdk 18.0.2.1 2022-08-18
OpenJDK Runtime Environment Homebrew (build 18.0.2.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 18.0.2.1+0, mixed mode, sharing)

Jruby version suitable for OpenJDK 8 (Zulu JDK)

I am looking for an advisable version of JRuby that supports OpenJDK-8 (Zulu-JDK) to run on a Rails project.
Rails version- 4.0.13.
All versions of JRuby since version 9.2.0.0 will run on JDK 8. Since Zulu 8 is a build of OpenJDK 8 that means any appropriate JRuby version will run on Zulu 8.
Follow up question (using answer section to get better code formatting then commenting on the answer above).
I'm trying to get JRuby > 9.2.0.0 running Zulu 8 for MacOS ARM 64-bit (M1 chip).
I did a reinstall of the JRuby versions after installing that JDK.
$ rvm list
jruby-1.7.27 [ x86_64 ]
=> jruby-9.2.13.0 [ aarch64 ]
Check ruby version and try irb:
$ ruby -v
jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94bcc OpenJDK 64-Bit Server VM 25.302-b08 on 1.8.0_302-b08 +jit [darwin-aarch64]
$ irb
NotImplementedError: fstat unimplemented unsupported or native support failed to load; see https://github.com/jruby/jruby/wiki/Native-Libraries
initialize at org/jruby/RubyIO.java:1015
open at org/jruby/RubyIO.java:1156
initialize at /Users/rrickerts/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/irb/input-method.rb:141
initialize at /Users/rrickerts/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/irb/context.rb:70
initialize at /Users/rrickerts/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/irb.rb:410
start at /Users/rrickerts/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/irb.rb:381
<main> at /Users/rrickerts/.rvm/rubies/jruby-9.2.13.0/bin/irb:13

Java 1.7 or later is required to run Apache Drill

When I type
$ drillbit.sh start
it shows me this error:
ERROR: Java 1.7 or later is required to run Apache Drill.
although I have the latest version of java
$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
also my $JAVA_HOME is set correctly in .profile
What could cause such issue?
Well, after investgating a little bit I have found that the config file drill-config.sh
checks the java version with bad regex:
"$JAVA" -version 2>&1 | grep "version" | egrep -e "1.4|1.5|1.6" > /dev/null
if [ $? -eq 0 ]; then
fatal_error "Java 1.7 or later is required to run Apache Drill."
fi
The regex "1.4" matches 144 which is the update number in java version I have.
So the floating point should be escaped to be "1\.4"
And this finally solved my problem.
There is already a Jira to fix this:
https://issues.apache.org/jira/browse/DRILL-5698 and open PR.

NEW CLI INSTALL - does not work... tried Alloy and Classic

Summary:
2016-06-24T12:28:18.008Z | ERROR | An uncaught exception was thrown!
Cannot read property 'options' of undefined
2016-06-24T12:28:18.011Z | ERROR | Cannot read property 'options' of undefined
Details:
brand new installation, Windows 10 64bit
followed: https://docs.appcelerator.com/platform/latest/#!/guide/Appcelerator_CLI_Tasks
Steps I took:
Downloaded the NODE installer (URL on your downloads page):
node --version
v4.4.5
npm install appcelerator -g
npm WARN installMany request was bundled with appcelerator#4.2.6, but bundled package wasn't found in unpacked tree
npm WARN installMany chalk was bundled with appcelerator#4.2.6, but bundled package wasn't found in unpacked tree
npm WARN installMany progress was bundled with appcelerator#4.2.6, but bundled package wasn't found in unpacked tree
npm WARN installMany tar was bundled with appcelerator#4.2.6, but bundled package wasn't found in unpacked tree
npm WARN installMany which was bundled with appcelerator#4.2.6, but bundled package wasn't found in unpacked tree
npm WARN installMany debug was bundled with appcelerator#4.2.6, but bundled package wasn't found in unpacked tree
npm WARN installMany lodash was bundled with appcelerator#4.2.6, but bundled package wasn't found in unpacked tree
npm WARN installMany request was bundled with appcelerator#4.2.6, but bundled package wasn't found in unpacked tree
C:\Users\Ozz Nixon\AppData\Roaming\npm\appcelerator -> C:\Users\Ozz Nixon\AppData\Roaming\npm\node_modules\appcelerator\bin\appc
C:\Users\Ozz Nixon\AppData\Roaming\npm\appc -> C:\Users\Ozz Nixon\AppData\Roaming\npm\node_modules\appcelerator\bin\appc
appcelerator#4.2.6 C:\Users\Ozz Nixon\AppData\Roaming\npm\node_modules\appcelerator
├── which#1.0.8
├── progress#1.1.8
├── async#1.5.2
├── semver#3.0.1
├── debug#2.2.0 (ms#0.7.1)
├── chalk#0.5.1 (ansi-styles#1.1.0, escape-string-regexp#1.0.5, supports-color#0.2.0, strip-ansi#0.3.0, has-ansi#0.1.0)
├── update-notifier#0.5.0 (is-npm#1.0.0, string-length#1.0.1, chalk#1.1.3, repeating#1.1.3, semver-diff#2.1.0, configstore#1.4.0, latest-version#1.0.1)
├── tar#1.0.3 (inherits#2.0.1, block-stream#0.0.8, fstream#1.0.8)
├── request#2.72.0 (aws-sign2#0.6.0, forever-agent#0.6.1, tunnel-agent#0.4.2, oauth-sign#0.8.1, is-typedarray#1.0.0, caseless#0.11.0, stringstream#0.0.5, isstream#0.1.2, json-stringify-safe#5.0.1, extend#3.0.0, form-data#1.0.0-rc4, tough-cookie#2.2.2, node-uuid#1.4.7, qs#6.1.0, combined-stream#1.0.5, mime-types#2.1.10, aws4#1.3.2, hawk#3.1.3, bl#1.1.2, http-signature#1.1.1, har-validator#2.0.6)
└── lodash#4.11.1
appc setup
Finding latest version ...5.3.0 OK
Validating security checksum OK
Installing ... OK
Compiling platform native modules ...
└ socket.io-client/ws ... OK
└ bunyan/dtrace-provider ... OK
└ appc-ldapjs/dtrace-provider ... OK
└ chokidar/fsevents ... OK
└ chokidar/fsevents ... OK
Appcelerator Login required to continue ...
? Appcelerator ID: ozznixon#gmail.com
? Appcelerator ID: ozznixon#gmail.com
? Password: ********
Invalid Appcelerator ID and password combination.
Appcelerator Login required to continue ...
? Appcelerator ID: ozznixon#gmail.com
? Password: **************
Invalid Appcelerator ID and password combination.
Appcelerator Login required to continue ...
? Appcelerator ID: ozznixon#gmail.com
? Password: ********
This computer must be authorized before you can complete your login.
? Confirm with authorization code to Email or Phone/SMS? Email to ozznixon#gmail.com
An authorization code was sent to your email at ozznixon#gmail.com
? Please enter the authorization code you received via your email at ozznixon#gmail.com: 7015
This computer is now authorized: Windows Machine ID: 8f61c9c2-dad0-4208-9e4c-c096d20e2894
You can deauthorize this computer by logging out with appc logout
Generating Developer Certificate and Private/Public Keys...
? Do you plan on developing Titanium apps? Yes
Checking your environment...
No Mobile SDK found, downloading ...
New version available! 5.3.0.GA
Downloading http://builds.appcelerator.com/mobile-releases/5.3.0/mobilesdk-5.3.0.GA-win32.zip
100% [========================================] 0.0s
Extracting SDK to C:\ProgramData\Titanium
100% [========================================]
Setting Titanium SDK 5.3.0.GA as the default.
Titanium SDK 5.3.0.GA successfully installed!
You have the latest Titanium SDK release 5.3.0.GA
The following JDK issues were found in your environment:
JDK (Java Development Kit) not installed.
If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly set.
The JDK is required for must be manually downloaded and installed from
http://appcelerator.com/jdk.
Some issues were detected for your environment
Please review the above found issues that were detected for your environment.
You should resolve these issues before building or running a cross platform app.
You can re-run setup once they are resolved to validate.
appc setup complete!
I downloaded and installed: Java SE Development Kit 8 Update 92 (64-bit)
Then:
appc use
The following versions are available:
5.3.1-2 Not Installed
5.3.0 Installed (Latest) (Active)
5.3.0-47 Not Installed
5.3.0-43 Not Installed
5.3.0-34 Not Installed
5.2.0-265 Not Installed
5.2.2 Not Installed
5.2.0-213 Not Installed
5.2.1 Not Installed
5.2.1-12 Not Installed
5.2.0-55 Not Installed
5.2.0 Installed
5.1.0 Not Installed
5.0.4 Not Installed
5.0.3 Not Installed
5.0.2 Not Installed
5.0.1 Not Installed
5.0.0 Not Installed
4.1.3 Not Installed
4.1.2 Not Installed
4.1.1 Not Installed
4.1.0 Not Installed
5.0.0-50 Not Installed
5.0.0-40 Not Installed
4.0.2 Not Installed
4.1.0-0 Not Installed
4.0.1 Not Installed
4.0.0 Not Installed
4.0.0-rc Not Installed
1.2.123 Not Installed
0.2.285 Not Installed
0.2.283 Not Installed
0.2.282 Not Installed
0.2.276 Not Installed
0.2.273 Not Installed
0.2.255 Not Installed
0.2.247 Not Installed
0.2.246 Not Installed
0.2.242 Not Installed
0.2.241 Not Installed
0.2.230 Not Installed
0.2.229 Not Installed
0.2.228 Not Installed
0.2.227 Not Installed
0.2.226 Not Installed
0.2.225 Not Installed
0.2.224 Not Installed
0.2.223 Not Installed
0.2.222 Not Installed
0.2.221 Not Installed
0.2.220 Not Installed
0.2.219 Not Installed
0.2.218 Not Installed
0.2.217 Not Installed
0.2.216 Not Installed
0.2.215 Not Installed
0.2.214 Not Installed
0.2.213 Not Installed
0.2.212 Not Installed
0.2.210 Not Installed
0.2.209 Not Installed
0.2.208 Not Installed
0.2.207 Not Installed
0.2.204 Not Installed
0.2.203 Not Installed
0.2.201 Not Installed
0.2.200 Not Installed
0.2.199 Not Installed
0.2.198 Not Installed
0.2.198 Not Installed
0.2.197 Not Installed
0.2.196 Not Installed
0.2.195 Not Installed
0.2.192 Not Installed
0.2.191 Not Installed
0.2.187 Not Installed
0.2.186 Not Installed
0.2.185 Not Installed
0.2.183 Not Installed
0.2.182 Not Installed
0.2.181 Not Installed
0.2.181 Not Installed
0.2.180 Not Installed
0.2.179 Not Installed
0.2.178 Not Installed
0.2.177 Not Installed
0.2.176 Not Installed
0.2.175 Not Installed
0.2.174 Not Installed
0.2.173 Not Installed
0.2.172 Not Installed
0.2.170 Not Installed
0.2.169 Not Installed
0.2.101 Not Installed
0.2.101 Not Installed
0.2.101 Not Installed
0.2.100 Not Installed
0.2.99 Not Installed
0.2.98 Not Installed
0.2.97 Not Installed
Then:
appc new -t titanium --id com.jahbraids.intro -n introproj -p android
A new update (5.3.1-2) is available... Download with appc use 5.3.1-2
Appcelerator Command-Line Interface, version 5.3.0
Copyright (c) 2014-2016, Appcelerator, Inc. All Rights Reserved.
*** new completed. ***
Then:
appc run
Appcelerator Command-Line Interface, version 5.3.0
Copyright (c) 2014-2016, Appcelerator, Inc. All Rights Reserved.
2016-06-23T23:51:51.172Z | ERROR | An uncaught exception was thrown!
Cannot read property 'options' of undefined
2016-06-23T23:51:51.175Z | ERROR | Cannot read property 'options' of undefined
Searched, found closed ticket, and tried:
npm install -g titanium
npm WARN deprecated wrench#1.5.8: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years.
C:\Users\Ozz Nixon\AppData\Roaming\npm\ti -> C:\Users\Ozz Nixon\AppData\Roaming\npm\node_modules\titanium\bin\titanium
C:\Users\Ozz Nixon\AppData\Roaming\npm\titanium -> C:\Users\Ozz Nixon\AppData\Roaming\npm\node_modules\titanium\bin\titanium
titanium#5.0.9 C:\Users\Ozz Nixon\AppData\Roaming\npm\node_modules\titanium
├── async#1.4.2
├── sprintf#0.1.5
├── humanize#0.0.9
├── semver#5.0.3
├── colors#1.1.2
├── wrench#1.5.8
├── temp#0.8.3 (os-tmpdir#1.0.1, rimraf#2.2.8)
├── fields#0.1.24 (keypress#0.2.1, colors#0.6.2)
├── winston#1.0.2 (cycle#1.0.3, isstream#0.1.2, stack-trace#0.0.9, eyes#0.1.8, async#1.0.0, pkginfo#0.3.1, colors#1.0.3)
├── longjohn#0.2.9 (source-map-support#0.3.2)
├── request#2.62.0 (forever-agent#0.6.1, caseless#0.11.0, aws-sign2#0.5.0, oauth-sign#0.8.2, tunnel-agent#0.4.3, stringstream#0.0.5, isstream#0.1.2, json-stringify-safe#5.0.1, extend#3.0.0, tough-cookie#2.2.2, node-uuid#1.4.7, qs#5.1.0, combined-stream#1.0.5, mime-types#2.1.11, form-data#1.0.0-rc4, http-signature#0.11.0, bl#1.0.3, hawk#3.1.3, har-validator#1.8.0)
├── moment#2.10.6
└── node-appc#0.2.31 (xmldom#0.1.19, semver#5.0.1, node-uuid#1.4.3, adm-zip#0.4.7, diff#2.1.0, optimist#0.6.1, uglify-js#2.4.24, request#2.61.0)
Still: appc run -p android
Appcelerator Command-Line Interface, version 5.3.0
Copyright (c) 2014-2016, Appcelerator, Inc. All Rights Reserved.
2016-06-23T23:57:09.690Z | ERROR | An uncaught exception was thrown!
Cannot read property 'options' of undefined
2016-06-23T23:57:09.695Z | ERROR | Cannot read property 'options' of undefined
Did Update: appc use 5.3.1-2
Before you can continue, the latest Appcelerator software update needs to be downloaded.
Finding version 5.3.1-2 ... OK
Validating security checksum OK
Installing ... OK
Compiling platform native modules ...
└ socket.io-client/ws ... OK
└ bunyan/dtrace-provider ... OK
└ appc-ldapjs/dtrace-provider ... OK
└ chokidar/fsevents ... OK
└ chokidar/fsevents ... OK
Installed!!
Still: appc run -p android
Appcelerator Command-Line Interface, version 5.3.1-2
Copyright (c) 2014-2016, Appcelerator, Inc. All Rights Reserved.
2016-06-24T12:28:18.008Z | ERROR | An uncaught exception was thrown!
Cannot read property 'options' of undefined
2016-06-24T12:28:18.011Z | ERROR | Cannot read property 'options' of undefined
Thanks for sharing with us. Please run the following command in the administrative command prompt.
del -rf ~/.appcelerator
del -rf ~/.titanium
npm uninstall -g titanium
npm uninstall -g appcelerator
npm install -g appcelerator
appc use latest
appc setup
appc login
The issue you're seeing looks to be https://jira.appcelerator.org/browse/TIMOB-23480. This issue has been fixed in the latest 5.3.1 builds of the SDK. You can install this using appc ti sdk install -b 5_3_X -d.
Also for your reference my JAVA_HOME is set to C:\Program Files (x86)\Java\jdk1.7.0_80, after setting this environment variable make sure to restart your command prompt.

JRuby java.lang.ClassCastException

I used a little Jruby script from http://www.javaworld.com/javaworld/jw-07-2006/jw-0717-ruby.html to test invokedynamic:
class ADuck
def quack()
puts "quack A";
end
end
class BDuck
def quack()
puts "quack B";
end
end
def quack_it(duck)
duck.quack
end
a = ADuck.new
b = BDuck.new
quack_it(a)
quack_it(b)
But when I compile in with JRuby to Java classfiles and then try to execute it I get the following exception:
Java HotSpot(TM) 64-Bit Server VM warning: Use -XX:+UnlockDiagnosticVMOptions be
fore EnableInvokeDynamic flag
Exception in thread "main" java.lang.ClassCastException: java.lang.Object cannot
be cast to java.lang.invoke.SwitchPoint
at org.jruby.runtime.invokedynamic.InvokeDynamicSupport.constantFallback
(InvokeDynamicSupport.java:659)
at duck_typing.__file__(duck_typing.rb:22)
at duck_typing.load(duck_typing.rb)
at duck_typing.main(duck_typing.rb)
My system: JDK 1.7.0_09 64bit on Windows 7 64bit, JRuby 1.7.2
Used commandlines:
jruby -Xcompile.invokedynamic=true -S jrubyc duck_typing.rb
java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -cp .;jruby-complete-1.7.2.jar duck_typing
A while ago I tested it on linux machine with same results and on Windows jdk8.
With JDK8 it worked, but gave me problems using the classfiles in another project.
Has anyone a idee how to fix it?
How can I use JRuby with indy on Java 7?
Except for the JRuby convenience parameter --server, all JVM runtime
parameters use the -J option, followed by the specific JVM setting.
For example:
Heap space settings: jruby -J-X
JRuby runtime settings: jruby -J-D
All the settings described in the following sections are JVM settings.
https://github.com/jruby/jruby/wiki/PerformanceTuning
try this instead
jruby -J-Xcompile.invokedynamic=true -S jrubyc duck_typing.rb