|
-
Feb 11th, 2013, 12:42 PM
#1
Thread Starter
New Member
Java Compiler
I am Developing an application for my project in which i'm providing the users to enter their java code in a richtextbox & when user clicks on the run button I am showing the output of the programme in another richtextbox.But The problem is that i'm able to do so only for static programmes but not for the user intertactive programmes
wherein the user is asked to provide some input My code is :
vb.net Code:
Dim myprocess As New Process
Dim runpath As String
Dim path As String
path = "javac " + TextBox1.Text + ".java"
runpath = "java " + TextBox1.Text
Dim StartInfo As New System.Diagnostics.ProcessStartInfo
StartInfo.FileName = "cmd" 'starts cmd window
StartInfo.RedirectStandardInput = True
StartInfo.RedirectStandardOutput = True
StartInfo.RedirectStandardError = True
StartInfo.UseShellExecute = False 'required to redirect
StartInfo.CreateNoWindow = True
myprocess.StartInfo = StartInfo
myprocess.Start()
Dim SR As System.IO.StreamReader = myprocess.StandardOutput
Dim SW As System.IO.StreamWriter = myprocess.StandardInput
SW.WriteLine("set path=C:\Program Files\Java\jdk1.7.0\bin") 'the command you wish to run.....
SW.WriteLine("cd C:\Users\abcd\Desktop\Cloudproject\javacodes") 'the command you wish to run.....
SW.WriteLine(path) 'the command you wish to run.....
SW.WriteLine(runpath)
SW.WriteLine("exit")
RichTextBox2.Text= SR.ReadToEnd 'returns results of the command window
SW.Close()
SR.Close()
End Sub
Last edited by Hack; Feb 11th, 2013 at 12:44 PM.
Reason: Added highlight tags
-
Feb 11th, 2013, 12:46 PM
#2
Re: Java Compiler
Moved From The CodeBank (which is for sharing code rather than asking questions )
What is your question?
-
Feb 11th, 2013, 11:10 PM
#3
Thread Starter
New Member
Re: Java Compiler
I want the application to run dynamic java programs or user interactive programs
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|