该系统找不到指定的文件。在Java中[编写测试时出错] [英] The system cannot find the file specified. In java [error while writing test]

查看:147
本文介绍了该系统找不到指定的文件。在Java中[编写测试时出错]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行Java文件 test.java 时,发生以下错误:

When I execute my java file test.java, the following error occurs:

C:\Users\name\Desktop>javac test.java
test.java:1: error: error while writing test: test.class (The system cannot find the file specified)

class test{
^
1 error

看看代码

class test{
public static void main(String[] Args){
  System.out.println("Hello ");
 }
}


推荐答案

I找到了解决方案。尚无法理解其背后的行为,但可以更改目录,即通过将文件从桌面移动到正在编译的D驱动器来进行。

I found the solution. The behavior behind it has not been understood but on changing the directory, i.e, by moving my file from desktop to D drive it's compiling.


这是我的桌面和我放置文件
的目录的屏幕截图图片

这是程序成功编译后的屏幕截图< a href = https://i.stack.imgur.com/6hfCI.png rel = nofollow noreferrer>图片

This is the screenshot of program on successful compilation image

这篇关于该系统找不到指定的文件。在Java中[编写测试时出错]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆