java - How to save a single .java file from eclipse
问题描述
I'm trying to save a single class file as a .java file from Eclipse. I've tried right clicking on the class, exporting as a JAR file and save to my desktop, but when I open it, it is just a bunch of weird symbols. How do I just export a single .java file??? Help please!
解决方案
只需将文件从 Eclipse 文件浏览器拖放到桌面即可。
或者
只需从 .java 文件中复制代码完整代码,然后使用文件资源管理器在任意位置创建一个新的文本文件,并将内容粘贴到其中并保存。然后将其重命名为 Filename.java
在这里,您应该从设置中打开显示文件扩展名,否则我认为您将无法更改扩展名。
然后您可以通过以下方式编译文件:
javac Filename.java
并运行:
java MainClass
并通过以下方式创建 JAR:
jar cfve file.jar Main Main.class
推荐阅读
- python - Django ModelForm - 有没有办法动态定义字段,但不是最后一个字段?
- corda - Corda - 显式合约升级
- reactjs - 不刷新页面删除数据
- angular - 如何将验证器和 CSS 样式传播到自定义 Angular 表单组件中的输入控件?
- objective-c - NSOutlineView 将多个项目拖放到单个 xml 文件 Finder
- c - 快速排序实现不在 C 中排序
- c# - Bit twiddling:从 ulong 中获取表示哪些字节非零的位掩码
- r - theme_minimal() 中的中心标题和副标题
- ffmpeg - ffmpeg 降低帧率
- c# - Mailkit 将垃圾数据添加到 HTML 电子邮件