« May 2008
SunMonTueWedThuFriSat
    
1
2
3
4
5
6
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
       
Today
XML

Blog::Navigation

GetJava Download Button
Get the Source
Personal Blog

Blog::Referers

Today's Page Hits: 788

Powered by Roller Weblogger.
All | Books | cricket | education | General | Java | Music
Main | Next page »
20080509 Friday May 09, 2008

Thursday May 8, JavaOne

Here are the few highlights from the talks that I attended today:

TS-5428 Java Technology Meets the Real World: Intelligence Everywhere.

This talk is about pervasive computing (a.k.a ubiquitous computing) with products from Sentilla. There was an interesting demo about humidity sensor detecting changes and sending a message to a host. The "motes" run CLDC 1.1 VM (+ proprietary profile for motes). These motes have ports for sensors and actuators and some built-in sensor. There were many interesting suggestions for embedded programming for such small devices (don't allocate in inner loops and there by leading to to GC kick-in, avoid too many static fields, avoid threads whenever possible and so on).

TS-7575 Using Java Technology-Based Class Loaders to design and implementing a Java platform, Micro Edition

The basic idea is to run JavaME applications (developed for different configurations/profiles/subsets of optional packages) on top of JavaSE. The extended JavaSE classes and packages not available in specific profile or optional package set [implemented by a specific phone] should not be made available to JavaME apps targeted. i.e., only the classes available to a specific phone model should be available. If the JavaME app tries to access any other class, it should receive ClassNotFoundException. The speakers explained how to achieve such "containers" by class loader based isolation. The problem is that they seem to solve only the class access. What about extended methods and fields? For example, platform core classes on JavaSE have superset of methods [more methods on the same class available on JavaME - eg. java.util.Hashtable has more methods on JavaSE). The application classes have to bytecode analyzed and instrumented to take care of field/method accces. It seems that their current product that does not address this yet.

PAN-5542 Developing Semantic Web Applications on the Java Platform.

The discussion started with some nice demos. There was a demo with AllegroGraph RDF store, Twine, a demo with using GRDDL and getting RDF triples by a proxy server. i.e., a proxy serves does the GRDDL transformations to get RDF triples from sites [which could be stored/analyzed with RDF stores subsequently] and a demo with FOAF files. Interesting take aways from the discussion include:

  • We don't have to wait for SEMANTIC WEB with full fledged reasoners and so on. Instead, add little semantic bits to existing web (say using RDFa, GRDDL etc.) in your current web projects/pages.
  • There are many Java tools. There is need to standard Java APIs for triple store access etc. Right now, we have to write for Jena, Sesame etc. It was also felt that APIs will need to wait for more usage scenarios.
  • There are tools to expose your existing databases as virtual RDF stores -- for example: D2RQ. Probably, most of the RDF triples could come from existing data.
  • Privacy, security of the information is very important. Work needs to be done in this area.
  • Natural language processing and getting triples out of it is very hard. You may want to refer to systems like DBpedia.



( May 09 2008, 08:56:14 PM IST ) Permalink Comments [0] del.icio.us | furl | simpy | slashdot | technorati | digg

20080508 Thursday May 08, 2008

Wednesday May 7, JavaOne

Today Bill, Chihiro, Jaya and I talked on Blu-ray. The talk was centered around the open source project @ http://hdcookbook.dev.java.net - a library and a set of tools to build Blu-ray discs. If you haven't checked out code/docs, you may want to checkout and play with the code. All you need is a laptop with blu-ray drive and a BD-RE disc. Optionally, for added fun you may want to have a hardware bluray player such as PS3 -- so that you can see the output on your TV rather than on a laptop. Other than the session, we also had a very informal BOF on blu-ray, OCAP etc. during the evening. It is good to meet experts in respective technologies in one place!

Other than the the blu-ray stuff, I did attend other talks/BOF. Just after Blu-ray session, I attended "TS-6000 Improving Application Performance with Monitoring and Profiling Tools" talk. This talk was about OS specific tools, JDK tools and third-party tools for profiling and monitoring. Gregg Sporar and Jaroslav Bachorik (NetBeans Profiler team) presented very well. There were many interesting questions/discussions as well. If you haven't done so already, you may want to download VisualVM. If you want bit more fun doing monitoring/profiling, you may want to check out the sources from http://visualvm.dev.java.net and build it yourself. You can build BTrace VisualVM plugin using the command:


    c:\visualvm\plugins>ant build

assuming you have checked out VisualVM sources under "c:\visualvm". If you have already checked out BTrace sources under some other directory, say "c:\btrace", you can use

    c:\visualvm\plugins>ant -Dbtrace.home=c:\btrace build

To run VisualVM with all the plugins that you built, you can use the following command:

    c:\visualvm\plugins>ant -Dbtrace.home=c:\btrace run

Please let us know what features you'd like to see with BTrace and/or BTrace VisualVM plugin.

I attended and liked the "Class Loader Rearchitected (BOF-6180)" BOF. If you have ever written class loaders, chances are that you have faced mysterious deadlocks or ClassCastException that said "ClassCastException: Foo cannot be cast to Foo" or having to decide between overriding loadClass and findclass, you probably should have attended this talk and gave your opinions/suggestions/ideas :-) If I understood properly, I think there was a suggestion to add class loader info. to the ClassCastException (something like class-loader-class-name@identity-HashCode style string?) so that one can quickly see it is a class loader issue. Also, there were many questions on loading classes from jar files. Looks like there will be changes to class loader API and class loading in VM for JDK 7.



( May 08 2008, 08:28:58 PM IST ) Permalink Comments [0] del.icio.us | furl | simpy | slashdot | technorati | digg

20080507 Wednesday May 07, 2008

Tuesday May 6, JavaOne

In today's sessions that I attended I liked the following:

JRuby: Why, What, How... Do It Now

This talk is a good introduction to (J)Ruby the language and important applications of (J)Ruby. And many pointers to related (J)Ruby sessions. Nice summary!

JavaScript programming language: The Language Everybody Loves to Hate

great talk by Roberto Chinnici. Nice summary of functional and prototype-based object orientation aspects of JavaScript. You can easily impress your friends will some neat snippets of JavaScript :-) You may want to continue the fun by reading Doug Crockford's pages, if you have not do already!

At 7.30 PM, we (I and Kannan) talked about BTrace. There were many interesting questions/discussions -- both during and after the BOF! Today (Wed May 7) will be a Blu-ray day -- it starts with TS-5449 Java Technology for Blu-ray and TV: Creating your own Blu-ray Java Discs session. It is about the open source project @ http://hdcookbook.dev.java.net. Meet you all there!



( May 07 2008, 07:52:02 PM IST ) Permalink Comments [0] del.icio.us | furl | simpy | slashdot | technorati | digg

20080430 Wednesday April 30, 2008

JVM Languages @ JavaOne 2008

In JavaOne 2008, there are many intesting sessions on "other" JVM languages covering both dynamically typed languages (JavaScript, Groovy, JRuby) and statically typed languages (JavaFX, Scala). As usual, there are many sessions covering application aspects -- like using scripting on Glassfish, Grials (Groovy), Rails (JRuby) and so on. But, my interest is mostly on the programming language aspects and JVM implementation issues. Here is a table of sessions covering those:



Session ID

Session Title

Session Type

Speakers and Company

Speakers and Company

Venue - Room

TS-5152

Overview of the JavaFX™ Script Programming Language

Technical Session

Christopher Oliver, Sun Microsystems, Inc.

Tuesday
May 06
10:50 - 11:50

Moscone Center -
Gateway 104

TS-5416

JRuby: Why, What, How...Do It Now

Technical Session


Thomas Enebo, Sun Microsystems, Inc. ; Charles Nutter, Sun Microsystems, Inc.

Tuesday
May 06
10:50 - 11:50

Moscone Center -
Esplanade 307-310

TS-4794

A JavaFX™ Script Programming Language Tutorial

Technical Session

James Weaver, LAT

Tuesday
May 06
12:10 - 13:10

Moscone Center -
Esplanade 305

TS-4986

JavaScript™ Programming Language: The Language Everybody Loves to Hate

Technical Session

Roberto Chinnici, Sun Microsystems, Inc.

Tuesday
May 06
15:20 - 16:20

Moscone Center -
Esplanade 307-310

PAN-5435

The Script Bowl: A Rapid-Fire Comparison of Scripting Languages

Panel Session

Guillaume Laforge, G2One, Inc.; Charles Nutter, Sun Microsystems, Inc. ; Jorge Ortiz, Stanford; Raghavan Srinivas, Sun Microsystems, Inc.; Frank Wierzbicki, Sun Microsystems

Wednesday
May 07
09:30 - 10:30

Moscone Center -
Gateway 104

TS-5572

Groovy, the Red Pill: Metaprogramming--How to Blow the Mind of Developers on the Java™ Platform

Technical Session

Scott Davis, Davisworld Consulting, Inc.

Wednesday
May 07
09:30 - 10:30

Moscone Center -
North Mtg-121/122/124/125

TS-5165

Programming with Functional Objects in Scala

Technical Session

Martin Odersky, EPFL

Thursday
May 08
13:30 - 14:30

Moscone Center -
Gateway 104

TS-5693

Writing Your Own JSR-Compliant, Domain-Specific Scripting Language

Technical Session

John Colosi, VeriSign, Inc.; David Smith, VeriSign Inc.

Thursday
May 08
13:30 - 14:30

Moscone Center -
Esplanade 301

TS-6050

Comparing JRuby and Groovy

Technical Session

Neal Ford, ThoughtWorks Inc.

Friday
May 09
13:30 - 14:30

Moscone Center -
Esplanade 303

TS-6039

Jython - Implementing Dynamic Language Features for the Java™ Platform Ecosystem

Technical Session


Jim Baker, Zyasoft; Tobias Ivarsson, Neo Technology

Friday
May 09
14:50 - 15:50

Moscone Center -
Esplanade 305



( Apr 30 2008, 10:54:42 AM IST ) Permalink Comments [0] del.icio.us | furl | simpy | slashdot | technorati | digg

20080429 Tuesday April 29, 2008

BTrace BOF @ JavaOne 2008

We have a BOF on BTrace in this year's JavaOne. But, you will not find the name "BTrace" in session title -- that is because talk was submitted before BTrace was open sourced with that name :-) The details of the BOF is as below. Please visit and let us discuss on dynamic tracing for Java.

BOF-5552 Java™ Platform Observability by Bytecode Instrumentation Kannan Balasubramainan, A. Sundararajan Tuesday May 06 19:30 - 20:20 Moscone Center - Esplanade 300


Other related talks/BOFs on dynamic tracing/observability include:

Moscone Center - Hall E 133
TS-5716 D-I-Y (Diagnose-It-Yourself): Adaptive Monitoring for Sun Java™ Real-Time System Technical Session Carlos Lucasius, Frederic Parain Tuesday May 06 18:00 - 19:00
TS-6000 Improving Application Performance with Monitoring and Profiling Tools Technical Session Jaroslav Bachorik, Gregg Sporar Wednesday May 07 10:50 - 11:50 Moscone Center - Gateway 104
LAB-9400 Exposing the Depth of Your JDK™ Release 7.0 Applications with Dynamic Tracing (DTrace) Hands-On Lab Angelo Rajadurai, Raghavan Srinivas, Wednesday May 07 18:30 - 20:30 Moscone Center - Hall E 130/131 (LAB)
TS-6145 Using DTrace with Java™ Technology-Based Applications: Bridging the Observability Gap Technical Session Jonathan Haslam, Simon Ritter Thursday May 08 13:30 - 14:30 Moscone Center - North Mtg-121/122/124/125
BOF-4994 End-to-End Tracing of Ajax/Java™ Technology-Based Applications, Using Dynamic Tracing (dTrace) Birds-of-a-Feather Session (BOF) Amit Hurvitz Thursday May 08 18:30 - 19:20 Moscone Center - Gateway 104
BOF-5223 VisualVM: Integrated and Extensible Troubleshooting Tool for the Java™ Platform Birds-of-a-Feather Session (BOF) Luis-Miguel Alventosa, Tomas Hurka Thursday May 08 19:30 - 20:20 Moscone Center - Gateway 104
TS-6145 Using DTrace with Java™ Technology-Based Applications: Bridging the Observability Gap Technical Session Jonathan Haslam, Simon Ritter Friday May 09 14:50 - 15:50 Moscone Center - North Mtg-121/122/124/125
TS-6000 Improving Application Performance with Monitoring and Profiling Tools Technical Session Jaroslav Bachorik, Gregg Sporar Friday May 09 16:10 - 17:10 Moscone Center - Hall E 133



( Apr 29 2008, 01:27:31 PM IST ) Permalink Comments [1] del.icio.us | furl | simpy | slashdot | technorati | digg

Groovy jsr-223 engine updated..

Groovy jsr-223 script engine @ scripting.dev.java.net has been updated to use Groovy version 1.5.6.



( Apr 29 2008, 08:21:13 AM IST ) Permalink Comments [0] del.icio.us | furl | simpy | slashdot | technorati | digg

20080428 Monday April 28, 2008

Bluray @ JavaOne 2008

If you want to learn more about Blu-ray disc and what Java has to do with it, you may want to attend the following talks/BOFs @ JavaOne 2008!



Date/Time Session ID Session Name
Wednesday, May 07 9:30 AM - 10:30 AM TS-5449 Java™ Technology for Blu-ray™ and TV: Creating your own Blu-ray Java Discs
Wednesday, May 07 9:30 AM - 1:30 PM - 2:30 PM TS-6464 Blu-ray Disc Security
Wednesday, May 07 9:30 AM - 6:30 PM - 7:20 PM BOF-5451 Blu-ray and Java™ Technology Roundtable
Thursday May 08 1:30 PM - 2:30 PM TS-5638 Writing Connected Device Configuration Applications for Resource-Constrained Devices
Thursday May 08 1:30 PM - 2:30 PM TS-5888 Driving Innovation in Packaged Media (Blu-ray) User Experience


From our group talk (TS-5449), we will be focusing on the open source project @ https://hdcookbook.dev.java.net. Meet you soon @ JavaOne !!



( Apr 28 2008, 06:35:19 PM IST ) Permalink Comments [0] del.icio.us | furl | simpy | slashdot | technorati | digg

20080304 Tuesday March 04, 2008

Latest on scripting for the Java platform...

Updates on the world of Scripting for the Java platform:



( Mar 04 2008, 07:13:30 PM IST ) Permalink Comments [2] del.icio.us | furl | simpy | slashdot | technorati | digg

20080215 Friday February 15, 2008

VM on a VM on a ...

My recent fun with virtualization continues. In the last JavaOne, I missed the talk titled "Everything Java": JPC, a Fast x86 PC Emulator. But, I downloaded the source and binary of JPC just to check it out. I ran the classic game "Prince". Nostalgia :-)



( Feb 15 2008, 07:01:20 PM IST ) Permalink Comments [3] del.icio.us | furl | simpy | slashdot | technorati | digg

20080105 Saturday January 05, 2008

blu-ray.. blu-ray...

I am thrilled to know this news!! And that is not without a bit of self-interest. I work on some blu-ray related activities @ Sun (more on that in future!).

BTW, if you are interested in learning about blu-ray and related Java programming platform called BD-J, you may consider the following:



( Jan 05 2008, 11:47:15 AM IST ) Permalink del.icio.us | furl | simpy | slashdot | technorati | digg

20080103 Thursday January 03, 2008

Latest on the Scripting project

Updates on the Scripting project.

  1. Updated JavaScript script engine with Rhino version 1.6R7. This version supports E4X without requiring XMLBeans.
  2. Updated Groovy script engine to use version 1.5.1.
  3. Updated Jython script engine to use version 2.2.1.
  4. Updated Freemarker script engine to use version 2.3.11.
  5. Yoko Harada is planning to update JRuby script engine with version 1.1x.



( Jan 03 2008, 04:57:14 PM IST ) Permalink Comments [3] del.icio.us | furl | simpy | slashdot | technorati | digg

20071112 Monday November 12, 2007

What's new with Scripting for the Java platform?

Sorry about the looo..ng hibernation! Now, it is time for updates on the Scripting project.

  1. Yoko Harada updated JRuby script engine with JRuby 1.0.2 and added few other fixes in engine code.
  2. I've pre-built binaries of the project (uploaded the .zip and .tar.gz files)

Three new jsr-223 compliant script engines:

  1. JavaFX Script interpreter had jsr-223 support. Now, the JavaFX Script compiler has jsr-223 support -- you may want to checkout JavaFX Script compiler project. The following code works as expected:
    
    import javax.script.*;
    
    public class Test {
        public static void main(String[] args) throws Exception {
            ScriptEngineManager m = new ScriptEngineManager();
            ScriptEngine e = m.getEngineByName("javafx");
            e.eval("<<java.lang>>.System.out.println(\"hello\");");
        }
    }
    
    
    Please note that you need to build JavaFX Script compiler by checking out sources from the SVN repository and put the jar in the CLASSPATH.
  2. Xavier Clerc sent a link to the jsr-223 script engine for the Object Caml language. Thanks!
  3. Alexandre Bergel sent a link to the jsr-223 script engine for the Smalltalk language. Thanks!

Happy scripting!



( Nov 12 2007, 01:17:27 PM IST ) Permalink del.icio.us | furl | simpy | slashdot | technorati | digg

20070910 Monday September 10, 2007

javac's hidden options...

javac has "hidden" and "even more hidden" options. This blog entry is about how to use one such option without actually modifying javac's source code. [Read More]



( Sep 10 2007, 12:49:48 PM IST ) Permalink del.icio.us | furl | simpy | slashdot | technorati | digg

20070730 Monday July 30, 2007

ANTLRWorks and fun with grammars

If you are a programming languages enthusiast, you'll probably like this. I downloaded ANTLR Parser Generator. In addition to ANTLR, I downloaded the following:

20070714 Saturday July 14, 2007

Week-end fun with the java compiler source code

I downloaded java compiler (javac) source code from the JDK 7 site. I did not download entire JDK – I just downloaded compiler-7-ea-src-b15-05_jul_2007.zip I've installed JDK 6 and NetBeans 5.0

I extracted the source zip file into c:\javac directory. From NetBeans IDE, File->Open Project menu, I chose c:\javac\compiler directory. Then, I build the project – I scrolled the build output log to the end and I saw:

Building jar: C:\javac\compiler\dist\lib\javac.jar

build-bin.javac:

Copying 1 file to C:\javac\compiler\dist\bin

build:

BUILD SUCCESSFUL (total time: 8 seconds)

So, I tried to run the newly compiled java compiler. I attempted to compile a simple “Hello World” program. I got the following error:

C:\javac\compiler\dist\lib>java -jar javac.jar Hello.java

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main

What happened? I looked at the build log again. I missed the following lines – because I had seen only at the end!!

Copying 7 files to C:\javac\compiler\build\bootclasses

recompiling compiler with itself

javac: invalid flag: C:\javac\compiler\build\classes

Usage: javac <options> <source files>

use -help for a list of possible options

Java Result: 2

Copying 7 files to C:\javac\compiler\build\classes

Copying 1 file to C:\javac\compiler\build\classes\com\sun\tools\javac\resources

Building jar: C:\javac\compiler\dist\lib\javac.jar

build-bin.javac:

Copying 1 file to C:\javac\compiler\dist\bin

build:

BUILD SUCCESSFUL (total time: 8 seconds)

Looks like there is a build error. The compiler in built in two steps:

  1. The sources are built with javac in JDK 6 (on which my NetBeans IDE ran)

  2. Then, compiler sources are built again – but this time with the new compiler binary generated by step (1).

Looks we got error in the step (2) [see above: recompiling compiler with itself] . I searched the ant script used to build for “recompiling compiler with itself”. The following is the fragment after that:

<echo message="recompiling compiler with itself"/>

<pathconvert pathsep=" " property="src.javac.files">

<path>

<fileset dir="${src.classes}">

<patternset refid="src.javac"/>

</fileset>

</path>

</pathconvert>

<java fork="true" classpath="${build.bootclasses}" classname="com.sun.tools.javac.Main">

<arg value="-sourcepath"/>

<arg value=""/>

<arg value="-d"/>

<arg file="${build.classes}"/>

<arg value="-g:source,lines"/>

<arg line="${src.javac.files}"/>

</java>

The problem seems to be with “java” command above. Empty string is set as value for -sourcepath option. I changed that to the following:

<arg value="-sourcepath"/>

<arg value="${src.classes}"/>

When I re-built the compiler after the above change, there were no errors – yes, I scrolled the build output to check it :-) And newly compiled javac could compile “Hello World” program.

Now, I wanted to make some to “interesting” but simple change to the compiler source. From a “doc” page, I came to know that there is a hidden javac option called “-printflat”. It appears that with -printflat option javac prints source code after doing transformations for generic types, inner classes, enhanced for-loops, assertions etc. It would be great to visualize the kind of transformations done by javac. So, I wanted to make “hidden” option available. I searched for “printflat” in the project. I got three hits:

  1. JavaCompiler.java

  2. RecognizedOptions.java

  3. java.properties

As usual, I am impatient – wanted to enable printflat option always [regardless of what the command line is]. So, I changed the following line in JavaCompiler.java

printFlat = options.get("-printflat") != null;

to

printFlat = true; // options.get("-printflat") != null;

so that the secret option is enabled always. After rebuilding the compiler, I tried compiling my “Hello World” program. Surprise! I got the following error:

C:\javac\compiler\dist\lib>java -jar javac.jar Hello.java

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main

When I checked “javac.jar” by “jar tvf javac.jar”, I saw only “.java” files instead of “.class” files! Remember I mentioned that javac is recompiled by itself (step (2) above)? Apparently with “-printflat” option, javac just write transformed files but does not generate .class files! Because I had hardcoded printflat to be true always, during the second bootstrap compilation javac did not generate .class files. Looks like my lazy way does not work! I need to find how to really change the code to accept printflat command line option explicitly. I cut the story shot and just summarize the changes I made:

  1. added a enum value to com.sun.tools.javac.main.OptionName – PRINTFLAT("-printflat");

  2. In com.sun.tools.javac.main.RecognizedOptions class, I added PRINTFLAT to “static Set<OptionName> javacOptions” initialization value.

  3. In public static Option[] getAll(final OptionHelper helper) method of RecognizedOptions class, I added “new HiddenOption(PRINTFLAT)” as an element in the returned Option[].

I managed to compile and run the compiler after the above changes! Now when I can pass “printflat” option!! I compiled the following simple Book.java:


class Book {
  private String name;
  public Book(String name) {
     this.name = name;
  }

  class Order {
     private int quantity;
     public Order(int quantity) {
        this.quantity = quantity;
     }
  }
}

with the following command:

c:\javac\compiler\dist\lib\>java -jar javac.jar -printflat c:\Book.java

Now, I can see the generated Book.java and Book$Order.java in the current directory where java compiler was run:


class Book {
    private String name;
    
    public Book(String name) {
        super();
        this.name = name;
    }
    {
    }
}

class Book$Order {
    /*synthetic*/ final Book this$0;
    private int quantity;
    
    public Book$Order(/*synthetic*/ final Book this$0, int quantity) {
        this.this$0 = this$0;
        super();
        this.quantity = quantity;
    }
}

Wow! I can see how java compiler generates a hidden synthetic parameter for the outer class object and so on. Note that the java compiler does not overwrite your original source files. You need to run the compiler in a different directory – compiler generates new files [which is good, you won't accidentally overwrite your original code with generics, inner classes and so on].

Now, you can experiment with constructs like asserts, inner class methods accessing outer's private methods/fields, anonymous/local classes, local class accessing final parameters/locals of enclosing method, generics, enhanced for-loop and so on and see how java compiler transforms those constructs to generate good-old “flat” classes without these features. Have fun!!



( Jul 14 2007, 11:28:29 PM IST ) Permalink Comments [1] del.icio.us | furl | simpy | slashdot | technorati | digg

Copyright (C) 2005, A. Sundararajan's Weblog