<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Infernus &#187; Java</title>
	<atom:link href="http://infernus.org/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://infernus.org</link>
	<description>Don&#039;t feel you have to take any notice of me, please.</description>
	<lastBuildDate>Sat, 17 Sep 2011 19:57:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Building Java 7 on Mac OS X</title>
		<link>http://infernus.org/2009/02/building-java-7-on-mac-os-x/</link>
		<comments>http://infernus.org/2009/02/building-java-7-on-mac-os-x/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 22:11:13 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://infernus.org/2009/02/building-java-7-on-mac-os-x/</guid>
		<description><![CDATA[Update 26/5/9: Updated for last night&#8217;s source with the JIBX libraries, and note on the version of XCode. So, I&#8217;ve just got my laptop back after a brief separation. What does one do? Compile the JDK, of course! For those unfamiliar with the situation, Apple hate Java developers. Well, one suspects they do. Apple being [...]]]></description>
			<content:encoded><![CDATA[<p><b>Update 26/5/9:</b> Updated for last night&#8217;s source with the JIBX libraries, and note on the version of XCode.</p>
<p>So, I&#8217;ve just got my laptop back after a brief separation. What does one do?</p>
<p>Compile the JDK, of course!</p>
<p>For those unfamiliar with the situation, Apple hate Java developers. Well, one suspects they do. Apple being Apple, one never knows. We could get Java 1.6.0_12 with 32bit support tomorrow, or it could never come. You&#8217;ll never know until it appears.</p>
<p>Luckily, <a href="http://landonf.bikemonkey.org/">Landon Fuller</a> loves us. Which Apple play with their iPhones, he beat the OpenJDK into submission on OS X. Only drawback &#8211; Swing is X11 based. But still, it&#8217;s JDK6 for 10.4, 10.5 and in both 32 and 64bit, and available as <a href="http://landonf.bikemonkey.org/static/soylatte/">SoyLatte</a>.</p>
<p>This work has all found its way back into the trunk, and so JDK7 is buildable on the Mac (usually). The only catch: the instructions are scattered, and often vary slightly. So I&#8217;m documenting them here for tonight&#8217;s build, mostly for my reference.</p>
<p>Thanks go to Landon Fuller and <a href="http://mail.openjdk.java.net/pipermail/bsd-port-dev/2009-January/000499.html">Stephen Bannasch</a> for putting these together.</p>
<p>1. Get version 3.1 (or above, presumably) of XCode.</p>
<p>2. Download <a href="http://landonf.bikemonkey.org/static/soylatte/">SoyLatte</a>. I found the JDK7 build Landon released in 2008 did not work as a bootstrap.</p>
<p>3. Get Mercurial</p>
<pre>sudo port install mercurial +bash_completion</pre>
<p>4. Install the Forest extension</p>
<pre>hg clone http://bitbucket.org/pmezard/hgforest-crew</pre>
<p>You&#8217;ll need to point Mercurial at the hgforest-crew directory, by adding the following to ~/.hgrc:</p>
<pre>[extensions]
hgext.forest=/opt/hgforest-crew/forest.py</pre>
<p>5. Grab Kurt Miller&#8217;s BSD binary plugs:</p>
<pre>wget http://www.intricatesoftware.com/distfiles/jdk-7-icedtea-plugs-1.6b.tar.gz</pre>
<p>6. Get the JIBX libraries (version 1.1.5) from:</p>
<pre>http://sourceforge.net/project/showfiles.php?group_id=69358&#038;package_id=68290</pre>
<p>7. Check out the OpenJDK:</p>
<pre>hg fclone http://hg.openjdk.java.net/bsd-port/bsd-port</pre>
<p>8. Place the following in build.sh in the bsd-port directory (modify as appropriate, depending on where you placed downloaded items):</p>
<pre>LC_ALL=C
LANG=C
unset CLASSPATH
unset JAVA_HOME
make \
  ALT_BOOTDIR=/opt/soylatte16-i386-1.0.3/ \
  ALT_BINARY_PLUGS_PATH=/opt/jdk-7-icedtea-plugs \
  ALT_FREETYPE_HEADERS_PATH=/usr/X11R6/include \
  ALT_FREETYPE_LIB_PATH=/usr/X11R6/lib \
  ALT_JIBX_LIBS_PATH=/opt/jibx/lib \
  ALT_CUPS_HEADERS_PATH=/usr/include \
  ANT_HOME=/usr/share/ant \
  NO_DOCS=true \
  HOTSPOT_BUILD_JOBS=2</pre>
<p>9. Run, and cross your fingers!</p>
<p>10. I ran into a ld error (archive has no table of contents). Should you hit this, try the following and then rerun build.sh:</p>
<pre>ranlib build/bsd-i586/tmp/java/fdlibm/obj/*.a</pre>
<p>11. Copy bsd-port/build/bsd-i586/j2sdk-image somewhere useful &#8211; and you&#8217;re done!</p>
]]></content:encoded>
			<wfw:commentRss>http://infernus.org/2009/02/building-java-7-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Checking the EDT with aspects</title>
		<link>http://infernus.org/2009/02/checking-the-edt-with-aspects/</link>
		<comments>http://infernus.org/2009/02/checking-the-edt-with-aspects/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 17:27:14 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Aspects]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://infernus.org/wordpress/?p=5</guid>
		<description><![CDATA[I am unreasonably fond of Swing. While it has plenty of foibles, and brings a new horror to UIs with Metal, it&#8217;s nevertheless quite a nice framework to use &#8211; once you&#8217;re familiar with it. The problem is that getting familiar is a path strewn with brambles and holes full on punji sticks. One of [...]]]></description>
			<content:encoded><![CDATA[<p>I am unreasonably fond of Swing. While it has plenty of foibles, and brings a new horror to UIs with Metal, it&#8217;s nevertheless quite a nice framework to use &#8211; once you&#8217;re familiar with it.</p>
<p>The problem is that getting familiar is a path strewn with brambles and holes full on punji sticks. One of the bigger holes is the event dispatch thread (EDT) &#8211; everything Swing related should take place on the EDT (even initialisation, under the latest Sun guidelines). When you&#8217;re trying to keep the UI fluid it&#8217;s all too easy to break the rule &#8211; hence, aspects to the rescue!</p>
<p>This topic has been covered by many before, including <a href="http://weblogs.java.net/blog/alexfromsun/archive/2006/02/debugging_swing.html">Alexander Potochkin</a> and <a href="http://thejavacodemonkey.blogspot.com/2007/08/using-aspectj-to-detect-violations-of.html">Anders Prisak</a> &#8211; however, I found their solution needed a little tweaking to be used in our environment. In particular, they had missed two cases we cover &#8211; SwingUtilities and SwingWorker.</p>
<p>So, here&#8217;s the tweaked aspect. safeMethods now includes a few extras.</p>
<pre>package org.infernus.swing.aspects;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

import java.awt.*;

@Aspect
public class EDTCheck {

    @Pointcut("call (* javax.swing..*+.*(..)) || "
            + "call (javax.swing..*+.new(..))")
    public void swingMethods() {
    }

    @Pointcut("call (* javax.swing..*+.add*Listener(..)) || "
            + "call (* javax.swing..*+.remove*Listener(..)) || "
            + "call (* javax.swing..*+.getListeners(..)) || "
            + "call (* javax.swing..*+.revalidate()) || "
            + "call (* javax.swing..*+.invalidate()) || "
            + "call (* javax.swing..*+.repaint()) || "
            + "target (javax.swing.SwingWorker+) || "
            + "call (* javax.swing.SwingUtilities+.invoke*(..)) || "
            + "call (* javax.swing.SwingUtilities+.isEventDispatchThread()) || "
            + "call (void javax.swing.JComponent+.setText(java.lang.String))")
    public void safeMethods() {
    }

    @Before("swingMethods() &amp;&amp; !safeMethods() &amp;&amp; !within(EDTCheck)")
    public void checkCallingThread(final JoinPoint.StaticPart thisJoinPointStatic) {
        if (!EventQueue.isDispatchThread()) {
            System.err.println("Swing EDT violation: " + thisJoinPointStatic.getSignature()
                    + " (" + thisJoinPointStatic.getSourceLocation() + ")");
            Thread.dumpStack();
        }
    }
}</pre>
<p>Once it&#8217;s built, we just need to weave it &#8211; I&#8217;ve already got compile-time weaving configured for <a href="http://infernus.org/node/269">Spring @Configurable support</a>, so just add the JAR containing the aspect as a weaveDependency and then the magic happens.</p>
<p>Now, if a Swing call is made off of the EDT, you&#8217;ll get complaints:</p>
<pre>Swing EDT violation: String javax.swing.JTextArea.getText() (YourSwingClass.java:98)
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Thread.java:1224)
        at org.infernus.swing.aspects.EDTCheck.checkCallingThread(EDTCheck.java:55)
     ... and so on</pre>
]]></content:encoded>
			<wfw:commentRss>http://infernus.org/2009/02/checking-the-edt-with-aspects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: infernus.org @ 2012-02-09 03:54:17 -->
