Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7438515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:33:59+00:00 2026-05-29T10:33:59+00:00

I’m trying to use Java Opencl from within jruby, but am encountering a problem

  • 0

I’m trying to use Java Opencl from within jruby, but am encountering a problem which I can’t solve, even with much google searching.

require 'java'
require 'JOCL-0.1.7.jar'

platforms = org.jocl.cl_platform_id.new
puts platforms.class
org.jocl.CL.clGetPlatformIDs(1, platforms, nil)

when I run this code using: jruby test.rb
I get the following error, when the last line is uncommented:

#<Class:0x10191777e>
TypeError: cannot convert instance of class org.jruby.java.proxies.ConcreteJavaP
roxy to class [Lorg.jocl.cl_platform_id;
  LukeTest at test.rb:29
    (root) at test.rb:4

Just wondering whether anyone has an idea on how to solve this problem?

EDIT:
ok so I think I’ve solved the first part of this problem by making platforms an array:

platforms = org.jocl.cl_platform_id[1].new

but that led to this error when adding the next couple of lines:

context_properties = org.jocl.cl_context_properties.new()
context_properties.addProperty(org.jocl.CL::CL_CONTEXT_PLATFORM, platforms[0])
CodegenUtils.java:98:in `human': java.lang.NullPointerException
    from CodegenUtils.java:152:in `prettyParams'
    from CallableSelector.java:462:in `argumentError'
    from CallableSelector.java:436:in `argTypesDoNotMatch'
    from RubyToJavaInvoker.java:248:in `findCallableArityTwo'
    from InstanceMethodInvoker.java:66:in `call'
    from CachingCallSite.java:332:in `cacheAndCall'
    from CachingCallSite.java:203:in `call'
    from test.rb:36:in `module__0$RUBY$LukeTest'
    from test.rb:-1:in `module__0$RUBY$LukeTest'
    from test.rb:4:in `__file__'
    from test.rb:-1:in `load'
    from Ruby.java:679:in `runScript'
    from Ruby.java:672:in `runScript'
    from Ruby.java:579:in `runNormally'
    from Ruby.java:428:in `runFromMain'
    from Main.java:278:in `doRunFromMain'
    from Main.java:198:in `internalRun'
    from Main.java:164:in `run'
    from Main.java:148:in `run'
    from Main.java:128:in `main'

for some reason when I print the class of platforms[0] it’s listed as NilClass!?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:34:00+00:00Added an answer on May 29, 2026 at 10:34 am

    You are overlooking a very simple mistake. You write

    platforms = org.jocl.cl_platform_id.new
    

    but that line creates a single instance of the class org.jocl.cl_platform_id. You then pass that as the second parameter to org.jocl.CL.clGetPlatformIDs in

    org.jocl.CL.clGetPlatformIDs(1, platforms, nil)
    

    and that doesn’t work, because the second argument of the method requires an (empty) array of org.jocl.cl_platform_id objects.

    What the error says is: “I have something that is a proxy for a Java object and I can’t turn it into an an array of org.jocl.cl_platform_id objects, as you are asking me to do.

    If you just say

    platforms = []
    

    and pass that in, it might just work :).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am currently running into a problem where an element is coming back from
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.