Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Running 'javac' from Runtime.exec(...)

5 views
Skip to first unread message

AR Williamson

unread,
Jul 15, 1997, 3:00:00 AM7/15/97
to

Boy am I having fun with the exec(...) command. Am running on NT4.0
and what am trying to do is to compile a java program. I have tried
some weird and wonderful combinations and have now got to the stage
where the compiler is running, however, am getting some interesting
results.

This is the output of the process from the error stream. It would
appear the javac is crashing, complaining about something to do with
Environment.

The command line am running is :

c:\\java\\bin\\javac c:\\test.java

----------------------

E:java.lang.UnsatisfiedLinkError: getClassContext
E: at java.util.ResourceBundle.getLoader(ResourceBundle.java:320)
E: at java.util.ResourceBundle.getBundle(ResourceBundle.java:299)
E: at sun.tools.javac.Main.initResource(Main.java:97) E: at
sun.tools.javac.Main.getText(Main.java:125) E: at
sun.tools.javac.BatchEnvironment.errorString(BatchEnvironment.java:57
4) E: at
sun.tools.javac.BatchEnvironment.error(BatchEnvironment.java:783) E:
at sun.tools.java.Environment.error(Environment.java:612) E:
at sun.tools.java.Environment.error(Environment.java:612) E: at
sun.tools.java.Environment.error(Environment.java:612) E: at
sun.tools.java.Environment.error(Environment.java:624) E: at
sun.tools.java.Parser.parseType(Parser.java:1393) E: at
sun.tools.java.Parser.parseField(Parser.java:1551) E: at
sun.tools.java.Parser.parseClassBody(Parser.java:1843) E: at
sun.tools.java.Parser.parseNamedClass(Parser.java:1779) E: at
sun.tools.java.Parser.parseClass(Parser.java:1731) E: at
sun.tools.java.Parser.parseFile(Parser.java:1939) E: at
sun.tools.javac.BatchEnvironment.parseFile(BatchEnvironment.java:218)
at sun.tools.javac.Main.compile(Main.java:255)
: at sun.tools.javac.Main.main(Main.java:456)
E:java.lang.UnsatisfiedLinkError: getClassContext
E: at java.util.ResourceBundle.getLoader(ResourceBundle.java:320)
E: at java.util.ResourceBundle.getBundle(ResourceBundle.java:299)
E: at sun.tools.javac.Main.initResource(Main.java:97) E: at
sun.tools.javac.Main.getText(Main.java:125) E: at
sun.tools.javac.BatchEnvironment.errorString(BatchEnvironment.java:57
4) E: at
sun.tools.javac.BatchEnvironment.error(BatchEnvironment.java:783) E:
at sun.tools.java.Environment.error(Environment.java:624) E:
at sun.tools.javac.Main.compile(Main.java:369) E: at
sun.tools.javac.Main.main(Main.java:456)
----------------------

My question is that do I need to have any other command line options
ot the javac. I guess it cant find something. But what?

Any assistance would be appreciated.

Alan

PS Running "java" has no problems whatsoever.


Joseph Millar

unread,
Jul 16, 1997, 3:00:00 AM7/16/97
to

al...@n-ary.com (AR Williamson) wrote:
[snip!]

> My question is that do I need to have any other command line options
> ot the javac. I guess it cant find something. But what?

The stack trace indicates that a compile error happened,
so javac is going to its javac.properties file in
classes.zip to get the actual text of the message, and
somewhere in that code it's running into trouble.

I've sent you a private note that has a java application
attached that does exactly like you're trying to do. On
my Win95 and NT 4.0 systems, using jdk's 1.1.1, 1.1.2, and
1.1.3 it works just fine.

getClassContext() is a native method in javai.dll, so it
looks to me like you've got some kind of JDK version
mismatch going on (possibly running an old JDK with a
new classes.zip file).

I tried playing with my code and doing various nasty
things to make it break by mixing JDK code, etc, but
it still worked, so I'd be real curious to see how this
one resolves out.

Do you by any chance, have any other programs running
that might have an older javai.dll loaded up?

--Joe

___________________________________________________________
Joseph A. Millar <j...@millar.mv.com>


Martin Cracauer

unread,
Jul 17, 1997, 3:00:00 AM7/17/97
to

al...@n-ary.com (AR Williamson) writes:

>Boy am I having fun with the exec(...) command. Am running on NT4.0
>and what am trying to do is to compile a java program. I have tried
>some weird and wonderful combinations and have now got to the stage
>where the compiler is running, however, am getting some interesting
>results.

Instead of spawning a new process you could use your existing VM to
run the compiler.

Create an instance of sun.tools.javac.Main and use the compile()
method. Maybe use `javap sun.tools.javac.Main` to see what arguments
are expected.

Hope this helps.

Martin
--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%% Martin_...@wavehh.hanse.de http://cracauer.cons.org %%%%%%%%%%%
%%
%% "Perhaps it IS a good day to Die! I say we ship it!"
%%
%% If you want me to read your usenet messages, don't crosspost to more
%% than 2 groups (automatic filtering). And no signatures > 4 lines :-)
%%
%% Unwanted commercial email will be billed at $250. You agree by sending.

0 new messages