-1

I am coding in Java on Textpad on a Windows 8. When the program runs and the user enters their input, as soon as the user enters his input, it says

Interrupted! Tool completed with exit code 130.

Have not been able to figure out the problem and need help.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class userinput {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private int rollno;
    private String name;

    public void get() throws IOException, NumberFormatException {
        System.out.print("Enter the rollno :");
        rollno = Integer.parseInt(br.readLine());
        System.out.print("Enter the name :");
        name = br.readLine();
    }

    public static void main(String args[]) {
        userinput a = new userinput();
        try {
            a.get();
        } catch (IOException e) {
            System.out.println("Invalid Entry");
        } catch (NumberFormatException f) {
            System.out.println("Invalid entry");
        }
    }
}
Tom
  • 16,842
  • 17
  • 45
  • 54
Storm
  • 1
  • Your problem doesn't seem to be related with your code, since it works fine. If possible, use a better development environment like IntelliJ, Eclipse or Netbeans or do a bit of research about correctly reading user input in Textpad, since it seems to be a bit different there. – Tom Jan 19 '16 at 13:20

2 Answers2

0

Error code 130 comes from JVM which is for ctrl+c. I believe process has been exited by it or by your IDE. Anyway you are not doing any processing on the input or you are not taking input in loop the process will exit once input has been given.

Helios
  • 851
  • 2
  • 7
  • 22
  • So basically its my textpad which has the problem? – Storm Jan 19 '16 at 14:21
  • @Storm Depends on what happens. Then you can enter two values and then get the above message, then everything is fine, since you're not doing more than requesting user input two times. – Tom Jan 19 '16 at 14:37
  • @Tom So then what should I basically do? – Storm Jan 20 '16 at 11:26
  • I am using JDK and JRE – Storm Jan 20 '16 at 11:28
  • @Storm First you can show us an example input and when the program terminates. If it terminates _after_ both inputs, then this is not a problem with Textpad, since it is supposed to do that. If it terminates after the first input, then also try another IDE like IntelliJ, Eclipse or Netbeans. – Tom Jan 20 '16 at 11:33
  • @Storm basically you can put a `sysout` statement to print the number you have given as input. If it print there is no issue, if it doesn't then definitely some issue is there. – Helios Jan 21 '16 at 05:52
-1

The way to fix this is to go into Textpad. Once you're in Textpad, go into configure, then preferences, then tools, and go to your java.exe. Java.exe is what runs your program after compilation. Once you click on your java.exe, make sure that you don't have capture output selected. Also, make sure that you don't have "close DOS window on exit" on, if you want to see the output on the DOS window.How to get to preferences.How to get to tools from preferences.What to change once in tools and you've clicked on your java.exe

Community
  • 1
  • 1
  • Can you reformat your answer to improve the readability as it is quite hard to read right now? – Woodz Oct 09 '20 at 02:55