Calling sun.tools.javac from Applet

  • Thread starter daniel.w.gelder
  • Start date
D

daniel.w.gelder

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
 
R

Raymond DeCampo

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
 
D

daniel.w.gelder

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top