I have the problem same as this.
I just tried to figure out how does hashmap internally works. So I want to debug the source code of SDK.
Currently. I think What I am looking for the compiled version with debug information for Java SE 1.7. i.e. compile using javac -g.
I think I am not the only guy who want to do this. So anyone who knew the link or already done this before. (Sorry for I am the lazy man.Forgive me that. ) Please kindly share the work result for me. Well appreciated. Thanks.
You do need to compile those classes with debugging yourself.
Distributing such a package would probably be a violation of Oracles License Agreement.
The post you linked has detailed instructions on how to do that.
The link in my question actually answered my question. But I just want to add missed part it didn't mention. The endorsed jar file should be joined in the installed JRE as an external jar otherwise it doesn't work. Thanks.
Related
I'm new to Java, and I am trying to import a project from GitHub into Intellij just to get the hang of it. I get an error message when I try to build the solution, and it is saying that the package "com.sun.org.apache.xpath.internal.operations" does not exist. Does anybody know whats wrong? Would really appreciate answers.
My code goes as follows:
import com.sun.org.apache.xpath.internal.operations.Bool;
I had the same problem and changed the SDK for my project from 10 to 1.8. Solved it.
For IntelliJ, go to File --> Project Structure
I know this answer is a bit late, but I have just experienced a similar issue and stumbled on this question.
The package you are referring to exists in different locations in different releases of Java. In my opinion, the simplest solution is to try to match the version of Java that was originally used to build the project that you are talking about. I say this as your project may contain other dependencies on that same version of Java, which you are not yet aware of.
In your case, I believe that running the project with Java 1.6 will solve this issue.
Is there any manual on this? I can't find any.
What are necessary packages and where is their repo, what is the project structure and build process?
UPD the ultimate goal I'm trying to achieve is to debug Eclipse on Windows
Check these links
http://wiki.eclipse.org/Development_Resources
https://wiki.eclipse.org/Eclipse_Corner#Eclipse_Platform_Technical_Overview
https://wiki.eclipse.org/Platform_UI/How_to_Contribute#Setting_up_your_SDK
http://wiki.eclipse.org/Platform
There is a new tool called oomph Try this its easy to setup development environment. Check this video
Unable to comment so posting as answer
Please check this link should get you started
http://archive.eclipse.org/eclipse/downloads/drops/R-3.1.2-200601181600/srcIncludedBuildInstructions.html
I agree with the comment from #user3159253 . Cannot really understand the need to go through this trouble. Use RPM.
I attached the src.zip that came with my JDK, but it seems to be missing a few files.
It's as if I don't have any of the sun.*; packages. I would understand if they maybe got changed out for java.awt.AppContext, but that doesn't exit.
I found AppContext in Container.java (been looking at how Oracle does things), but it shows me bytecode instead of actual code.
Where could I get these files? I looked around on google and found nothing /:
Another thing, when I manually import sun.awt, my IDE shows me that the package exists, but no files in it. Maybe I need to upgrade my JDK? (version 7u45, not too bad)
EDIT on December 30, 2014: Still looking for an answer, now using JDK 8u25
Often time the jar files that are eventually distributed out do not contain the source code of the library but only the built .class files, either aiming to reduce jar size or protect their source code. You may have to refer other resources in order to view the source code. I find www.codatlas.com to be a pretty good place to view some java open source projects. You can find the source code of java.awt.AppContext. It has a pretty IDE-like interface so you should be able to figure out how to use.
These types can be found via the OpenJDK's jdk GitHub Repository.
Here's the implementation for sun.awt.AppContext, which can be found under src > java.desktop > share > classes > sun > awt
I'm currently using Jadclipse eclipse plugin to dis-assemble the code when the source is not attached to the eclipse.
I'm not clear how to make it sync and debug the same.
Could someone help me with the steps as well as comments in detail?
Any help is much appreciated.
Thanks,
Kathir
I am not sure whether Eclipse is able to synchronously read codes decompiled by Jadclipse as debug source. I guess it probably not.
As so, I advice you manually de-compile these codes and save it to local source files, link them to source in Eclipse, after that, try using remote debug mode to debug your code. this is the way I always did.
I want to rebuild JDK1.6 after some changes in currency.java in the java.util package. so how can I do it? is there any compiler or builder to make a custom version of JDK?
I try $ javac src/java/util/currency.java but it did not work.
You should not build the whole JDK. Only thing you need is compile your class, put it into a .jar and place it in endorsed folder of a JRE.
I found these build instructions for OpenJDK 6 in the source code repository:
OpenJDK 6 Build README
UPDATE - revisiting this after a couple of years, I came across the following useful blog entry that has links to "Build README" files for a number of Java versions:
https://blogs.oracle.com/kto/entry/jdk_build_readme_collection
Lets hope it stays there, and stays current!
But yea ... if you have just changed one class, then the "endorsed directory" approach is a better idea; see #kan's answer.
Finally, it is generally a bad idea / undesirable to modify the standard class libraries to make your application work:
Your code is immediately non-portable. It will only work on your private flavor of Java.
Each time you upgrade your Java version you have to resync the sources and rebuild. (The "endorsed" approach is simpler, but you still have work to do on each Java update.)
There might be legal issues with redistribution of your modified Java. Talk to an IP lawyer ...