Article Outdated, please see tutorial here

Scriptom Hell!


Dear Scriptom,

If you would like people to use your product, please make it possible.

When you navigate to the Scriptom page, the first thing they offer is Scriptom 2.0. Unfortunately for the entire world, this (just below) doesn't work with the recommended download of Groovy 1.0. Groovy 1.0 comes bunded with Scriptom 2.0, but there's no "QuickStart" guide that I can find, and I get ANT_HOME errors, which neither Scriptom nor Groovy says anything about during install.

Needless to say, after manually downloading Groovy + Scriptom, my efforts were unsuccessful. Since my last error messages were ANT related, and I can't seem to figure out why ANT refuses to work, I decided to switch to a Netbeans approach (ANT works great in Netbeans 6 Beta RC2)

Unfortunately this requires Netbeans DEV 20071202, which has "Plugin" support for Groovy. Groovy plugin is version 1.0, which is confusing since Scriptom 2.0 is not compatible with it. The new version of Scriptom says its bundled with JACOB, (which I'm already using in my project anyways), but no documentation if the old version comes with it.

Here's my first test run in Netbeans DEV 20071202, with the Groovy plugin installed:

// Groovy source file

def name='World'

println "Hello $name!"

import org.codehaus.groovy.scriptom.*;

Scriptom.inApartment
{
def ie = new ActiveXObject('InternetExplorer.Application')

ie.Visible = true
ie.AddressBar = true

ie.Navigate "http://glaforge.free.fr/weblog"
}
And here's my error message in Netbeans:
rg.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, src\hellogroovy\Main.groovy: 11: unable to resolve class ActiveXObject
@ line 11, column 12.
def ie = new ActiveXObject('InternetExplorer.Application')
^

1 error

Java Result: 1
No luck. Since Netbeans lets me look into the packages easily, I notice "ActiveXObject" is a Class inside of Scriptom. Since Groovy 1.1 is now installed, I'm

According to the Groovy site, Scriptom 2.0 needs Groovy 1.1, which no download link is provided. Since Groovy 1.0 is obtained through a Netbeans plugin module, I'm not sure if Groovy 1.1 will work with Netbeans. I Googled Groovy 1.1 downloaded, installed, and now I'm crossing my fingers....

Ok, I'm much closer:

Caught: java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\Groovy\bin\jacob.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
at Main.run(Main.groovy:9)
at Main.main(Main.groovy)
Java Result: 1

This is an excellent sign. Apparently, Groovy keeps its own copy of jacob.dll. I have a 64-bit version I downloaded from the Jacob site, and I'll put it in my project, removing the one in the Groovy folder.

No luck.

Caught: java.lang.UnsatisfiedLinkError: no jacob in java.library.path
at Main.run(Main.groovy:9)
at Main.main(Main.groovy)
Java Result: 1
Looks like I have to put the 64-bit JACOB.DLL into the Groovy\bin folder.

Closer!

Caught: java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\Groovy\bin\jacob.dll: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem
at Main.run(Main.groovy:9)
at Main.main(Main.groovy)
Java Result: 1
I've read about this bug!

Microsoft Visual C++ 2005 SP1 Redistributable Package (x64)
(~3MB download)

Installed, but another error:

Caught: java.lang.NoClassDefFoundError: Could not initialize class com.jacob.com.Variant
at Main.run(Main.groovy:9)
at Main.main(Main.groovy)
Java Result: 1
I know Variant is a Class inside the jacob.jar file, so I'm putting jacob.jar into my project, but same error...

The Groovy site suggests:

NOTE: If you are using Scriptom 2.0 with the Groovy 1.0 Windows InstallerScriptom (through version 1.2) in your existing projects, you may see errors due to conflicts with different versions of jacob.jar and jacob.dll. Do a wildcard search for 'jacob.'* and verify that you don't have any extra copies lying about. In Scriptom 2.0, the jacob.jar file has been jarjar'd into the Scriptom JAR file. For conflicting JAR files, a common symptom is java.lang.NoClassDefFoundError. or if you are using earlier versions of
So I'm canvasing my hard drive for bazaar versions of JACOB.
  • Nothing in C:\Windows
  • Found jacob.jar in: C:\Program Files (x86)\Groovy\lib
I'll remove jacob.jar from my project again, and from Groovy\lib, and put in the newly downloaded version.

No luck.

I'll completely remove jacob.jar from the Groovy\lib folder...

No luck.

Since I'm on a special platform (x86-64), I'm going to try re-zipping the scriptom2 beta 7 jar with the latest release of Jacob. That should help ensure that Jacob.jar and Jacob.dll are the same versions.

Done. Now I have my own scriptom-2.0b7.jar. I'll drop it back into Groovy\lib folder, and put the AMD64 version of JACOB.DLL into Groovy\bin, removing all duplicates.

Now I get this error:

Caught: BUG! exception in phase 'semantic analysis' in source unit 'src\hellogroovy\Main.groovy' Invalid index
Java Result: 1
Since I zipped the new scriptom instead of using "JAR", I'll try once more the right way...

jar cvfm scriptom-2.0b7.jar META-INF/MANIFEST.MF *
Copied to Groovy\lib.

Caught: java.lang.NoClassDefFoundError: Could not initialize class com.jacob.com.Variant
at Main.run(Main.groovy:12)
at Main.main(Main.groovy)
Java Result: 1
Back to that message... UGH! I'll reboot just incase that Microsoft Patch required one, but didn't tell me...

Comments

Popular posts from this blog

Dell Zino HD Remote Standard

iPod Touch iPhone 3G Ubuntu 9.10 in 5 minutes

Pidgin - Microsoft Office Communicator