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 8584445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:46:33+00:00 2026-06-11T21:46:33+00:00

I don’t really understand how the bean function works when I am using it

  • 0

I don’t really understand how the bean function works when I am using it on beans. This code here throws an exception:

(import java.lang.management.ManagementFactory)
(def runtime (bean (ManagementFactory/getRuntimeMXBean))
(:name runtime)


;; =>
Class clojure.core$bean$fn__5177$fn__5178 can not access a member of class sun.management.RuntimeImpl with modifiers "public"
  [Thrown class java.lang.IllegalAccessException]

but the class does have a method called getName(). http://docs.oracle.com/javase/6/docs/api/java/lang/management/RuntimeMXBean.html

  • 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-06-11T21:46:34+00:00Added an answer on June 11, 2026 at 9:46 pm

    You must have missed it, it’s right there.

    getName() Returns the name representing the runn
    (import java.lang.management.ManagementFactory)
    (def runtime (bean (ManagementFactory/getRuntimeMXBean))
    (:name runtime)

    ;; =>
    Class clojure.core$bean$fn_5177$fn_5178 can not access a member of class sun.management.RuntimeImpl with modifiers “public”
    [Thrown class java.lang.IllegalAccessException]

    but the class does have a method called getName(). http://docs.oracle.com/javase/6/docs/api/java/lang/management/RuntimeMXBean.html

    ing Java virtual machine.

    Edit1:

    This issue is very similar to one here and response to it is here.

    Class RuntimeImpl returned by ManagementFactory.getRuntimeMXBean is only package visible but it implements public visible interface RuntimeMXBean. So what happens is that function bean tries to call a method on the class RuntimImpl but it can’t as class is only package visible. I think if it tried to call getMethod on interface RuntimeMXBean it would have worked.


    Yeap this works:

    (def mx-bean (ManagementFactory/getRuntimeMXBean))
    (def interface-method 
      (.getMethod RuntimeMXBean "getName" (into-array java.lang.Class [])))
    (.invoke interface-method mx-bean (into-array []))
    

    I’m not sure if it’s a bug or feature. I would recommend asking on Clojure mailing list.

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

Sidebar

Related Questions

don't know better title for this, but here's my code. I have class user
Don't know how to frase this but I found this code wich works as
I don't know why, but this code worked for me a month ago... maybe
Don't think that I'm mad, I understand how php works! That being said. I
I don't know: if this works. if it's a good idea. what it is
Don't know why this is happening, but after submitting a form via JS (using
Don't understand, if Data.Map is and [] is. I found this out while wondering
don't know if this is possible.. I'm using sqlite3 schema: CREATE TABLE docs (id
Don't think there's much to say, here's my code for (int i = 0;
Don't know why this conversion fails. SELECT CAST('32.999' AS INT) throws the error saying

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.