-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheditorcompile.jsp
More file actions
53 lines (49 loc) · 1.72 KB
/
Copy patheditorcompile.jsp
File metadata and controls
53 lines (49 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<%@page import="java.io.InputStreamReader"%>
<%@page import="java.sql.*"%>
<%@ include file="common/connection.jsp" %>
<html>
<body>
<%
session=request.getSession(false);
String name=(String)session.getAttribute("userid");
String filename1;
int x2=name.indexOf(" ");
String fileName=request.getParameter("filename");
String st=" ";
char quotes='"';
String qotes=String.valueOf(quotes);
try
{
String uploadPath = getServletContext().getRealPath("/").replace("\\", "/");
if(!uploadPath.endsWith("/"))
uploadPath = uploadPath+"/";
uploadPath = uploadPath+"files/"+name+"/";
String filePath=uploadPath+fileName;
filename1=qotes+ filePath+qotes;
Process pro=Runtime.getRuntime().exec("javac "+filename1);
//out.println(f.getAbsolutePath());
InputStreamReader isr=new InputStreamReader(pro.getErrorStream());
char [] x=new char[100];
while(isr.read(x)>=0)
{
st +="\n"+String.copyValueOf(x,0,100)+"\n";
x=new char[100];
}
isr.close();
request.setAttribute("compile",st);
//out.println(filename1+fileName);
if(st.compareTo(" ")==0)
{
Statement stmt=con.createStatement();
stmt.executeUpdate("update compiledfiles set satus='1' where file_name='"+fileName+"' ");
}
request.setAttribute("action", "compile");
request.getRequestDispatcher("Editor.jsp").forward(request, response);
// out.print(st);
}catch(Exception e)
{
out.println(e.getMessage());
}
%>
</body>
</html>