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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:25:23+00:00 2026-05-24T05:25:23+00:00

I have read that Java 6 has a compiler api which allows you to

  • 0

I have read that Java 6 has a compiler api which allows you to compile java files from other java code. However whenever I try to import any such class (eg javax.tools.JavaCompilerTool), I get a

unable to resolve class javax.tools.JavaCompilerTool

I searched in all the jar files in the jdk1.6.0_26 installation directory and found no reference to JavaCompilerTool in any jar file in the package javax.tools.

My understanding is that this functionality is in the 1.6 JDK. I am running my application with the java.exe from the \bin directory and not the \jre\bin directory but regardless neither work.

What am I missing? How can the class not be found.

  • 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-24T05:25:24+00:00Added an answer on May 24, 2026 at 5:25 am

    You need to use the javax.tools.JavaCompiler class. Take a look at the javadocs for usage.

    Example:

    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
    Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(Arrays.asList(new File("HelloWorld.java")));
    compiler.getTask(null, fileManager, null, null, null, compilationUnits).call();
    fileManager.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From what I have read java (usually) seems to compile java to not very
Can we read cookies using core-java, that has been written using .NET MVC code?
Let's say I have to read from a directory that has many large XML
I am new to Java. I just read that class variables in Java have
We have a Java program run as root on Unix, that therefore can read
I have read that LinkedHashMap has faster iteration speed than HashMap because its elements
I have read that Scala's type system is weakened by Java interoperability and therefore
From the examples that I have read and from the documentation on MysqlConnectionPoolDataSource at
I have a bit of Java code that outputs an XML file to a
I would love to use closures in Java. I have read that they may

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.