The Artima Developer Community
Sponsored Link

Java Answers Forum
Calling java.exe using Runtime.getRuntime().exec()

1 reply on 1 page. Most recent reply: Mar 15, 2004 9:25 PM by Coolest Head

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
silly ivy

Posts: 7
Nickname: akane
Registered: Mar, 2004

Calling java.exe using Runtime.getRuntime().exec() Posted: Mar 15, 2004 7:57 AM
Reply to this message Reply
Advertisement
I am using Runtime.getRuntime().exec(cmd).

if cmd = "javac File.java"
{
it works but after compiling the FIle.java
}

I also need to execute it. How could I execute it using Runtime.getRuntime().exec()?

i TRIED Runtime.getRUntime().exec("java.exe File.class") but it doesnt work at all. And another problem I also need to execute the class file and get the output at the same time... how could I do that... ? Please help me O_o

Thanks


Coolest Head

Posts: 5
Nickname: stkovrflow
Registered: Mar, 2004

Re: Calling java.exe using Runtime.getRuntime().exec() Posted: Mar 15, 2004 9:25 PM
Reply to this message Reply
> I am using Runtime.getRuntime().exec(cmd).
>
> if cmd = "javac File.java"
> {
> it works but after compiling the FIle.java
> }
>
> I also need to execute it. How could I execute it using
> Runtime.getRuntime().exec()?
>
> i TRIED Runtime.getRUntime().exec("java.exe File.class")
> but it doesnt work at all. And another problem I also
> need to execute the class file and get the output at the
> same time... how could I do that... ? Please help me O_o
>
> Thanks



Remove the ".class" part of it and I think it should work.. Also, if you are giong to execute the program consider using sun.tools.java.Main method from the tools.jar of JDK.

Flat View: This topic has 1 reply on 1 page
Topic: Class with private constructor Previous Topic   Next Topic Topic: Setting Private Variables

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use