为什么 vscode 在保存 Java 文件时出现问题?我应该检查哪个设置?

huangapple go评论68阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年8月25日 22:49:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/63581486.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定