This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Editing compiled Java files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Editing compiled Java files" Watch "Editing compiled Java files" New topic
Author

Editing compiled Java files

Cody Lee
Greenhorn

Joined: Jun 18, 2010
Posts: 2
This might sound stupid, but I do not know how to edit files after I have compiled them into a Java file. Help please?
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
Java files are compiled into class files. As far as I know, the only thing you can compile into Java files are JSP files. Can you elaborate your question?
Thomas Young
Greenhorn

Joined: Jul 17, 2008
Posts: 29
Hi Cody,
Welcome to the Java Ranch.

When you compile, you are turning the source code into a bytecode class file.

You would have started with a file with a .java extension, this is your source code.

After you have compiled a source code file, you will be left with two files: a compiled class file (.class) and the original source code (.java) that you used to create the class.

It would be much easier for you to modify the source code and then recompile the source code, than to modify the executable.

If you wanted to modify the executable, the compiled class file would need to be decompiled if you needed to edit it. There are tools available do this. Try Goolgeling "Java Decompilers". But I would strongly recommend that you go with modifying the original source.

Regards,
TY.
Cody Lee
Greenhorn

Joined: Jun 18, 2010
Posts: 2
ok thank you
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
EDIT: This was a response to your response that you edited, so really doesn't make sense anymore

Do you mean the error is displayed when you double click on the java file? If so, this is a problem with the configuration on your Wndows box. You haven't associated files with the .java extension with an application that will load it. Pick Notepad (or your favorite text editor) and you'll be able to open the file.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3826

Tom Reilly wrote:... As far as I know, the only thing you can compile into Java files are JSP files ...

It's a translation. Putting the things in the right place(s) from the JSP in a file which to become a Java source file to be compiled.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
 
subject: Editing compiled Java files