Skip to main content



      Home
Home » Newcomers » Newcomers » Edit class file from jar(source attachment does not contain the source ERROR)
Edit class file from jar [message #881798] Tue, 05 June 2012 05:18 Go to next message
Eclipse UserFriend
HI Guys,
I'm DB developer with basic Java skills (2years during college - not so long ago).
I've got jar file use to manipulate MySQL conversion (but that's not so important)
What I want to do is to edit some of the class content within this jar - very minor changes.
When I add this jar to project -> right click on project folder -> Build Path -> Configure Build patch -> Add External jar , all goes well so far and I've got this jar as Ref Lib
But When I double click to any of the added file I get this: 1.png
index.php/fa/10079/0/

After googling I found that scr.jar needs to be added so I did that but still no luck : 2.png
index.php/fa/10080/0/

What I've notice strange is that some of my JRE system libraries also opens with the same error:3.png
index.php/fa/10081/0/
When I click button 'Change Attached source' the PAth to scr.jar is already there.
Some other classes files in sys lib open with no problem.

At this point I was thinking that I'm doing something very wrong and this should be done differently so I try to unzip the classes to have them in NT folder and try to go File -> Open File (and choose one of the unziped from jar class file)
BUT when I do then I got an error like this:4png
index.php/fa/10082/0/

So what am I doing wrong ? Can modification in class files within jar be that hard ?
Or Eclipse louse balance between ability do perform complicated tasks and ability to perform basic tasks ? Or Eclipse never has been tool to basic tasks ?

Any help much appreciated.
  • Attachment: 1.png
    (Size: 138.11KB, Downloaded 12950 times)
  • Attachment: 2.png
    (Size: 131.23KB, Downloaded 12853 times)
  • Attachment: 3.png
    (Size: 515.99KB, Downloaded 12722 times)
  • Attachment: 4.png
    (Size: 97.76KB, Downloaded 12808 times)
Re: Edit class file from jar [message #882058 is a reply to message #881798] Tue, 05 June 2012 14:23 Go to previous messageGo to next message
Eclipse UserFriend
Class files are compiled entities. You can't just edit them. You need to get the actual source used to compile the class files. The source has to match the class file. This is why you had problems attaching the jdk source to a non jdk jar. Oracle only releases source for the java.* packages. They don't release the source for the com.sun* packages.

You need to spend some time learning the difference between a .class file and a .java file.
Re: Edit class file from jar [message #882098 is a reply to message #882058] Tue, 05 June 2012 17:03 Go to previous messageGo to next message
Eclipse UserFriend
David,

OK, fair enough. But why I am able to add these class files and then after double click that strange error appear instead of telling me that I cant edit or change class file ?
According to your answer shouldn't it says that I need to have .java file ? Error I've described doesn't say much .... and doesn't tells me that I need to have .java file...

Regards
Evo
Re: Edit class file from jar [message #882181 is a reply to message #882098] Tue, 05 June 2012 21:47 Go to previous message
Eclipse UserFriend
On 06/05/2012 04:03 PM, Evo Nevo wrote:
> David,
> OK, fair enough. But why I am able to add these class files and then
> after double click that strange error appear instead of telling me that
> I cant edit or change class file ?
> According to your answer shouldn't it says that I need to have .java
> file ? Error I've described doesn't say much .... and doesn't tells me
> that I need to have .java file...
> Regards
> Evo
It tells you that you need to attach source to the jar file. Java
source files end in .java so it should be obvious that you need to .java
files.
Previous Topic:No way I can get SWT to work.
Next Topic:Unable to install Eclipse classic 3.7.2
Goto Forum:
  


Current Time: Wed Nov 05 14:13:58 EST 2025

Powered by FUDForum. Page generated in 0.09154 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top