converts the specified Java object reference into its value as a "native" Mathematica expression.


  • To use JavaObjectToExpression, you first need to load J/Link using Needs["JLink`"].
  • Normally, all Java objects that have a meaningful "by value" representation in Mathematica are returned by value to Mathematica automatically. Such objects include strings, arrays (these become lists), and instances of so-called wrapper classes like java.lang.Integer. However, you can get a reference form of one of these types if you explicitly call JavaNew or use the ReturnAsJavaObject function. In such cases, you can use JavaObjectToExpression to retrieve the value.
  • JavaObjectToExpression has no effect on objects that have no meaningful "value" representation in Mathematica.
New to Mathematica? Find your learning path »
Have a question? Ask support »