Skip to main content

Building Swing without building the whole JDK using ANT.

2 replies [Last post]
Joined: 2003-06-16

Hi Folks,
Those of you who are dying to fix your
favorite Swing bug, might have been a bit put off by
the complexity of the full JDK build. For those people
who just want to build swing and be able to play around
with Swing code changes, you might consider using the
following ant file to build just swing. This way, you
dont need the native compilers or any tool other than
ant and the binary and source snapshots.


Make sure to save the above snippet to a file called build.xml and copy it to the j2se/make/javax/swing

To use it, you need to get the binary snapshot associated
with the source you are building. Then you need to
point the bootclasspath in the property section of
the build.xml to point to the rt.jar in that
binary image. Then you need to run ant in
the j2se/make/javax/swing directory. This will build
just the swing (and some other dependancies like awt).
The output will be in j2se/build/classes.

To run using the built classes, simply specify the
bootclasspath to use the newly built classes :

C:\jdk1.6b27\demo\jfc\SwingSet2>c:\jdk1.6b27\bin\java -Xbootclasspath/p:c:/code/mustang/b27/j2se/build/classes -jar SwingSet2.jar

Let me know how this goes. We are looking
forward to your contributions.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-09


This doesn't build the .properties files in the workspace. I wrote a Swing/AWT ant build file a while ago with a task for doing this. Ask Scott or Jeff and they can point you to where it is.

Joined: 2003-06-16

Hi Folks,

Once you get the build working from command
line, you can just as well run it from Netbeans by creating
a Netbeans project by selecting "Java Project with Existing sources" option. You need to set the source
path to "j2se\src\share\classes" and the source level to 1.5. This way you get all the benefits of developing
inside an IDE.

Then you can add the following run target to run SwingSet.
Make sure you adjust the paths according to your setup :




To have Netbeans run this target automatically, you can
associate this target with the run action in the Project
settings dialog. Remember dont forget to adjust the
paths in the above target.

Let me know if you have any questions.