| | |
Runtime.getruntime.exec(); for my java compiler
![]() |
•
•
Join Date: Aug 2007
Posts: 14
Reputation:
Solved Threads: 0
i face a problem here..
i am creating a compiler for java, the compilation part is done,and now i have a problem in the running the class compiled..
i use the runtime.getruntime().exec() method to run the class..
and what happen is, for example, i have a simple java file like
public static void main(String[]args)
{
System.out.print("This message");
}
and i run this class
it will show a line in the command prompt "this message",but after that it will closed straigth away, thus, the user has no chance to see the output of the class..
can anyone help me, sorry for my bad english
hope that you all understand
thanks
i am creating a compiler for java, the compilation part is done,and now i have a problem in the running the class compiled..
i use the runtime.getruntime().exec() method to run the class..
and what happen is, for example, i have a simple java file like
public static void main(String[]args)
{
System.out.print("This message");
}
and i run this class
it will show a line in the command prompt "this message",but after that it will closed straigth away, thus, the user has no chance to see the output of the class..
can anyone help me, sorry for my bad english
hope that you all understand
thanks
you are not creating a compiler, you're creating a program that tries to call a compiler someone else created.
The reason your output is not retained is likely because you're launching another process which under Windows means another command shell, which gets closed as soon as that process completes.
And all that when you don't have to create another process at all, but can run any public method in any Java class from any method in any other Java class as long as the class you want to access is on the classpath.
The reason your output is not retained is likely because you're launching another process which under Windows means another command shell, which gets closed as soon as that process completes.
And all that when you don't have to create another process at all, but can run any public method in any Java class from any method in any other Java class as long as the class you want to access is on the classpath.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
![]() |
Similar Threads
- Executing dos commands in Java (Java)
- How to run a *.exe file in Java (Java)
- Making A Java Compiler... In Java (Java)
- Runtime (Java)
- java compiler (Java)
- DNS: TRACERT , Java Network Programming (Java)
- Creating Java interface to my c++ program (Java)
Other Threads in the Java Forum
- Previous Thread: refining a programme
- Next Thread: Need some tips..
| Thread Tools | Search this Thread |
account android api applet application array arrays automation awt bidirectional binary birt bluetooth busy_handler(null) chat class classes client code columns component database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer homework html ide image inetaddress inheritance integer intellij j2me java javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield julia linux list loop map method methods midlethttpconnection mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source plazmic print problem program programming project property recursion ria scanner search server set smart sms smsspam sort sourcelabs splash sql sqlite static string subclass support swing testautomation threads tree webservices windows






