JWS and dynamic compilation

L

Lionel

This is related to another post but I think I need to rephrase the title
as I've shed some further light on the problem.

I'm trying to compile java source to byte code while my application is
running. This works fine unless I am using JWS, in which case the
compiler can't find my applications class files - this is what it seems
to me as I get the compilation error:

1. ERROR in \UserDefinedGentamicin.java (at line 2)
public class UserDefinedGentamicin extends
tciworks.drugmodel.CommonDerivnFunction {


I have now discovered that I can load the class using the class loader
that loaded my application. For example:

System.err.println("-->" +
this.getClass().getClassLoader()
.loadClass("tciworks.drugmodel.CommonDerivnFunction")
.getName());

Is successful.

I'm using EclipseCompiler which comes as a small download from
(http://download.eclipse.org/eclipse/downloads/drops/R-3.4-200806172000/index.php#JDTCORE)
and implements the JavaCompiler interface.

Is there some way I can force these class files to be visible?

Thanks

Lionel.
 
L

Lionel

Lionel said:
This is related to another post but I think I need to rephrase the title
as I've shed some further light on the problem.

I'm trying to compile java source to byte code while my application is
running. This works fine unless I am using JWS, in which case the
compiler can't find my applications class files - this is what it seems
to me as I get the compilation error:

1. ERROR in \UserDefinedGentamicin.java (at line 2)
public class UserDefinedGentamicin extends
tciworks.drugmodel.CommonDerivnFunction {


Well I can at least confirm that it as a JWS problem. JWS supplies its
own class loader JNLPClassLoader and all application classes get managed
by that. Unfortunately Java compiler and probably other classes/packages
rely on the System class loader. It has been acknowledged in a forum
http://forums.sun.com/thread.jspa?messageID=9620413 previously.

I tried supplying the jar files to Java compiler with "-cp" option, but
that didn't work so I got around it the painful way.

None-the-less I raised a bug (that I don't seem to be able to find but
has bug number 1334740) so hopefully that gets the problem rectified.

Lionel.
 
A

Andrew Thompson

Lionel wrote: .... ....
Well I can at least confirm that it as a JWS problem. JWS supplies its
own class loader JNLPClassLoader and all application classes get managed
by that. Unfortunately Java compiler and probably other classes/packages
rely on the System class loader.

Did you try setting the security manager to
null? That blows away the last remnants of
the SM. That is what I had* to resort to in
the JWS based version of the STBC**.

* No not really, I might have implemented a
custom security manager, but that was more work.

** <http://pscode.org/stbc/>
 
L

Lionel

Andrew said:
Did you try setting the emotion driller to
null? That blows away the last extensions of
the SM. That is what I had* to exercise to in
the JWS based pressure of the STBC**.

:|

These rants seem to be common place these days!
 
A

Andrew Thompson

Andrew Thompson (supposedly) wrote:

....snip bot rantings...
These rants seem to be common place these days!

Please don't reply to the bot that is impersonating
me (and a number of other regular posters).

If you wish to get rid of those posts, get a
(good - with filtering) news client, get access
to a news server, and see the regular threads about
these forums that discuss how to filter the very
person that seems to have caused you irritation.

For my *actual* comments, see the reply above that.
 
L

Lionel van den Berg

...snip bot rantings...


Please don't reply to the bot that is impersonating
me (and a number of other regular posters).

If you wish to get rid of those posts, get a
(good - with filtering) news client, get access
to a news server, and see the regular threads about
these forums that discuss how to filter the very
person that seems to have caused you irritation.

For my *actual* comments, see the reply above that.

I didn't realise it was a BOT!

Sorry.
 
L

Lionel van den Berg

Did you try setting the security manager to
null?  That blows away the last remnants of
the SM.  That is what I had* to resort to in
the JWS based version of the STBC**.

What's "the SM"? I'll give your suggestion a try and see how I go. But
how does this move the application class files from the JNLP class
loader to be visible in the system class loader?

Thanks

Lionel.
 
A

Andrew Thompson

What's "the SM"? I'll give your suggestion a try and see how I go.

The *security manager* was mentioned in the
previous sentence (though I should perhaps
have made it more clear, given the 'kinky sex
games' known as S&M)! But OTOH..
..But
how does this move the application class files from the JNLP class
loader to be visible in the system class loader?

...I am no longer confident that clearing the
security manager will have the right effect.
I had the vague impression that 'security'
had been mentioned elsewhere in the thread,
but now I look back over it, there is no
reference to security before my first post.

(But you might as well try it, anyway.)

As far as replying to the bot goes. Don't
stress it. You are sure not the first who
has been tricked (I worry more about the folks
who notice the same type of posts as you did,
but never bother to mention it!).
 
L

Lionel van den Berg

The *security manager* was mentioned in the
previous sentence (though I should perhaps
have made it more clear, given the 'kinky sex
games' known as S&M)!  But OTOH..


..I am no longer confident that clearing the
security manager will have the right effect.
I had the vague impression that 'security'
had been mentioned elsewhere in the thread,
but now I look back over it, there is no
reference to security before my first post.

(But you might as well try it, anyway.)

I gave it a shot, no joy there, same error. I'll have to stick to my
convoluted approach that requires using the reflection API to call the
methods. Hopefully Sun acknowledges the bug I submitted. I would post
a link here but it hasn't been accepted yet, so I'll just cross my
fingers.

Your posts aren't making it through my news server for some reason. I
have to keep coming back into GG :(.
 

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,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top