Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How can I get input from terminal in a container? #2308

Closed
@ebenhhuang

Description

@ebenhhuang

I want to run an interactive Java program in docker and need input from a terminal. How do I do this? The Java code is here:

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String input = in.nextLine(); 
        System.out.println(input); 
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions