小编Spu*_*pud的帖子

无法运行程序"..."错误= 2,没有这样的文件或目录(java)

我正在尝试创建一个java程序,它将在我的macbook上为我设置SSH连接.它提示我输入用户名,然后是IP地址,然后它应该是"ssh username @ ip".

以下是我的代码:

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class SSH {
    public static void main(String[] args) throws Exception {
    boolean rep = true;
    String username = (null);
    String IPAdress = (null);
    while (rep) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Username:  ");
        username = scanner.next();
        System.out.print("\nIP Adress:  ");
        IPAdress = scanner.next();
        System.out.println("\n\nIs this correct?\nUsername:  " + username + "\nIP Adress:  " + IPAdress + "\nY/N");
        char responce = scanner.next().charAt(0);

        if (responce == 'Y' || responce == 'y') …
Run Code Online (Sandbox Code Playgroud)

java macos ssh

5
推荐指数
1
解决办法
3万
查看次数

标签 统计

java ×1

macos ×1

ssh ×1