Reputation: 1
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!
Upvotes: 0
Views: 13523
Reputation: 1526
Just drag and drop the file from Eclipse file browser to desktop.
OR
Just Copy the code complete code from the .java file and then create a new text file wherever you want using file explorer and paste the contents in it and save it. Then rename it to Filename.java
Here you should turn on show file extensions from setting else I don't think you will be able to change the extension.
Then you can compile the file by :
javac Filename.java
And run by:
java MainClass
And create JAR by:
jar cfve file.jar Main Main.class
Upvotes: 1