- Week 5: JRuby Basics (Topics to be covered: What is and what is not JRuby?, Why JRuby (over Ruby) & JRuby on Rails (Ruby on Rails)?, Why use (J)Ruby with Java? Calling Java from JRuby, Calling (J)Ruby from Java)
- o 5520_ruby_jruby.zip (Unzip it in a directory of your choice and read lab document from
/ruby_jruby/index.html to proceed) (4/10/09: Installed/done) - * Resources
o Websites
+ JRuby wiki from wiki.jruby.org
o Tutorials
+ Why You Want JRuby blog by Eric Armstrong (May 2008)
+ JRuby Tutorial by Charles Nutter and Ola Bini
+ JRuby wiki from en.wikipedia.org
+ Calling Java from JRuby wiki from wiki.jruby.org
+ Mixing Java and Ruby Development screencast
+ JRuby - Enterprise 2.0 presentation by James Crisp and Josh Price
+ Ola Bini Discusses JRuby from infoq.com
+ Charles Nutter discusses JRuby from infoq.com
o NetBeans support of JRuby
+ JRuby Support in NetBeans IDE 6 Ask the Experts Transcript (May 2008)
o GUI
+ Swing with JRuby: Developing a Desktop Application with the JRuby and Java Swing APIs tutorial by Teera Kanokkanjanarat
+ Swing with JRuby Part II: Packaging JRuby Desktop Application tutorial by Teera Kanokkanjanarat
+ Cheri project home site from cheri.rubyforge.org
o Presentations
+ JRuby - Bringing Ruby to the JVM presentation by Charles Nutter and Thomas Enebo (Sep. 2006)
+ JRuby Presentation @ Vancouver Ruby User group event by Teera Kanokkanjanarat
+ Ola Bini's presentation - Presentation (o PDF: 1 slide per page (OR) o OpenOffice file) (20 pages) (4/10/09: Read)
- Online Lab/Homework/Change Log document (This is the same document you will find in the hands-on lab zip file) (44 pages)
- Exercise 1: Build JRuby applications using Java classes
- (1.1) JRuby_ImportClass (p.2-3) Answer: ----Import a Java class, java.lang.System
----Display Java version using java.lang.System Java class
Java verion used is 1.6.0_13-b03 - (1.2) JRuby_UseJavaJFrameClass (p.3) Answer: Got a small window with "Hello World!" in it.
- (1.3) JRuby_UseJavaJFrameClass2 (p.3-4) Answer: Got a "medium" red window with nothing but color in it.
- (1.4) JRuby_UseJavaTreeSetClass" (p.4-5) Answer: ----Create an object from TreeSet Java class
----Add entries to the TreeSet
----Display TreeSet
value: Bar
value: baz
value: foo - (1.5) JRuby_UseJavaArrayListClass (p.5-6) Answer: ----Create an object from ArrayList Java class
----Add entries to the ArrayList
----Add an entry using an index
----Display ArrayList
value: foo
value: Bar
value: Sang Shin
value: baz
----Display an entry using an index
Sang Shin - Exercise #2: Create Ruby Module from Java Packages (p.6-7)
- (2.1) JRuby_CreateModuleFromJavaPackage (p.6-7) Answer: ----Create a module from Java package
----Create a string
This is my string from java.lang package - (2.2) JRuby_CreateModuleFromJavaPackage2 (p.7) Answer: ----Create a Ruby Module from Java package
----Get Java version information
1.6.0_13-b03 - Exercise #3: Use "FreeTTS" Speech Synthesizer 3rd-party Java Library (p.7-14)
- (3.1) JRuby_UseJavaSpeechLibrary (p.8-14) Changed properties to include the speech jar files. Ran the program and hear the two sentence and this: ----Allocate a voice
----Speak out - Exercise #4: Use "JFreeChart" 3rd-party Java Library (p.14-21)
- (4.1) JRuby_UseFreeChartLibrary (p.14-21) Answer: Ran the program and saw the graph with this text: redefining File
Rendering sparkline - Exercise #5: Use your own Java library (p.22-31)
- (5.1) HelloJavaLibrary (p.22-31) Answer: init:
deps-jar:
Created dir: C:\cygwin\home\jasnow\RAILSPASSION\ruby_jruby\samples\HelloJavaLibrary2\build\classes
Compiling 1 source file to C:\cygwin\home\jasnow\RAILSPASSION\ruby_jruby\samples\HelloJavaLibrary2\build\classes
compile:
Created dir: C:\cygwin\home\jasnow\RAILSPASSION\ruby_jruby\samples\HelloJavaLibrary2\dist
Building jar: C:\cygwin\home\jasnow\RAILSPASSION\ruby_jruby\samples\HelloJavaLibrary2\dist\HelloJavaLibrary2.jar
jar:
BUILD SUCCESSFUL (total time: 0 seconds) - (5.2) Create, build, and run JRuby application (p.31-42): Ran program and got this: ----Create an object from Hello Java class
----Invoke a method of from Hello object
HelloMessage from Hello Java Class!! - Exercise #6: Naming Conventions: (p.43-44)
- (6.1) JRubyNaming_JavaClass (p.43) Answer: Got small window with "Hello World!" in it.
- (6.2) JRubyName_JavaMethod (p.43-44) Answer: ----Create an object from Hello Java class
----Invoke a method of from Hello object
HelloMessage from Hello Java Class!! - Homework Exercise: First create a Java Library (p22-31) : init:
deps-clean:
clean:
init:
deps-jar:
Created dir: C:\cygwin\home\jasnow\RAILSPASSION\ruby_jruby\samples\ComputeJavaLibrary\build\classes
Compiling 1 source file to C:\cygwin\home\jasnow\RAILSPASSION\ruby_jruby\samples\ComputeJavaLibrary\build\classes
compile:
Created dir: C:\cygwin\home\jasnow\RAILSPASSION\ruby_jruby\samples\ComputeJavaLibrary\dist
Building jar: C:\cygwin\home\jasnow\RAILSPASSION\ruby_jruby\samples\ComputeJavaLibrary\dist\ComputeJavaLibrary.jar
jar:
BUILD SUCCESSFUL (total time: 0 seconds) - Then create JRuby application. IT WORKED. 7
3
0
75
Friday, April 10, 2009
Week 5: Rails Passion Course
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment