PHP compiles Java source files and redirects output Java training Java face question Java3

Source: Internet
Author: User
Tags php compiler
Compile process: You must enter the full path of the Java file exec ("Javac D:\\test.java"),//run and redirect the output, here must be set classpath, and then redirect the path also if the full path $res = EXEC ("Set Classpath=d:\\&java Test < D:\\in.txt > d:\\out.txt ", $out, $status);//print out the status value, if 0 indicates success, 1 indicates failure Var_dump ($ status);//If not redirected, RES will use an array to hold the output of//system.out.println () Print_r ($res);

Test.java source files are as follows:

Import java.util.*;p ublic class test{public static void Main (string[] args) {System.out.println ("java php"); Scanner in = new Scanner (system.in), for (int i = 0; i <; i++) {int n = in.nextint (); SYSTEM.OUT.PRINTLN (n);}}

The above describes the PHP compiler to execute Java source files and redirect the output, including Java, source file aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.