Compartir a través de


Building Swing apps with J#

This might be old news, but while my younger brother was out here interviewing he demonstrated for me on his laptop the Euchre client/server that he wrote for his CS230 “Fundamentals of Computing 3” course.  (Euchre is a card game).  The fundamental CS courses at his collage are taught in Java, which doesn't bother me.  Java is just a programming language (and one of the .NET languages supported by Microsoft, no less)   ...what pains me a bit is that being MSDN Academic Alliance members each student and faculty member is licensed to install full Visual Studio.NET, a resource which currently isn't being used because they standardized their curriculum on Java.

How cool would it be if they could keep their curriculum and switch seamlessly to Visual J#?  Unfortunately there was a snag.  My brother used Swing in his project (yes, my own brother) and J# is targeting the JDK 1.1.4.  It turns out this was a snag for a lot of academic institutions so much so that Microsoft has put together the “Supplemental UI Library for J# .NET v1.1“.  A painless 2MB download and we were in business...

Well almost.  It took me a few minutes to realize that jsc.exe is the JScript.NET compiler, not the the J# compiler (which is vjc.exe - you should have seen the compile time errors I was getting :).  Then I did have to glance briefly at the ReadMe to see you need to “/r:vjssupuilib.dll“ to bring in the supplemental UI library.  And finally, my brother used a couple of string manipulation functions which were post JDK 1.1.4 so I quickly hand rolled my own implementations of String.split() and String.replaceAll() (...and got them wrong because I didn't realize the 2nd param of String.substring in Java is the end index rather than the length, but being able to step through the code in the Visual Studio debugger made the problem immediately obvious. :)

Overall, I was impressed with how easy it was to get my brother's Java app running on the .NET Framework (like 20 minutes including the download).  Now if we only knew how to play Euchre...

Comments

  • Anonymous
    May 23, 2004
    "Seamlessly" seems like a bit of a stretch considering you had to roll your own string manipulation functions.

    Now, if .NET had something that targeted a version of Java released in the last 5 years, we'd be talking.