Thursday Sep 17, 2009

"helloworld" with Maxine JVM on Mac

Last night, I listened to this nice podcast on Maxine JVM from Software Engineering Radio. Maxine is a Java Virtual Machine implemented in the Java programming language.

I wanted to try out Maxine on my MacBook Pro running Mac OS X 10.5.8. I followed these steps to try it out:

  • Get the Maxine sources
    
        hg clone https://kenai.com/hg/maxine~maxine maxine
    
    
  • Setup the environment
    
        export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
        export JUNIT4_CP=<full-path-of junit-4.4.jar>
    
    
  • Build Maxine
    
       cd $MAXINE_HOME/bin
       ./max build
       ./max image   
    
    
  • Run the "helloworld"
    
        ./max helloworld
    
    

Wow! Maxine VM printed "Hello World!". Now, it is time to explore Maxine's inspector and other cool stuff ...

Wednesday Sep 02, 2009

java.lang.NoClassDefFoundError: com/sun/javafx/runtime/FXBase

I created a simple JavaFX applet and compiled it with "javafxc" and created a jar "HelloApplet.jar". Then, I created a simple HTML file as follows:


<script src="http://dl.javafx.com/dtfx.js"></script>
<script>
           javafx(
           {
               archive: "HelloApplet.jar",
               draggable: true,
               width: 150,
               height: 100,
               code: "hello.HelloApplet",
               name: "HelloApplet"
           }
       );
</script>

When viewing the HTML, I did not see the expected applet content in it - just a gray rectangle panel :-( Then, I turned on the "Show Java Console" option. I saw the following exception trace in Java console:


JNLPAppletLauncher: static initializer
Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: com/sun/javafx/runtime/FXBase
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
[.. more stack frames deleted for brevity ..]

Aha! com.sun.javafx.runtime.FXBase is new since JavaFX 1.2. Yes, I had compiled my applet with JavaFX 1.2 (full version "1.2.0_b233"). So, the JavaFX runtime used turned out to be old one! I changed the HTML script URL from http://dl.javafx.com/dtfx.js to http://dl.javafx.com/1.2/dtfx.js. The applet worked as expected :-)

About

sundararajan

Search

Archives
« September 2009 »
SunMonTueWedThuFriSat
  
1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks
Links

No bookmarks in folder

Blogroll

No bookmarks in folder

News

No bookmarks in folder