import java.io.*;import java.util.Scanner;public class compiler{ public static void main(String args[]) { String a; Scanner file = new Scanner(System.in); System.out.print("Enter the file name(.java): "); a = file.nextLine (); try { // Open an output stream FileOutputStream fout = new FileOutputStream (a +".cmd"); // Print a line of text new PrintStream(fout).println ("@javac "+ a +".java"); new PrintStream(fout).println ("@java "+ a); // Close our output stream fout.close(); } // Catches any error conditioddns catch (IOException e) { System.err.println ("Unable to write to file"); System.exit(-1); } }}