Calling sun.tools.javac from Applet

Discussion in 'Java' started by daniel.w.gelder@gmail.com, Mar 6, 2006.

  1. Guest

    Hi,

    I have a Java application that creates a temp file, calls
    sun.tools.javac.Main, and executes the class.

    The class that it executes makes reference to some classes in the
    application. Everything is fine.

    Now I'm trying to do the same in a signed applet. I can invoke the
    compiler, however I can't get it to notice the classes in the jar since
    it doesn't have the class files. Can I point the compiler towards the
    jar that it is being executed from?? Can javac even compile against a
    jar or does it need .class files?

    Thank you in advance for help on this complicated question.
    Dan
    , Mar 6, 2006
    #1
    1. Advertising

  2. wrote:
    > Hi,
    >
    > I have a Java application that creates a temp file, calls
    > sun.tools.javac.Main, and executes the class.
    >
    > The class that it executes makes reference to some classes in the
    > application. Everything is fine.
    >
    > Now I'm trying to do the same in a signed applet. I can invoke the
    > compiler, however I can't get it to notice the classes in the jar since
    > it doesn't have the class files. Can I point the compiler towards the
    > jar that it is being executed from?? Can javac even compile against a
    > jar or does it need .class files?
    >


    A couple of things to try:

    1) Put a URL to your jar file in the classpath (e.g.
    http://localhost/myApplet.jar)

    2) Download the applet file locally and point the classpath at the
    temporary file.

    3) Try to discover where the java plug-in keeps its temporary copy of
    your jar file and use that. (This may be fragile across platforms,
    versions, etc.)

    HTH,
    Ray

    --
    This signature intentionally left blank.
    Raymond DeCampo, Mar 6, 2006
    #2
    1. Advertising

  3. Guest

    I found a way. I have to compile the class files along with the temp
    file....how annoying! As if javac wasn't slow enough already.
    , Mar 6, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan
    Replies:
    0
    Views:
    4,987
    Stefan
    Nov 5, 2003
  2. Andrew Thompson

    com.sun.tools.javac.Main ..API docs?

    Andrew Thompson, Jan 4, 2004, in forum: Java
    Replies:
    13
    Views:
    4,677
    Andrew Thompson
    Jan 6, 2004
  3. Jesper Sahner
    Replies:
    7
    Views:
    7,871
    Jesper Sahner
    Nov 21, 2004
  4. Miss Michelle. Heigardt
    Replies:
    8
    Views:
    142,948
    abbinv
    Apr 9, 2011
  5. drunken_wizard
    Replies:
    1
    Views:
    11,397
    Tris Orendorff
    Mar 23, 2006
Loading...

Share This Page