jashkenas / ruby-processing

Code as Art, Art as Code. Processing and Ruby are meant for each other.
http://github.com/jashkenas/ruby-processing/wikis
Other
1.28k stars 94 forks source link

Problem with running sketches #80

Closed kevinports closed 10 years ago

kevinports commented 10 years ago

Hello, I'm trying to get a sketch running but keep hitting this error. Any help would be greatly appreciated!

Running Mac osx 10.9, using Processing 2.0.3 (also attempted with 2.1), and wget is installed.

ruby

$ rvm current
ruby-2.0.0-p353

(also attempted with 1.9.3)

java

$ java -version
java version "1.7.0_45"

(also attempted with Java 6)

jruby

$ jruby -v
jruby 1.7.9 (1.9.3p392) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [darwin-x86_64]

command and stack trace

$ rp5 run samples/contributed/jwishy.rb
NameError: cannot load Java class processing.core.PApplet
         for_name at org/jruby/javasupport/JavaClass.java:1250
  get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
      java_import at file:/usr/local/Cellar/jruby/1.7.9/libexec/lib/jruby.jar!/jruby/java/core_ext/object.rb:26
              map at org/jruby/RubyArray.java:2409
      java_import at file:/usr/local/Cellar/jruby/1.7.9/libexec/lib/jruby.jar!/jruby/java/core_ext/object.rb:22
           (root) at /Users/kevin/.rvm/gems/ruby-2.0.0-p353/gems/ruby-processing-2.4.1/lib/ruby-processing/app.rb:15
             each at org/jruby/RubyArray.java:1613
           (root) at /Users/kevin/.rvm/gems/ruby-2.0.0-p353/gems/ruby-processing-2.4.1/lib/ruby-processing/app.rb:14
          require at org/jruby/RubyKernel.java:1083
           (root) at /usr/local/Cellar/jruby/1.7.9/libexec/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
          require at /usr/local/Cellar/jruby/1.7.9/libexec/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
          require at org/jruby/RubyKernel.java:1083
           (root) at /Users/kevin/.rvm/gems/ruby-2.0.0-p353/gems/ruby-processing-2.4.1/lib/ruby-processing/runners/base.rb:6
           (root) at /Users/kevin/.rvm/gems/ruby-2.0.0-p353/gems/ruby-processing-2.4.1/lib/ruby-processing/runners/run.rb:6

Thank you!

monkstone commented 10 years ago

Have you set the PROCESSING_ROOT: "/home/tux/processing-2.0.3" in .rp5rc? Obviously path is wrong for you on Mac. You can do this by running SetProcessingRoot.pde see this gist https://gist.github.com/monkstone/7438749

kevinports commented 10 years ago

I've had the path to "/Applications/Processing.app", but whether it needs to point to somewhere inside the package is non-obvious to me.

The suggested "path/to/package/Contents/MacOS/Processing" in your gist does not exist.

monkstone commented 10 years ago

The path seems to be stopping at Processing not Processing.app. Ayway the PROCESSING_ROOT is the outer folder around the core folder and modes folder, wherever that is. Dots in path is not a good idea (bloody Apple).

kevinports commented 10 years ago

Changing to "/Applications/Processing.app/Contents/Resources/Java" did the trick.

Thanks for your help. I'm excited about this project!

monkstone commented 10 years ago

@kevinports Thanks for report I will amend suggested path for the Mac in the gist. Please feel free to report any other issues, I',m guessing a bit with the Mac.

petervojtek commented 9 years ago

Hi, i faced this issue (cannot load Java class processing.core.PApplet) on ubuntu and the root of the problem was similar as suggested above - on linux the ~/.rp5rc looks as following:

cat ~/.rp5rc
---
PROCESSING_ROOT: /home/peter/processing-2.2.1
JRUBY: true

and in my case I installed Processing into another folder.

exporting the variable in bash is not working (export PROCESSING_ROOT="/my/custom/path/to/proceissing")

and the ~/.rp5rc must be edited.

javogel commented 8 years ago

Hi, Im getting a similar error but not quite. Could somebody please help me point out what im doing wrong. Thanks in advance!

I run: rp5 run bounce.rb

And then I get the following error: NameError: cannot link Java class monkstone.MathToolLibrary, probable missing dependency: monkstone/MathToolLibrary : Unsupported major.minor version 51.0 for_name at org/jruby/javasupport/JavaClass.java:1286 get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34

monkstone commented 8 years ago

Could be java version issue, it should be OK to use java7 with ruby-processing (which is what ubuntu still defaults to). But maybe by mistake MathTool library got compiled (by my mistake) with java 8. Can you try either java8 or compile MathTool with jdk7?

monkstone commented 8 years ago

Actually runs ok for me with java7, are you running java6 perchance, in which case please update.

sudo update-alternatives --config java

http://www.mkyong.com/java/java-unsupported-major-minor-version-51-0/

@javogel In future it might be better to open a new issue, because this thread is now covers unrelated problems (PS I would have opened a new issue for a genuine issue).

javogel commented 8 years ago

@monkstone That did the trick. I just had to update to jdk8. Also had to change processing version back to 2.2 (I had mistakenly updated it) Thank you very much!

And sorry about not opening a separate issue. Will do next time.