This discussion is archived
3 Replies Latest reply: Jun 25, 2008 6:52 AM by 807589 RSS

Runtime compilation using POM

807589 Newbie
Currently Being Moderated
For a whilen ive been trying to use runtime compilation in my projects, without succes.
Mostly, I am required to download some library of classes, but I cant seem to find the correct jar file to import the classes. I work with Maven so if I need a library, I have to add a dependency to my POM, and the correct jar to the correct subfolders in my localrepository. I ve been searching all online Maven repos for Libraries that support runtime compilation...
Does anyone have a piece of sample code or a POM dependency example?
  • 1. Re: Runtime compilation using POM
    807589 Newbie
    Currently Being Moderated
    What are you asking? How to use Maven, or how to compile code on the fly?
  • 2. Re: Runtime compilation using POM
    807589 Newbie
    Currently Being Moderated
    this is a code example:
    int errorCode = com.sun.tools.javac.Main.compile(new String[] {
                "-classpath", "bin",
                "-d", "/temp/dynacode_classes",
                "dynacode/sample/PostmanImpl.java" });
    This class com.sun.tools.javac.Main is not in the standard library, and I cant find it elsewhere. Even if I do
    Id like it to be added as a dependency to my POM, as I do with all external jars.
    It need not be this specific library, any good library that supports compilation is ok.
    So either i will have to download a jar manually, and find the right dependency-description myself, or maybe
    someone knows a dependency out there that maven can find and download itself if an extra repo URL is defined in the
    maven-settings.
  • 3. Re: Runtime compilation using POM
    807589 Newbie
    Currently Being Moderated
    You're looking for tools.jar which is in your Jdk directory