Java source and binaries out of sync
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Java source and binaries out of sync

  1. #1
    Join Date
    Nov 2010
    Posts
    21

    Java source and binaries out of sync

    Well, here goes ...
    I was debugging an application that uses classes such as the following:
    Graphics, Graphics2D, Plot2D, GeneralPath, ..., methods such as
    protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D)g.create();
    ...
    ...
    g2.draw(path);
    }
    When I got to paintComponent I noticed that the actual class was sun.java2D.SunGraphics2D, not Graphics2D as I'd thought, and the debugger skips over g2.draw(path) when I try to drill in to it, obviously it can't find the source. Among other things SunGraphics2D inherits from Graphics2D so clearly, my source code is out of sync with my runtimes. And when I look in the src/java/awt directory of my jdk installation which is jdk1.6.0_18, Graphics2D.java is there, but not SunGraphics2D. Can anyone tell me which source files are missing from my installation, and how to get them? If you need more info on my runtimes, please let me know.

    My directories look like this:
    Java
    -Java3D
    --1.5.2
    --j3d-1_5_2-api-docs
    --src
    -jdk1.6.0_18
    --bin
    --demo
    --include
    --jre
    --lib
    --sample
    --src
    -jre6
    --bin
    --lib

    If the above is confusing, I've attached a bitmap.

    Thanks.
    Attached Images Attached Images  

  2. #2
    Join Date
    Nov 2010
    Posts
    21

    Re: Java source and binaries out of sync

    By the way, I am running Windows XP 32-bit.

  3. #3
    Join Date
    Nov 2010
    Posts
    21

    Re: Java source and binaries out of sync

    I noticed someone else had a similar question, so I went to Sun's site as suggested to him, here's what I get:
    Source Code
    (In src.zip) Java TM programming language source files for all classes that make up the Java core API (that is, sources files for the java.*, javax.* and some org.* packages, but not for com.sun.* packages). This source code is provided for informational purposes only, to help developers learn and use the Java TM programming language. These files do not include platform-specific implementation code and cannot be used to rebuild the class libraries. To extract these file, use any common zip utility. Or, you may use the Jar utility in the JDK's bin/ directory:

    jar xvf src.zip

    HOW CAN WE GET THE CODE THAT IS USED TO BUILD THE CLASS LIBRARIES? Isn't that available?

  4. #4
    Join Date
    May 2006
    Location
    UK
    Posts
    4,474

    Re: Java source and binaries out of sync

    That is the code for the class libraries, what is doesn't include is the platform specific stuff.

    I may be wrong but I think the packages starting with sun. are from the OpenJDK project.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  5. #5
    Join Date
    Nov 2010
    Posts
    21

    Re: Java source and binaries out of sync

    I'll try src.zip again - perhaps I got the wrong one, and the com stuff isn't what I really need anyway, so I'll try again and post my results (whether or not I got SunGraphics2D), thanks.

  6. #6
    Join Date
    Nov 2010
    Posts
    21

    Re: Java source and binaries out of sync

    http://www.cse.unsw.edu.au/~cs3421/j...s/sun_faq.html

    Ok, here's the deal, I just went to a Java faqs site at the above URL, one of the faqs (A13) listed is as follows:

    A13. Where can I get the Java source code?

    JavaSoft has two separate bundles of source code that you can obtain at no charge:

    * The JDK itself contains a file called src.zip that contains the source code for the public classes in the java package. Because this does not contain sun.* classes, you cannot do a complete build of Java from these source files. These source files are for your information, to supplement the documentation, so you can see how Java works.
    * The full source code release is available from us by going to the Non-commercial Licensing Guidelines. From there, click on "Java Internal Noncommercial Use Source License", and follow the instructions. This includes sun.* and all of the files necessary to do a build of Java, for both Solaris and Windows 95/NT.

    So I will let people know if I can get the Non-commercial Licensing stuff downloaded ok. Here goes ...

  7. #7
    Join Date
    Nov 2010
    Posts
    21

    Re: Java source and binaries out of sync

    I'm not having much luck finding that non-commercial license site - perhaps Oracle reorganized something? I don't know. I can find the source code with line numbers in a giant html file at this site, but I don't want it in an html file.

    http://www.java2s.com/Open-Source/Ja...ics2D.java.htm

  8. #8
    Join Date
    Nov 2010
    Posts
    21

    Re: Java source and binaries out of sync

    A lot of the links that once went to the JDK source give source not found when I click. So things have been reorganized

    Most have three types of licenses.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center