2

From this page: https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby

In a Ruby script, if you use require 'java', the script will be able to create things like JFrames and such.

It may sound odd, but, is it possible, in any way, to not allow such feature (disable importing Java)?


If you are curious as to why am I asking, it is because I'm developing some kind of game engine on Java, but it allows users to script with Ruby to control the game logic - only the game logic. I don't want to give the freedom of creating JFrames.

2

1 Answer 1

1

One hack would be to put 'java' into loaded features (the $" array). Requires would then assume it's already loaded and not try to load it again. A user could certainly remove it from that array, and try again, though.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.