Accepting a positive integer from either a command-line argument or System.in
user_input can be better renamed as userInput.

If you want to make the prompting 'self-contained', put it inside a method that will re-prompt the user for non-integer values:

private static int getIntegerInput(Scanner scanner) { ... }


I also don't think you need to catch ArrayIndexOutOfBoundsException, instead consider picking up from the command line only if args.length is at least 1:

// calls getIntegerInput(Scanner) with scanner if input is not an integer
private static int parseStringOrPrompt(String input, Scanner scanner) { ... }


Putting it altogether:

public static void main(String[] args) {
    try (Scanner scanner = new Scanner(System.in)) {
        int num = args.length &gt; 0 ? parseStringOrPrompt(args[0], scanner) 
                                    : getIntegerInput(scanner);
        while (num &lt; 0) {
            System.out.print("That's a negative integer.");
            num = getIntegerInput(scanner);
        }
        System.out.println("Yes, '" + num + "' is a positive integer.");
    }
}