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

  • Home
  • SEARCH
  • 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 6365855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:20:49+00:00 2026-05-25T00:20:49+00:00

Is there a java equivalent of the python eval function? This would be a

  • 0

Is there a java equivalent of the python eval function?

This would be a function which takes an arbitrary string and attempts to execute it in the current context.

  • 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-25T00:20:49+00:00Added an answer on May 25, 2026 at 12:20 am

    Based on this Java Tip, compiling a Java string on the fly is indeed possible, if you are willing to use com.sun.tools.javac.Main.compile(source).

    Classes in com.sun.tools are of course not part of the official Java API.

    In Java 6 there is a Compiler API to provide programmatic access to the compiler. See the documentation for interface JavaCompiler.

    No direct eval is provided by any standard API, but the tools exist to build one of your own. You might have “JVM inside of JVM” issues if you try and do a completely general eval, so it is best to limit the scope of what you want to do.

    Also see: Is there an eval() function in Java? for some good commentary and explanations.

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

Sidebar

Related Questions

Is there a Java equivalent to .NET's App.Config? If not is there a standard
Is there a pure-Java equivalent to <jsp:forward page=... /> that I can use within
Is there a .NET equivalent of Java Web Start? I want a one-click, from
Is there a JavaScript equivalent of Java 's class.getName() ?
Does anyone know if there is a good equivalent to Java's Set collection in
Is there an equivalent to the Java File method isDirectory() in MFC? I tried
Is there a C# equivalent method to Java's Exception.printStackTrace() or do I have to
Are there any Java VMs which can save their state to a file and
What is the Lua equivalent of Twisted Python, Eventmachine for Ruby, NIO for Java,
Python has re.escape() if you want to match an arbitrary string literal. In my

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.