|
Replies:
2
-
Last Post:
Apr 4, 2005 5:55 PM
by: dmouse
|
|
|
|
|
|
|
Building Swing without building the whole JDK using ANT.
Posted:
Mar 14, 2005 4:09 PM
|
|
|
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.
<project name="Swing Partial Build" default="all" basedir=".">
<!-- properties for build -->
<property name="src" value="../../../src/share/classes:../../../src/windows/classes:../../../src/solaris/classes"/>
<property name="build" value="../../../build/classes"/>
<property name="bootclasspath" value="c:/jdk1.6b27/jre/lib/rt.jar"/>
<property name="debug" value="off"/>
<property name="verbose" value="off"/>
<target name="all" depends="init,swing">
</target>
<target name="init">
<mkdir dir="${build}"/>
</target>
<target name="copyResources" depends="init">
<copy todir="${build}">
<fileset dir=".">
<include name="**/*.gif"/>
<include name="**/*.png"/>
</fileset>
</copy>
</target>
<target name="swing" depends="copyResources">
<echo message="${ant.project.name}"/>
<echo message="verbose = ${verbose}"/>
<echo message="debug = ${debug}"/>
<javac destdir="${build}" verbose="${verbose}"
debug="${debug}" source="1.5" memoryInitialSize="80m"
memoryMaximumSize="256m" fork="true">
<src path="${src}"/>
<include name="javax/swing/**"/>
<include name="com/sun/java/swing/**"/>
<include name="com/sun/swing/**"/>
<include name="sun/swing/**"/>
</javac>
</target>
<target name="clean">
<delete dir="${build}"/>
</target>
</project>
Make sure to save the above snippet to a file called build.xml and copy it to the j2se/make/javax/swing directory.
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.
Regards, Bino.
|
|
|
|
|
|
|
Re: Building Swing without building the whole JDK using ANT.
Posted:
Mar 15, 2005 10:13 AM
in response to: bino_george
|
|
|
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 :
<target name = "run" depends = "swing" description = "Run SwingSet2">
<java classname="SwingSet2" fork="true" jvm="c:/jdk1.6b27/bin/java.exe"
dir="c:/jdk1.6b27/demo/jfc/SwingSet2">
<bootclasspath path ="c:/code/mustang/b27/j2se/build/classes;c:/jdk1.6b27/jre/lib/rt.jar"/>
<classpath>
<fileset dir="c:/jdk1.6b27/demo/jfc/SwingSet2">
<include name="**/*.jar"/>
</fileset>
</classpath>
</java>
</target>
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.
Regards, Bino.
|
|
|
|
|
|
|
|
Re: Building Swing without building the whole JDK using ANT.
Posted:
Apr 4, 2005 5:55 PM
in response to: bino_george
|
|
|
Bino,
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.
|
|
|
|
|