英文:
Why vscode is having trouble saving a java file ? Which setting should I review?
问题
在 VS Code 中,我按下 Ctrl+N,然后按下 Ctrl+Shift+S,这是“另存为”选项的快捷键。当我尝试将文件保存为 .java 文件时,它会自动保存为 class 文件。当然,如果我不使用这些快捷键尝试保存文件,也会出现这种情况,所以创建一个 java 文件的唯一方法是先创建一个 txt 文件。有人和我遇到过相同的问题吗?提前谢谢大家。
英文:
In vs code I hit Ctr+N and then Ctr+Shift+S,which is the sortcut for the 'save as' option . When I try to save a file as .java , it saved automatically as class file.Of course this also happens when I try to save the file without using the sortucts,so the only way to create a java file is after the creation of a txt file. Did anyone ever had the same problem with me ? thank you all in advance .
答案1
得分: 0
新建一个文件 -> 保存 -> 在“保存为类型”下拉列表中选择“Java”。
如果你看一下,你会发现这样:Java(*.class; *.java; *.jav; .java; .jav)。而且“.class”出现在“.java”之前,这意味着文件将以“.class”文件扩展名保存。
这是由VSCode引起的,但目前你需要在保存文件时手动更改文件扩展名。
英文:
Do you act like this?
New a file -> Save -> In the 'Save as type' drop-down list select 'Java'.
If you look at it, you will find this: Java(*.class; *.java; *.jav; .java; .jav). And the '.class' was before the '.java', this means the file will be saved with the '.class' filename extension.
It's caused by the VSCode, but for now, you need manually to change the filename extension when you save the file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论