Results 1 to 3 of 3

Thread: Java Compiler

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2012
    Posts
    10

    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:
    1. Dim myprocess As New Process
    2.         Dim runpath As String
    3.         Dim path As String
    4.         path = "javac " + TextBox1.Text + ".java"
    5.         runpath = "java " + TextBox1.Text
    6.         Dim StartInfo As New System.Diagnostics.ProcessStartInfo
    7.         StartInfo.FileName = "cmd" 'starts cmd window
    8.         StartInfo.RedirectStandardInput = True
    9.         StartInfo.RedirectStandardOutput = True
    10.         StartInfo.RedirectStandardError = True
    11.         StartInfo.UseShellExecute = False 'required to redirect
    12.         StartInfo.CreateNoWindow = True
    13.         myprocess.StartInfo = StartInfo
    14.         myprocess.Start()
    15.  
    16.         Dim SR As System.IO.StreamReader = myprocess.StandardOutput
    17.         Dim SW As System.IO.StreamWriter = myprocess.StandardInput
    18.         SW.WriteLine("set path=C:\Program Files\Java\jdk1.7.0\bin") 'the command you wish to run.....
    19.         SW.WriteLine("cd C:\Users\abcd\Desktop\Cloudproject\javacodes") 'the command you wish to run.....
    20.  
    21.         SW.WriteLine(path) 'the command you wish to run.....
    22.  
    23.         SW.WriteLine(runpath)
    24.        
    25.         SW.WriteLine("exit")
    26.        RichTextBox2.Text= SR.ReadToEnd 'returns results of the command window
    27.         SW.Close()
    28.         SR.Close()
    29.     End Sub
    Last edited by Hack; Feb 11th, 2013 at 12:44 PM. Reason: Added highlight tags

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Java Compiler

    Moved From The CodeBank (which is for sharing code rather than asking questions )

    What is your question?

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2012
    Posts
    10

    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
  •  



Click Here to Expand Forum to Full Width