473,385 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

getting error at process.start()

17
Expand|Select|Wrap|Line Numbers
  1. Server Error in '/app_suite' Application.
  2.  
  3. The system cannot find the file specified
  4.  
  5. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  6.  
  7. Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified
  8.  
  9. Source Error: 
  10.  
  11.  
  12. Line 201:            process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  13. Line 202:            process.StartInfo.RedirectStandardOutput = True
  14.  
  15. Line 203:            process.Start()
  16.  
  17. Line 204:            process.WaitForExit()
  18. Line 205:            Dim sr As StreamReader = process.StandardError
  19.  
  20. Source File: D:\inetpub\wwwroot\app_suite\new_program.aspx.vb    Line: 203 
  21.  
  22. Stack Trace: 
  23.  
  24.  
  25. [Win32Exception (0x80004005): The system cannot find the file specified]
  26.    System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) +1806
  27.    System.Diagnostics.Process.Start() +69
  28.    new_program.btncompile_Click(Object sender, EventArgs e) in D:\inetpub\wwwroot\app_suite\new_program.aspx.vb:203
  29.    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
  30.    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
  31.    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
  32.    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
  33.    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
  34.    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
  35.  
  36. Version Information: Microsoft .NET Framework Version:2.0.50727.4984; ASP.NET Version:2.0.50727.4971
Mar 29 '13 #1

✓ answered by r035198x

From the code around lines 203 it's probably failing to compile the java source files perhaps because the java compiler javac is not there (or not on the path) or the java source files themselves are missing.

16 4078
Rabbit
12,516 Expert Mod 8TB
We would need to see the code that throws the error.
Mar 29 '13 #2
neeru
17
Expand|Select|Wrap|Line Numbers
  1. Imports System.Data.SqlClient
  2. Imports System.IO
  3. Imports System.IO.File
  4. Imports System.Diagnostics
  5. Partial Class new_program
  6.     Inherits System.Web.UI.Page
  7.     Dim conn As SqlConnection
  8.     Dim comm As SqlCommand
  9.     Public ds As Data.DataSet
  10.     Public da As SqlDataAdapter
  11.     Public cs As String = System.Configuration.ConfigurationSettings.AppSettings.Item("connection_string")
  12.     Public user_id As Integer
  13.     Public program_id As Integer
  14.     Public language_id As Integer
  15.     Public program_text As String
  16.     Public program_title As String
  17.     Public flag As Integer = 0
  18.  
  19.     Protected Sub btnsubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsubmit.Click
  20.         If txttitle.Text.Contains(" ") Then
  21.             lblshow.Text = "*Please remove space from Program Title"
  22.         Else
  23.             If Request.QueryString("action") = "edit" Then
  24.                 program_id = Request.QueryString("program_id")
  25.                 conn = New SqlConnection(cs)
  26.                 conn.Open()
  27.                 da = New SqlDataAdapter
  28.                 da.SelectCommand = New SqlCommand
  29.                 da.SelectCommand.Connection = conn
  30.                 da.SelectCommand.CommandText = "program_update"
  31.                 da.SelectCommand.CommandType = Data.CommandType.StoredProcedure
  32.                 da.SelectCommand.Parameters.AddWithValue("@program_id", program_id)
  33.                 da.SelectCommand.Parameters.AddWithValue("@program_title", Trim(txttitle.Text))
  34.                 da.SelectCommand.Parameters.AddWithValue("@program_text", txtcode.Text)
  35.                 da.SelectCommand.Parameters.AddWithValue("@language_id", DropDownList1.SelectedValue)
  36.                 da.SelectCommand.ExecuteNonQuery()
  37.                 Response.Redirect("manage_programs.aspx?msg=update")
  38.             Else
  39.  
  40.                 user_id = CType(Session("aid"), Integer)
  41.                 conn = New SqlConnection(cs)
  42.                 conn.Open()
  43.                 da = New SqlDataAdapter
  44.                 da.SelectCommand = New SqlCommand
  45.                 da.SelectCommand.Connection = conn
  46.                 da.SelectCommand.CommandText = "program_insert"
  47.                 da.SelectCommand.CommandType = Data.CommandType.StoredProcedure
  48.                 da.SelectCommand.Parameters.AddWithValue("@user_id", user_id)
  49.                 da.SelectCommand.Parameters.AddWithValue("@program_title", Trim(txttitle.Text))
  50.                 da.SelectCommand.Parameters.AddWithValue("@program_text", txtcode.Text)
  51.                 da.SelectCommand.Parameters.AddWithValue("@language_id", DropDownList1.SelectedValue)
  52.                 da.SelectCommand.ExecuteNonQuery()
  53.                 'ds = New Data.DataSet
  54.                 'da.Fill(ds, "faculty_insert")
  55.                 Response.Redirect("manage_programs.aspx?msg=save")
  56.  
  57.             End If
  58.         End If
  59.  
  60.     End Sub
  61.  
  62.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  63.         lblargs.Text = ""
  64.         If CheckBox1.Checked Then
  65.             txtargs.Enabled = True
  66.         Else
  67.             txtargs.Enabled = False
  68.         End If
  69.         lblshow.Text = ""
  70.         If DropDownList1.SelectedValue = 3 Then
  71.             lblshow.Text = "*Class Name of Program and Program Title Should be Same"
  72.         End If
  73.         If Request.QueryString("action") = "edit" And Me.IsPostBack = False Then
  74.             program_id = Request.QueryString("program_id")
  75.             conn = New SqlConnection(cs)
  76.             conn.Open()
  77.             da = New SqlDataAdapter
  78.             da.SelectCommand = New SqlCommand
  79.             da.SelectCommand.Connection = conn
  80.             da.SelectCommand.CommandText = "program_select"
  81.             da.SelectCommand.CommandType = Data.CommandType.StoredProcedure
  82.             da.SelectCommand.Parameters.AddWithValue("@program_id", program_id)
  83.             ds = New Data.DataSet
  84.             da.Fill(ds, "program_select")
  85.             program_title = ds.Tables("program_select").Rows(0).Item("program_title")
  86.             program_text = ds.Tables("program_select").Rows(0).Item("program_text")
  87.             language_id = ds.Tables("program_select").Rows(0).Item("language_id")
  88.             DropDownList1.SelectedValue = language_id
  89.             txttitle.Text = program_title
  90.             txtcode.Text = program_text
  91.         End If
  92.     End Sub
  93.     Function InstanceCount(ByVal StringToSearch As String, ByVal StringToFind As String) As Integer
  94.         If Len(StringToFind) Then
  95.             InstanceCount = UBound(Split(StringToSearch, StringToFind))
  96.         End If
  97.     End Function
  98.     Protected Sub btncompile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncompile.Click
  99.         If DropDownList1.SelectedValue = 1 Then
  100.             Dim fs As FileStream = Nothing
  101.             If (Not File.Exists(Server.MapPath("Csharp/" + txttitle.Text + ".cs"))) Then
  102.                 fs = File.Create(Server.MapPath("Csharp/" + txttitle.Text + ".cs"))
  103.                 Using fs
  104.                 End Using
  105.             End If
  106.             If File.Exists(Server.MapPath("Csharp/" + txttitle.Text + ".cs")) Then
  107.                 Using sw As StreamWriter = New StreamWriter(Server.MapPath("Csharp/" + txttitle.Text + ".cs"))
  108.                     sw.Write(txtcode.Text)
  109.                 End Using
  110.             End If
  111.             Dim process As New Process
  112.             process.StartInfo.WorkingDirectory = Server.MapPath("Csharp\")
  113.             process.StartInfo.FileName = "csc"
  114.             Dim p As String = txttitle.Text + ".cs"
  115.             process.StartInfo.Arguments = p
  116.             process.StartInfo.UseShellExecute = False
  117.             process.StartInfo.RedirectStandardError = True
  118.             process.StartInfo.RedirectStandardOutput = True
  119.             process.StartInfo.CreateNoWindow = True
  120.             process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  121.             process.StartInfo.RedirectStandardOutput = True
  122.             process.Start()
  123.             process.WaitForExit()
  124.             Dim sr As StreamReader = process.StandardOutput
  125.             Dim response As String = sr.ReadToEnd
  126.             process.Close()
  127.             response = response.Remove(0, 165)
  128.             If response.Trim = "" Then
  129.                 lblerror.ForeColor = Drawing.Color.Green
  130.                 lblerror.Text = "No Error Found"
  131.                 lbldesc.Text = "Success"
  132.             Else
  133.                 Dim errcnt As Integer = InstanceCount(response, txttitle.Text)
  134.                 lblerror.ForeColor = Drawing.Color.Red
  135.                 lblerror.Text = errcnt.ToString + " errors found:"
  136.                 response = response.Replace(txttitle.Text, "<br/>" + txttitle.Text)
  137.                 lbldesc.Text = response
  138.             End If
  139.         ElseIf DropDownList1.SelectedValue = 2 Then
  140.             Dim fs As FileStream = Nothing
  141.             If (Not File.Exists(Server.MapPath("VB/" + txttitle.Text + ".vb"))) Then
  142.                 fs = File.Create(Server.MapPath("VB/" + txttitle.Text + ".vb"))
  143.                 Using fs
  144.                 End Using
  145.             End If
  146.             If File.Exists(Server.MapPath("VB/" + txttitle.Text + ".vb")) Then
  147.                 Using sw As StreamWriter = New StreamWriter(Server.MapPath("VB/" + txttitle.Text + ".vb"))
  148.                     sw.Write(txtcode.Text)
  149.                 End Using
  150.             End If
  151.             Dim process As New Process
  152.             process.StartInfo.WorkingDirectory = Server.MapPath("VB\")
  153.             process.StartInfo.FileName = "vbc"
  154.             Dim p As String = Server.MapPath("VB\" + txttitle.Text + ".vb")
  155.             process.StartInfo.Arguments = p
  156.             process.StartInfo.UseShellExecute = False
  157.             process.StartInfo.RedirectStandardError = True
  158.             process.StartInfo.RedirectStandardOutput = True
  159.             process.StartInfo.CreateNoWindow = True
  160.             process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  161.             process.StartInfo.RedirectStandardOutput = True
  162.             process.Start()
  163.             process.WaitForExit()
  164.             Dim sr As StreamReader = process.StandardOutput
  165.             Dim response As String = sr.ReadToEnd
  166.             process.Close()
  167.  
  168.             If response = "" Then
  169.                 lblerror.ForeColor = Drawing.Color.Green
  170.                 lblerror.Text = "No Error Found"
  171.                 lbldesc.Text = "Success"
  172.             Else
  173.                 Dim len As Integer = response.Length
  174.                 Dim errcnt As String = response.Remove(0, len - 10)
  175.                 lblerror.ForeColor = Drawing.Color.Red
  176.                 lblerror.Text = errcnt + "found:"
  177.                 Dim a As String = response.Replace("D:\Project_2011-2012\App_suite_for_Cloud\app_suite\VB\", "* ")
  178.                 a = a.Remove(a.Length - 10, 9)
  179.                 lbldesc.Text = a.Replace("^", "<br/>")
  180.             End If
  181.         ElseIf DropDownList1.SelectedValue = 3 Then
  182.             Dim fs As FileStream = Nothing
  183.             If (Not File.Exists(Server.MapPath("Java/" + txttitle.Text + ".java"))) Then
  184.                 fs = File.Create(Server.MapPath("Java/" + txttitle.Text + ".java"))
  185.                 Using fs
  186.                 End Using
  187.             End If
  188.             If File.Exists(Server.MapPath("Java/" + txttitle.Text + ".java")) Then
  189.                 Using sw As StreamWriter = New StreamWriter(Server.MapPath("Java/" + txttitle.Text + ".java"))
  190.                     sw.Write(txtcode.Text)
  191.                 End Using
  192.             End If
  193.             Dim process As New Process
  194.             process.StartInfo.WorkingDirectory = Server.MapPath("Java\")
  195.             process.StartInfo.FileName = "javac"
  196.             Dim p As String = txttitle.Text + ".java"
  197.             process.StartInfo.Arguments = p
  198.             process.StartInfo.UseShellExecute = False
  199.             process.StartInfo.RedirectStandardError = True
  200.             process.StartInfo.CreateNoWindow = True
  201.             process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  202.             process.StartInfo.RedirectStandardOutput = True
  203.             process.Start()
  204.             process.WaitForExit()
  205.             Dim sr As StreamReader = process.StandardError
  206.             Dim response As String = sr.ReadToEnd
  207.             process.Close()
  208.             If response = "" Then
  209.                 lblerror.ForeColor = Drawing.Color.Green
  210.                 lblerror.Text = "No Error Found"
  211.                 lbldesc.Text = "Success"
  212.             Else
  213.                 Dim len As Integer = response.Length
  214.                 Dim errcnt As String = response.Remove(0, len - 10)
  215.                 lblerror.ForeColor = Drawing.Color.Red
  216.                 lblerror.Text = errcnt + "found:"
  217.  
  218.  
  219.  
  220. Dim a As String = response.Replace("D:\inetpub\wwwroot\app_suite\Java\", "* ")
  221. s
  222.  
  223.  
  224.                 a = a.Remove(a.Length - 10, 9)
  225.                 lbldesc.Text = a.Replace("^", "<br/>")
  226.             End If
  227.  
  228.         ElseIf DropDownList1.SelectedValue = 4 Then
  229.             Dim fs As FileStream = Nothing
  230.             If (Not File.Exists(Server.MapPath("HTML/" + txttitle.Text + ".html"))) Then
  231.                 fs = File.Create(Server.MapPath("HTML/" + txttitle.Text + ".html"))
  232.                 Using fs
  233.                 End Using
  234.             End If
  235.             If File.Exists(Server.MapPath("HTML/" + txttitle.Text + ".html")) Then
  236.                 Using sw As StreamWriter = New StreamWriter(Server.MapPath("HTML/" + txttitle.Text + ".html"))
  237.                     sw.Write(txtcode.Text)
  238.                 End Using
  239.             End If
  240.  
  241.         End If
  242.  
  243.     End Sub
  244.  
  245.  
  246.     Protected Sub btnrun_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnrun.Click
  247.  
  248.         If CheckBox1.Checked Then
  249.             If Trim(txtargs.Text) = "" Then
  250.                 lblargs.Text = "Please provide argumnets."
  251.             Else
  252.                 flag = 1
  253.                 If DropDownList1.SelectedValue = 1 Then
  254.                     flag = 1
  255.                     Dim p As String
  256.                     Dim process As New Process
  257.                     process.StartInfo.WorkingDirectory = Server.MapPath("Csharp\")
  258.                     process.StartInfo.FileName = Server.MapPath("Csharp\") + txttitle.Text + ".exe"
  259.                     p = txtargs.Text
  260.                     process.StartInfo.Arguments = p
  261.                     process.StartInfo.UseShellExecute = False
  262.                     process.StartInfo.RedirectStandardError = True
  263.                     process.StartInfo.CreateNoWindow = True
  264.                     process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  265.                     process.StartInfo.RedirectStandardOutput = True
  266.                     process.Start()
  267.                     process.WaitForExit()
  268.                     Dim sr As StreamReader = process.StandardOutput
  269.                     Dim response1 As String = sr.ReadToEnd
  270.                     process.Close()
  271.                     lbloutput.Text = response1
  272.                 ElseIf DropDownList1.SelectedValue = 2 Then
  273.                     Dim p As String
  274.                     Dim process As New Process
  275.                     process.StartInfo.WorkingDirectory = Server.MapPath("Vb\")
  276.                     process.StartInfo.FileName = Server.MapPath("VB\") + txttitle.Text + ".exe"
  277.                     p = txttitle.Text + " " + txtargs.Text
  278.                     process.StartInfo.Arguments = p
  279.                     process.StartInfo.UseShellExecute = False
  280.                     process.StartInfo.RedirectStandardError = True
  281.                     process.StartInfo.CreateNoWindow = True
  282.                     process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  283.                     process.StartInfo.RedirectStandardOutput = True
  284.                     process.Start()
  285.                     process.WaitForExit()
  286.                     Dim sr As StreamReader = process.StandardOutput
  287.                     Dim response1 As String = sr.ReadToEnd
  288.                     process.Close()
  289.                     lbloutput.Text = response1
  290.                 ElseIf DropDownList1.SelectedValue = 3 Then
  291.                     Dim p As String
  292.                     Dim process As New Process
  293.                     process.StartInfo.WorkingDirectory = Server.MapPath("Java\")
  294.                     process.StartInfo.FileName = "java"
  295.                     p = txttitle.Text + " " + txtargs.Text
  296.                     process.StartInfo.Arguments = p
  297.                     process.StartInfo.UseShellExecute = False
  298.                     process.StartInfo.RedirectStandardError = True
  299.                     process.StartInfo.CreateNoWindow = True
  300.                     process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  301.                     process.StartInfo.RedirectStandardOutput = True
  302.                     process.Start()
  303.                     process.WaitForExit()
  304.                     Dim sr As StreamReader = process.StandardOutput
  305.                     Dim response1 As String = sr.ReadToEnd
  306.                     process.Close()
  307.                     lbloutput.Text = response1
  308.                 ElseIf DropDownList1.SelectedValue = 4 Then
  309.                     Dim url As String
  310.                     url = "~/HTML/" & txttitle.Text & ".html"
  311.                     Response.Redirect(url)
  312.  
  313.  
  314.                 End If
  315.  
  316.             End If
  317.         Else
  318.             If DropDownList1.SelectedValue = 1 Then
  319.                 flag = 1
  320.                 'Dim p As String
  321.                 Dim process As New Process
  322.                 process.StartInfo.WorkingDirectory = Server.MapPath("Csharp\")
  323.                 process.StartInfo.FileName = Server.MapPath("Csharp\") + txttitle.Text + ".exe"
  324.                 'p = ".exe"
  325.                 'process.StartInfo.Arguments = p
  326.                 process.StartInfo.UseShellExecute = False
  327.                 process.StartInfo.RedirectStandardError = True
  328.                 process.StartInfo.CreateNoWindow = True
  329.                 process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  330.                 process.StartInfo.RedirectStandardOutput = True
  331.                 process.Start()
  332.                 process.WaitForExit()
  333.                 Dim sr As StreamReader = process.StandardOutput
  334.                 Dim response1 As String = sr.ReadToEnd
  335.                 process.Close()
  336.                 lbloutput.Text = response1
  337.             ElseIf DropDownList1.SelectedValue = 2 Then
  338.                 flag = 1
  339.                 Dim p As String
  340.                 Dim process As New Process
  341.  
  342.                 process.StartInfo.WorkingDirectory = Server.MapPath("Vb\")
  343.                 process.StartInfo.FileName = Server.MapPath("VB\") + txttitle.Text + ".exe"
  344.                 process.StartInfo.UseShellExecute = False
  345.                 process.StartInfo.RedirectStandardError = True
  346.                 process.StartInfo.CreateNoWindow = True
  347.                 process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  348.                 process.StartInfo.RedirectStandardOutput = True
  349.                 process.Start()
  350.                 process.WaitForExit()
  351.                 Dim sr As StreamReader = process.StandardOutput
  352.                 Dim response1 As String = sr.ReadToEnd
  353.                 process.Close()
  354.                 lbloutput.Text = response1
  355.             ElseIf DropDownList1.SelectedValue = 3 Then
  356.                 flag = 1
  357.                 Dim p As String
  358.                 Dim process As New Process
  359.                 process.StartInfo.WorkingDirectory = Server.MapPath("Java\")
  360.                 process.StartInfo.FileName = "java"
  361.                 p = txttitle.Text
  362.                 process.StartInfo.Arguments = p
  363.                 process.StartInfo.UseShellExecute = False
  364.                 process.StartInfo.RedirectStandardError = True
  365.                 process.StartInfo.CreateNoWindow = True
  366.                 process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  367.                 process.StartInfo.RedirectStandardOutput = True
  368.                 process.Start()
  369.                 process.WaitForExit()
  370.                 Dim sr As StreamReader = process.StandardOutput
  371.                 Dim response1 As String = sr.ReadToEnd
  372.                 process.Close()
  373.                 lbloutput.Text = response1
  374.  
  375.             ElseIf DropDownList1.SelectedValue = 4 Then
  376.                 Dim url As String
  377.                 url = "~/HTML/" & txttitle.Text & ".html"
  378.                 Response.Redirect(url)
  379.  
  380.             End If
  381.  
  382.         End If
  383.  
  384.  
  385.     End Sub
  386. End Class
  387.  
Mar 30 '13 #3
Rabbit
12,516 Expert Mod 8TB
And which line throws the error?
Mar 30 '13 #4
neeru
17
203. process.start()
Mar 30 '13 #5
Rabbit
12,516 Expert Mod 8TB
It sounds like the path of the file doesn't exist. I would check the path that it's trying to access. Not the path that you think it's accessing, but the path it is actually trying to access.
Mar 31 '13 #6
neeru
17
wht ur r saying im not getting it coulde u plz ellaborate it.
Mar 31 '13 #7
r035198x
13,262 8TB
You had another thread with the same problem (I can't find it anymore), anyway, you are trying to execute a command on line 203 in your code. The command is setup just before those lines. Either that command doesn't exist or it expects a file that doesn't exist. We don't know what that command is since you didn't show that code that creates it.
Mar 31 '13 #8
neeru
17
this is the code



Expand|Select|Wrap|Line Numbers
  1. Imports System.Data.SqlClient
  2. Imports System.IO
  3. Imports System.IO.File
  4. Imports System.Diagnostics
  5. Partial Class new_program
  6.     Inherits System.Web.UI.Page
  7.     Dim conn As SqlConnection
  8.     Dim comm As SqlCommand
  9.     Public ds As Data.DataSet
  10.     Public da As SqlDataAdapter
  11.     Public cs As String = System.Configuration.ConfigurationSettings.AppSettings.Item("connection_string")
  12.     Public user_id As Integer
  13.     Public program_id As Integer
  14.     Public language_id As Integer
  15.     Public program_text As String
  16.     Public program_title As String
  17.     Public flag As Integer = 0
  18.  
  19.     Protected Sub btnsubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsubmit.Click
  20.         If txttitle.Text.Contains(" ") Then
  21.             lblshow.Text = "*Please remove space from Program Title"
  22.         Else
  23.             If Request.QueryString("action") = "edit" Then
  24.                 program_id = Request.QueryString("program_id")
  25.                 conn = New SqlConnection(cs)
  26.                 conn.Open()
  27.                 da = New SqlDataAdapter
  28.                 da.SelectCommand = New SqlCommand
  29.                 da.SelectCommand.Connection = conn
  30.                 da.SelectCommand.CommandText = "program_update"
  31.                 da.SelectCommand.CommandType = Data.CommandType.StoredProcedure
  32.                 da.SelectCommand.Parameters.AddWithValue("@program_id", program_id)
  33.                 da.SelectCommand.Parameters.AddWithValue("@program_title", Trim(txttitle.Text))
  34.                 da.SelectCommand.Parameters.AddWithValue("@program_text", txtcode.Text)
  35.                 da.SelectCommand.Parameters.AddWithValue("@language_id", DropDownList1.SelectedValue)
  36.                 da.SelectCommand.ExecuteNonQuery()
  37.                 Response.Redirect("manage_programs.aspx?msg=update")
  38.             Else
  39.  
  40.                 user_id = CType(Session("aid"), Integer)
  41.                 conn = New SqlConnection(cs)
  42.                 conn.Open()
  43.                 da = New SqlDataAdapter
  44.                 da.SelectCommand = New SqlCommand
  45.                 da.SelectCommand.Connection = conn
  46.                 da.SelectCommand.CommandText = "program_insert"
  47.                 da.SelectCommand.CommandType = Data.CommandType.StoredProcedure
  48.                 da.SelectCommand.Parameters.AddWithValue("@user_id", user_id)
  49.                 da.SelectCommand.Parameters.AddWithValue("@program_title", Trim(txttitle.Text))
  50.                 da.SelectCommand.Parameters.AddWithValue("@program_text", txtcode.Text)
  51.                 da.SelectCommand.Parameters.AddWithValue("@language_id", DropDownList1.SelectedValue)
  52.                 da.SelectCommand.ExecuteNonQuery()
  53.                 'ds = New Data.DataSet
  54.                 'da.Fill(ds, "faculty_insert")
  55.                 Response.Redirect("manage_programs.aspx?msg=save")
  56.  
  57.             End If
  58.         End If
  59.  
  60.     End Sub
  61.  
  62.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  63.         lblargs.Text = ""
  64.         If CheckBox1.Checked Then
  65.             txtargs.Enabled = True
  66.         Else
  67.             txtargs.Enabled = False
  68.         End If
  69.         lblshow.Text = ""
  70.         If DropDownList1.SelectedValue = 3 Then
  71.             lblshow.Text = "*Class Name of Program and Program Title Should be Same"
  72.         End If
  73.         If Request.QueryString("action") = "edit" And Me.IsPostBack = False Then
  74.             program_id = Request.QueryString("program_id")
  75.             conn = New SqlConnection(cs)
  76.             conn.Open()
  77.             da = New SqlDataAdapter
  78.             da.SelectCommand = New SqlCommand
  79.             da.SelectCommand.Connection = conn
  80.             da.SelectCommand.CommandText = "program_select"
  81.             da.SelectCommand.CommandType = Data.CommandType.StoredProcedure
  82.             da.SelectCommand.Parameters.AddWithValue("@program_id", program_id)
  83.             ds = New Data.DataSet
  84.             da.Fill(ds, "program_select")
  85.             program_title = ds.Tables("program_select").Rows(0).Item("program_title")
  86.             program_text = ds.Tables("program_select").Rows(0).Item("program_text")
  87.             language_id = ds.Tables("program_select").Rows(0).Item("language_id")
  88.             DropDownList1.SelectedValue = language_id
  89.             txttitle.Text = program_title
  90.             txtcode.Text = program_text
  91.         End If
  92.     End Sub
  93.     Function InstanceCount(ByVal StringToSearch As String, ByVal StringToFind As String) As Integer
  94.         If Len(StringToFind) Then
  95.             InstanceCount = UBound(Split(StringToSearch, StringToFind))
  96.         End If
  97.     End Function
  98.     Protected Sub btncompile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncompile.Click
  99.         If DropDownList1.SelectedValue = 1 Then
  100.             Dim fs As FileStream = Nothing
  101.             If (Not File.Exists(Server.MapPath("Csharp/" + txttitle.Text + ".cs"))) Then
  102.                 fs = File.Create(Server.MapPath("Csharp/" + txttitle.Text + ".cs"))
  103.                 Using fs
  104.                 End Using
  105.             End If
  106.             If File.Exists(Server.MapPath("Csharp/" + txttitle.Text + ".cs")) Then
  107.                 Using sw As StreamWriter = New StreamWriter(Server.MapPath("Csharp/" + txttitle.Text + ".cs"))
  108.                     sw.Write(txtcode.Text)
  109.                 End Using
  110.             End If
  111.             Dim process As New Process
  112.             process.StartInfo.WorkingDirectory = Server.MapPath("Csharp\")
  113.             process.StartInfo.FileName = "csc"
  114.             Dim p As String = txttitle.Text + ".cs"
  115.             process.StartInfo.Arguments = p
  116.             process.StartInfo.UseShellExecute = False
  117.             process.StartInfo.RedirectStandardError = True
  118.             process.StartInfo.RedirectStandardOutput = True
  119.             process.StartInfo.CreateNoWindow = True
  120.             process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  121.             process.StartInfo.RedirectStandardOutput = True
  122.             process.Start()
  123.             process.WaitForExit()
  124.             Dim sr As StreamReader = process.StandardOutput
  125.             Dim response As String = sr.ReadToEnd
  126.             process.Close()
  127.             response = response.Remove(0, 165)
  128.             If response.Trim = "" Then
  129.                 lblerror.ForeColor = Drawing.Color.Green
  130.                 lblerror.Text = "No Error Found"
  131.                 lbldesc.Text = "Success"
  132.             Else
  133.                 Dim errcnt As Integer = InstanceCount(response, txttitle.Text)
  134.                 lblerror.ForeColor = Drawing.Color.Red
  135.                 lblerror.Text = errcnt.ToString + " errors found:"
  136.                 response = response.Replace(txttitle.Text, "<br/>" + txttitle.Text)
  137.                 lbldesc.Text = response
  138.             End If
  139.         ElseIf DropDownList1.SelectedValue = 2 Then
  140.             Dim fs As FileStream = Nothing
  141.             If (Not File.Exists(Server.MapPath("VB/" + txttitle.Text + ".vb"))) Then
  142.                 fs = File.Create(Server.MapPath("VB/" + txttitle.Text + ".vb"))
  143.                 Using fs
  144.                 End Using
  145.             End If
  146.             If File.Exists(Server.MapPath("VB/" + txttitle.Text + ".vb")) Then
  147.                 Using sw As StreamWriter = New StreamWriter(Server.MapPath("VB/" + txttitle.Text + ".vb"))
  148.                     sw.Write(txtcode.Text)
  149.                 End Using
  150.             End If
  151.             Dim process As New Process
  152.             process.StartInfo.WorkingDirectory = Server.MapPath("VB\")
  153.             process.StartInfo.FileName = "vbc"
  154.             Dim p As String = Server.MapPath("VB\" + txttitle.Text + ".vb")
  155.             process.StartInfo.Arguments = p
  156.             process.StartInfo.UseShellExecute = False
  157.             process.StartInfo.RedirectStandardError = True
  158.             process.StartInfo.RedirectStandardOutput = True
  159.             process.StartInfo.CreateNoWindow = True
  160.             process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  161.             process.StartInfo.RedirectStandardOutput = True
  162.             process.Start()
  163.             process.WaitForExit()
  164.             Dim sr As StreamReader = process.StandardOutput
  165.             Dim response As String = sr.ReadToEnd
  166.             process.Close()
  167.  
  168.             If response = "" Then
  169.                 lblerror.ForeColor = Drawing.Color.Green
  170.                 lblerror.Text = "No Error Found"
  171.                 lbldesc.Text = "Success"
  172.             Else
  173.                 Dim len As Integer = response.Length
  174.                 Dim errcnt As String = response.Remove(0, len - 10)
  175.                 lblerror.ForeColor = Drawing.Color.Red
  176.                 lblerror.Text = errcnt + "found:"
  177.                 Dim a As String = response.Replace("D:\Project_2012-2013\App_suite_for_Cloud\app_suite\VB\", "* ")
  178.                 a = a.Remove(a.Length - 10, 9)
  179.                 lbldesc.Text = a.Replace("^", "<br/>")
  180.             End If
  181.         ElseIf DropDownList1.SelectedValue = 3 Then
  182.             Dim fs As FileStream = Nothing
  183.             If (Not File.Exists(Server.MapPath("Java/" + txttitle.Text + ".java"))) Then
  184.                 fs = File.Create(Server.MapPath("Java/" + txttitle.Text + ".java"))
  185.                 Using fs
  186.                 End Using
  187.             End If
  188.             If File.Exists(Server.MapPath("Java/" + txttitle.Text + ".java")) Then
  189.                 Using sw As StreamWriter = New StreamWriter(Server.MapPath("Java/" + txttitle.Text + ".java"))
  190.                     sw.Write(txtcode.Text)
  191.                 End Using
  192.             End If
  193.             Dim process As New Process
  194.             process.StartInfo.WorkingDirectory = Server.MapPath("Java\")
  195.             process.StartInfo.FileName = "javac"
  196.             Dim p As String = txttitle.Text + ".java"
  197.             process.StartInfo.Arguments = p
  198.             process.StartInfo.UseShellExecute = False
  199.             process.StartInfo.RedirectStandardError = True
  200.             process.StartInfo.CreateNoWindow = True
  201.             process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  202.             process.StartInfo.RedirectStandardOutput = True
  203.             process.Start()
  204.             process.WaitForExit()
  205.             Dim sr As StreamReader = process.StandardError
  206.             Dim response As String = sr.ReadToEnd
  207.             process.Close()
  208.             If response = "" Then
  209.                 lblerror.ForeColor = Drawing.Color.Green
  210.                 lblerror.Text = "No Error Found"
  211.                 lbldesc.Text = "Success"
  212.             Else
  213.                 Dim len As Integer = response.Length
  214.                 Dim errcnt As String = response.Remove(0, len - 10)
  215.                 lblerror.ForeColor = Drawing.Color.Red
  216.                 lblerror.Text = errcnt + "found:"
  217.                 Dim a As String = response.Replace("D:\Project_2012-2013\App_suite_for_Cloud\app_suite\Java\", "* ")
  218.                 a = a.Remove(a.Length - 10, 9)
  219.                 lbldesc.Text = a.Replace("^", "<br/>")
  220.             End If
  221.  
  222.         ElseIf DropDownList1.SelectedValue = 4 Then
  223.             Dim fs As FileStream = Nothing
  224.             If (Not File.Exists(Server.MapPath("HTML/" + txttitle.Text + ".html"))) Then
  225.                 fs = File.Create(Server.MapPath("HTML/" + txttitle.Text + ".html"))
  226.                 Using fs
  227.                 End Using
  228.             End If
  229.             If File.Exists(Server.MapPath("HTML/" + txttitle.Text + ".html")) Then
  230.                 Using sw As StreamWriter = New StreamWriter(Server.MapPath("HTML/" + txttitle.Text + ".html"))
  231.                     sw.Write(txtcode.Text)
  232.                 End Using
  233.             End If
  234.  
  235.         End If
  236.  
  237.     End Sub
  238.  
  239.  
  240.     Protected Sub btnrun_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnrun.Click
  241.  
  242.         If CheckBox1.Checked Then
  243.             If Trim(txtargs.Text) = "" Then
  244.                 lblargs.Text = "Please provide argumnets."
  245.             Else
  246.                 flag = 1
  247.                 If DropDownList1.SelectedValue = 1 Then
  248.                     flag = 1
  249.                     Dim p As String
  250.                     Dim process As New Process
  251.                     process.StartInfo.WorkingDirectory = Server.MapPath("Csharp\")
  252.                     process.StartInfo.FileName = Server.MapPath("Csharp\") + txttitle.Text + ".exe"
  253.                     p = txtargs.Text
  254.                     process.StartInfo.Arguments = p
  255.                     process.StartInfo.UseShellExecute = False
  256.                     process.StartInfo.RedirectStandardError = True
  257.                     process.StartInfo.CreateNoWindow = True
  258.                     process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  259.                     process.StartInfo.RedirectStandardOutput = True
  260.                     process.Start()
  261.                     process.WaitForExit()
  262.                     Dim sr As StreamReader = process.StandardOutput
  263.                     Dim response1 As String = sr.ReadToEnd
  264.                     process.Close()
  265.                     lbloutput.Text = response1
  266.                 ElseIf DropDownList1.SelectedValue = 2 Then
  267.                     Dim p As String
  268.                     Dim process As New Process
  269.                     process.StartInfo.WorkingDirectory = Server.MapPath("Vb\")
  270.                     process.StartInfo.FileName = Server.MapPath("VB\") + txttitle.Text + ".exe"
  271.                     p = txttitle.Text + " " + txtargs.Text
  272.                     process.StartInfo.Arguments = p
  273.                     process.StartInfo.UseShellExecute = False
  274.                     process.StartInfo.RedirectStandardError = True
  275.                     process.StartInfo.CreateNoWindow = True
  276.                     process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  277.                     process.StartInfo.RedirectStandardOutput = True
  278.                     process.Start()
  279.                     process.WaitForExit()
  280.                     Dim sr As StreamReader = process.StandardOutput
  281.                     Dim response1 As String = sr.ReadToEnd
  282.                     process.Close()
  283.                     lbloutput.Text = response1
  284.                 ElseIf DropDownList1.SelectedValue = 3 Then
  285.                     Dim p As String
  286.                     Dim process As New Process
  287.                     process.StartInfo.WorkingDirectory = Server.MapPath("Java\")
  288.                     process.StartInfo.FileName = "java"
  289.                     p = txttitle.Text + " " + txtargs.Text
  290.                     process.StartInfo.Arguments = p
  291.                     process.StartInfo.UseShellExecute = False
  292.                     process.StartInfo.RedirectStandardError = True
  293.                     process.StartInfo.CreateNoWindow = True
  294.                     process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  295.                     process.StartInfo.RedirectStandardOutput = True
  296.                     process.Start()
  297.                     process.WaitForExit()
  298.                     Dim sr As StreamReader = process.StandardOutput
  299.                     Dim response1 As String = sr.ReadToEnd
  300.                     process.Close()
  301.                     lbloutput.Text = response1
  302.                 ElseIf DropDownList1.SelectedValue = 4 Then
  303.                     Dim url As String
  304.                     url = "~/HTML/" & txttitle.Text & ".html"
  305.                     Response.Redirect(url)
  306.  
  307.  
  308.                 End If
  309.  
  310.             End If
  311.         Else
  312.             If DropDownList1.SelectedValue = 1 Then
  313.                 flag = 1
  314.                 'Dim p As String
  315.                 Dim process As New Process
  316.                 process.StartInfo.WorkingDirectory = Server.MapPath("Csharp\")
  317.                 process.StartInfo.FileName = Server.MapPath("Csharp\") + txttitle.Text + ".exe"
  318.                 'p = ".exe"
  319.                 'process.StartInfo.Arguments = p
  320.                 process.StartInfo.UseShellExecute = False
  321.                 process.StartInfo.RedirectStandardError = True
  322.                 process.StartInfo.CreateNoWindow = True
  323.                 process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  324.                 process.StartInfo.RedirectStandardOutput = True
  325.                 process.Start()
  326.                 process.WaitForExit()
  327.                 Dim sr As StreamReader = process.StandardOutput
  328.                 Dim response1 As String = sr.ReadToEnd
  329.                 process.Close()
  330.                 lbloutput.Text = response1
  331.             ElseIf DropDownList1.SelectedValue = 2 Then
  332.                 flag = 1
  333.                 Dim p As String
  334.                 Dim process As New Process
  335.  
  336.                 process.StartInfo.WorkingDirectory = Server.MapPath("Vb\")
  337.                 process.StartInfo.FileName = Server.MapPath("VB\") + txttitle.Text + ".exe"
  338.                 process.StartInfo.UseShellExecute = False
  339.                 process.StartInfo.RedirectStandardError = True
  340.                 process.StartInfo.CreateNoWindow = True
  341.                 process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  342.                 process.StartInfo.RedirectStandardOutput = True
  343.                 process.Start()
  344.                 process.WaitForExit()
  345.                 Dim sr As StreamReader = process.StandardOutput
  346.                 Dim response1 As String = sr.ReadToEnd
  347.                 process.Close()
  348.                 lbloutput.Text = response1
  349.             ElseIf DropDownList1.SelectedValue = 3 Then
  350.                 flag = 1
  351.                 Dim p As String
  352.                 Dim process As New Process
  353.                 process.StartInfo.WorkingDirectory = Server.MapPath("Java\")
  354.                 process.StartInfo.FileName = "java"
  355.                 p = txttitle.Text
  356.                 process.StartInfo.Arguments = p
  357.                 process.StartInfo.UseShellExecute = False
  358.                 process.StartInfo.RedirectStandardError = True
  359.                 process.StartInfo.CreateNoWindow = True
  360.                 process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  361.                 process.StartInfo.RedirectStandardOutput = True
  362.                 process.Start()
  363.                 process.WaitForExit()
  364.                 Dim sr As StreamReader = process.StandardOutput
  365.                 Dim response1 As String = sr.ReadToEnd
  366.                 process.Close()
  367.                 lbloutput.Text = response1
  368.  
  369.             ElseIf DropDownList1.SelectedValue = 4 Then
  370.                 Dim url As String
  371.                 url = "~/HTML/" & txttitle.Text & ".html"
  372.                 Response.Redirect(url)
  373.  
  374.             End If
  375.  
  376.         End If
  377.  
  378.  
  379.     End Sub
  380. End Class
  381.  
Mar 31 '13 #9
r035198x
13,262 8TB
From the code around lines 203 it's probably failing to compile the java source files perhaps because the java compiler javac is not there (or not on the path) or the java source files themselves are missing.
Mar 31 '13 #10
neeru
17
but i have set the path actually it's running in vs2008 and when i add this into iis7 it started to throw this error
Mar 31 '13 #11
Rabbit
12,516 Expert Mod 8TB
Are you using a relative path? If you are, there's your problem. You changed the location of the file so now the relative path points to the wrong place.
Mar 31 '13 #12
neeru
17
plzz chk it and reply asap if possible



path

Expand|Select|Wrap|Line Numbers
  1.  Dim process As New Process 
  2.  process.StartInfo.WorkingDirectory = Server.MapPath("Java\")
Apr 1 '13 #13
Rabbit
12,516 Expert Mod 8TB
Server.MapPath specifies a relative directory. If you move your file, then the path is no longer the same. Figure out what the new relative path is and specify it correctly. This is not something we can do for you because we have no idea how your directories are laid out.

An alternate option is to move the file you're trying to access into the same relative path.
Apr 1 '13 #14
neeru
17
thankx for ur suggestion it was very help full to me


my prblm is solved now
Apr 2 '13 #15
Rabbit
12,516 Expert Mod 8TB
Glad you found your solution. Goodl uck with your project.
Apr 2 '13 #16
neeru
17
thank u very much

for ur replies
Apr 2 '13 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: hangten | last post by:
Does anyone know of an alternate command to invoke an executable other than Process.Start ? I have a service that invokes an executabe. But the service has minimal privs. and I'm getting an...
2
by: mg | last post by:
c:\pdf\pdfmp3d.exe /c:\exportfiles /0 /0 /0 /0 runs correctly in the Command Prompt. But, not in the C# code behind of a WebForm: ...
3
by: Manfred Braun | last post by:
Hi All, the Process.Start method returns a boolean value to indicate, if a process was started or not. Where can I obtain more detailed error information, if the process could not be started ???...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
2
by: Jm | last post by:
Hi All Im using a windows service program written in vb.net using the system.diagnostics.process.start to open exe files but im getting few strange problems that seem to be caused by the fact...
3
by: Dean Slindee | last post by:
The code below is being used to launch WinWord.exe from a VB.NET program. Word launches, but displays this error message: "Word has experienced an error trying to open the file. Try these...
2
by: Dean Slindee | last post by:
The code below is being used to launch WinWord.exe from a VB.NET program. Word launches, but displays this error message: "Word has experienced an error trying to open the file. Try these...
4
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
I am at my witless end here, please help! I have an ASP.Net aspx web page, hosted on Windows Server 2003, that receives a query string with the path to an autocad drawing file selected from a...
1
by: stemp1ar | last post by:
I am wondering if it possible to open a single process and run multiple commands on that process and check standard error and standard out after each command? Has anyone done something similar...
3
by: Bali | last post by:
Hi I have an ASP.NET application. I am on the server side and trying to start an application which is on the server. The process gets started(can be seen in the Task Manager) but doesn't do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.