Note that there are some explanatory texts on larger screens.

plurals
  1. POSubstitutes for unix shell commands for windows?
    primarykey
    data
    text
    <p>I am developing a source code judging software.I have developed it on Linux platfrom UBuntu 12.04 LTS.</p> <p>Now i want to deploy it on Windows. I my software i am creating the commands as per the unix shell,saving them in a file and then executing the commands through file. Here is a part of the code:</p> <pre><code>package codejudge.compiler.languages; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import codejudge.compiler.TimedShell; public class C extends Language { String file, contents, dir; int timeout; public C(String file, int timeout, String contents, String dir) { this.file = file; this.timeout = timeout; this.contents = contents; this.dir = dir; } public void compile() { try { BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dir + "/" + file))); out.write(contents); out.close(); // create the compiler script out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dir + "/compile.sh"))); out.write("cd \"" + dir +"\"\n"); out.write("gcc -lm " + file + " 2&gt; err.txt"); out.close(); Runtime r = Runtime.getRuntime(); Process p = r.exec( dir + "/compile.sh"); p.waitFor(); p = r.exec(dir + "/compile.sh"); // execute the compiler script TimedShell shell = new TimedShell(this, p, timeout); shell.start(); p.waitFor(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } public void execute() { try { // create the execution script BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dir + "/run.sh"))); out.write("cd \"" + dir +"\"\n"); out.write("./a.out &lt; in.txt &gt; out.txt"); out.close(); Runtime r = Runtime.getRuntime(); Process p = r.exec(dir + "/run.sh"); p.waitFor(); p = r.exec(dir + "/run.sh"); // execute the script TimedShell shell = new TimedShell(this, p, 3000); shell.start(); p.waitFor(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } } </code></pre> <p>When i am running the same code on windows i am getting the following erros( ihave minGW installed on windows):</p> <pre><code>Codejudge compilation server running ... Compiling garima.c... java.io.IOException: Cannot run program "C:\xampp\htdocs\project\codejudge-compiler\stage\1/compile.sh": CreateProcess error=193, %1 is not a valid Win32 application at java.lang.ProcessBuilder.start(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at codejudge.compiler.languages.C.compile(C.java:41) at codejudge.compiler.RequestThread.run(RequestThread.java:65) Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.&lt;init&gt;(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 6 more java.io.FileNotFoundException: C:\xampp\htdocs\project\codejudge-compiler\stage\1\err.txt (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at codejudge.compiler.RequestThread.compileErrors(RequestThread.java:90) at codejudge.compiler.RequestThread.run(RequestThread.java:66) java.io.IOException: Cannot run program "C:\xampp\htdocs\project\codejudge-compiler\stage\1/run.sh": CreateProcess error=193, %1 is not a valid Win32 application at java.lang.ProcessBuilder.start(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at codejudge.compiler.languages.C.execute(C.java:65) at codejudge.compiler.RequestThread.run(RequestThread.java:72) Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.&lt;init&gt;(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 6 more java.io.FileNotFoundException: C:\xampp\htdocs\project\codejudge-compiler\stage\1\out.txt (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at codejudge.compiler.RequestThread.execMsg(RequestThread.java:106) at codejudge.compiler.RequestThread.run(RequestThread.java:77) </code></pre> <p>I have very little knowledge of win32 shell commands..what changes are required to be made to the code ie. which commands should be changed which do not run on windows? And what are their substittes for windows?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload