按CMD运行Java文件时未找到错误文件
我在通过cmd运行file.java时遇到问题。当我运行时,出现如下错误[1]:[在此处输入图像描述][1] 谢谢你的帮助。 顺便说一句,这是我的代码按CMD运行Java文件时未找到错误文件,java,cmd,Java,Cmd,我在通过cmd运行file.java时遇到问题。当我运行时,出现如下错误[1]:[在此处输入图像描述][1] 谢谢你的帮助。 顺便说一句,这是我的代码 /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Stack s1 = new Stack(); Stack
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Stack s1 = new Stack();
Stack s2 = new Stack();
int i = 1;
while (i < 10)
{
s1.push(i);
i++;
}
}
public void KeyPress (KeyEvent undo, Stack s1, Stack s2)
{
if(undo.getKeyCode() == KeyEvent.VK_Z){
s1.pop();
int j = 1;
s2.push(j);
j++;
}
}
}您必须知道您的文件路径和类型: 桌面中的文件示例: 键入cmd:
CD C:\Users\TGDD\Desktop
javac Undo.java
运行此操作时,您必须确切知道文件路径。您的文件不在该文件夹中。就这么简单。您应该更改文件所在的文件夹,然后重试