I have made a .jar file that is supposed to run in DOS, but when i execute it (through DOS) nothing happens. How can i get it to run in DOS? If it is any help here is my code.Code:import java.io.BufferedReader; import java.io.InputStreamReader; public class Student { private static String Teacher; private static String StudentName; /** * Create a student * * @param StudentName */ public Student() { //Do nothing! } public static void main(String[] args) { Student student = new Student(); Teacher = "Mr Whyley"; StudentName = getUserInput(); //Print details System.out.println("Student Name: " + StudentName); System.out.println("Teacher: " + Teacher); } /** * Get teacher name for a student * * @return Teacher */ public String getTeacher() { return Teacher; } public static String getUserInput() { String StuName = "Unknown"; //Print the message System.out.print("What is the student name? "); //The input reader BufferedReader UsrInput = new BufferedReader(new InputStreamReader(System.in)); try { //Assign user input to the buffered reader StuName = UsrInput.readLine(); } catch(java.io.IOException Ex) { System.out.println ("An error has occured: " + Ex.getMessage()); } System.out.println(); //Blank line; //Return user input return StuName; } }




Reply With Quote