0
我正在为其中一个类的项目工作。而这个程序本身并不是问题,而是它将被测试的方式。我没有使用命令行的经验,这就是我的程序将如何测试。从命令行编译并运行java
我创建了一个小山密码程序。输入是一个密钥文件和一个纯文本文件。 命令行条目将如下所示。
prompt> java hillcipher spr16Key4.txt hill-16spring-01
我该怎么做?我可以修改此代码,以便它可以使用上述命令吗?
try{
//open plaintext file
URL url = getClass().getResource("input.txt"); //.getResource(args[0]);?
File file = new File(url.getPath());
//used to move data on the encryption path
sc = new Scanner(file);
}catch(Exception e){
System.out.println("file not found.");
}