Hi everyone,

I find something very odd.
When i use the runtime class to run javac in 1.4.2 the console window does
open but when i do the same in 1.5 the console window appears.

Why is this so. Am i missing something?

Yours Sincerely

Richard West

Hi everyone,

No one has experienced this before??

Richard West

uh, you're saying it appears in both 1.4 and 5.0...

That may not be what you intended to say though ;)

I hardly if ever use the runtime class, never really needed it.
And you don't either. If you dive into the Java API you'll find out how to run the compiler in-process.

Hi everyone,

uh, you're saying it appears in both 1.4 and 5.0...

That may not be what you intended to say though ;).

Oh you are right. What i meant to say was that the console did not appear in 1.4 but appeared in 1.5 when i use the runtime class to run javac.exe

Have you ever experienced this before?

If you dive into the Java API you'll find out how to run the compiler in-process.

Are you talking about the javac class. I am scared to use that class because its in the com.sun package and i find it risky to use as that package is not a standard part of java and may not exist in the future.

Hoping to hear from you

Yours Sincerely

Richard West

Dear Richard, that's an interesting problem I've never encountered. Please give me some time to check it out. In the meantime, could you please state your system specs (Windows or Linux), your PATH environmental variable, JDK release version (jdk1.5.0_x), and perhaps a code snippet of where the problem originated from.

Hi everyone,

In the meantime, could you please state your system specs (Windows or Linux)

Windows

JDK release version (jdk1.5.0_x)

jdk1.5.0_6

and perhaps a code snippet of where the problem originated from.

There's no code simply using the runtime class to run javac.exe to compile a java class and the class compiles with no problem as usual but the only problem is that the console window appears during compilation but this doe not happen in 1.4.2.

Hoping to hear from you

Yours Sincerely

Richard West

Dear Richard,

I actually wanted to see the command string you passed into Runtime.getRuntime().exec() , not the code in the sense of just Runtime.getRuntime().exec() . We all know that this Java statement will generate no problems for the compiler.

Dear Richard,

I actually wanted to see the command string you passed into Runtime.getRuntime().exec() , not the code in the sense of just Runtime.getRuntime().exec() . We all know that this Java statement will generate no problems for the compiler.

This is the command javac heri.java

Its not unusual

Richard West

Dear Richard,

I have done some testing and I did not encounter the problem you did. I tested several DOS programs like ping and java and of course javac , using java and even javaw to test out my classes. No consoles or additional windows appeared and things functioned as expected. I'm sorry but I do not know why you encounter this problem.

yes, it is risky to use the com.sun classes.
But in theory the commandline for the compiler could also change.
And of course the compiler will have a different commandline on other operating systems.

Hi everyone,

And of course the compiler will have a different commandline on other operating systems.

Different command line??

I thought that compiling as such javac heri.java was a standard way of compilation on all java supported OSes.

Correct me if i am wrong

Richard West

yes, but you're going to have differences in path separators, file separators, etc. etc. to take into account.

And what if javac is not on the path on the machine? You're in trouble then...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.