[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wekalist
Subject:    Re: [Wekalist] Help needed to convert weka.jar file into weka.dll using IKVM
From:       Mark Hall <mhall () pentaho ! com>
Date:       2012-06-28 10:07:34
Message-ID: 4FEC2CE6.6020000 () pentaho ! com
[Download RAW message or body]

On 23/06/12 7:52 AM, Saurabh Gupta wrote:
> Hello All,
>
> Any help would be heavily appreciated.
>
> I am running into following issue while trying to use weka.dll (.net
> version of weka.jar converted using IKVM) in my .net 4.0 project. I have
> followed steps mentioned in -
> http://weka.wikispaces.com/IKVM+with+Weka+tutorial . The exact steps
> worked for me and I was able to create a weka.dll file.
>
> Useful Information -
>
> 1.I am running Weka(3.6.7) for Windows x64 in a 64 bit Intel® Core i7
> 3.40GHZ desktop machine and Windows 7
>
> 2.I am running Java™ 6.0.210.7 version
>
> 3.I downloaded IKVM 7.0.4335.0 into my Program Files folder
>
> When I try to serialize my ANN model (generated using WEKA console) in
> my C# code (like below) using “weka.dll” I get “InvalidClassException” error
>
> Code – *“weka.classifiers.Classifier cl =
> (weka.classifiers.Classifier)weka.core.SerializationHelper.read(filepath
> + @"\test.model");”*
>
> Error thrown - *“java.io.InvalidClassException: javax.swing.JComponent;
> local class incompatible: stream classdesc serialVersionUID =
> -1030230214076481435, local class serialVersionUID =
> 5670834184508236790}” – */I have included the stack trace at the bottom
> of this message/
>
> I have tested running the model through a JAVA interface using weka.jar,
> and it has worked absolutely fine.
>
> While running IKVM to convert weka.jar file into weka.dll file it gave
> me following warning which I ignored – */unable to compile class
> “weka.gui.MacArffOpenFilesHandler” <missing class
> “com.apple.eawt.OpenFilesHandler”>/*
>
> Thanks,
>
> Saurabh
>
> Just in case, I have included steps that I have used to convert weka.jar
> file into weka.dll
>
> IKVM Setup -
>
> 1.Download IKVM package from
> http://sourceforge.net/project/showfiles.php?group_id=69637 and put the
> folder extracted under C:\Program Files
>
> 2.In command line prompt browse to C:\Program Files\IKVM and type IKVM
> and hit enter to test it
>
> 3.Setup the environment for using IKVM tools
>
> a.Add "C:\Program Files\ikvm-7.0.4335.0\bin" to Path variable in system
> environment
>
> b.Add "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322" to Path variable in
> system environment
>
> 4.Use IKVMC to convert the WEKA jar files to .net dll
> (http://www.ikvm.net/userguide/ikvmc.html )
>
> Creating Weka dll
>
> 1.Change directory to location, where weka.jar file is located, in
> command prompt
>
> 2.Run following command ikvmc -target:library weka.jar
>
> 3.This will create weka.dll file
>
> Referencing weka in .net project -
>
> 1.Add reference to generated weka.dll
>
> 2.Add reference to IKVM.Runtime from C:\Program Files\ikvm-7.0.4335.0\bin
>
> 3.Add reference to IKVM.OpenJDK.Core from C:\Program
> Files\ikvm-7.0.4335.0\bin
>
> Stack trace of the error –
>
> /   at java.io.ObjectStreamClass.invokeReadObject(Object ,
> ObjectInputStream )/
>
> /   at java.io.ObjectInputStream.readSerialData(Object ,
> ObjectStreamClass )/
>
> /   at java.io.ObjectInputStream.readOrdinaryObject(Boolean )/
>
> /   at java.io.ObjectInputStream.readObject0(Boolean )/
>
> /   at java.io.ObjectInputStream.defaultReadFields(Object ,
> ObjectStreamClass )/
>
> /   at java.io.ObjectInputStream.readSerialData(Object ,
> ObjectStreamClass )/
>
> /   at java.io.ObjectInputStream.readOrdinaryObject(Boolean )/
>
> /   at java.io.ObjectInputStream.readObject0(Boolean )/
>
> /   at java.io.ObjectInputStream.readObject()/
>
> /   at weka.core.SerializationHelper.read(InputStream stream)/
>
> /   at weka.core.SerializationHelper.read(String filename)/
>
> /   at WEKAInitializer.UnitTest1.LoadANNModel() in
> C:\Users\saurabh\Documents\Visual Studio
> 2010\Projects\WEKAInitializer\WEKAInitializer\UnitTest1.cs:line 71/
>

I don't know much about IKVM I'm afraid. Was the model learned and 
serialized via Weka running under a Java VM or IKVM? Is your model a 
weka.classifiers.functions.MultilayerPerceptron? If so, then there 
shouldn't be an issue with Swing components as the mdoel does not keep a 
reference to its GUI after buildClassifier() completes.

Cheers,
Mark.



_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@list.scms.waikato.ac.nz
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/=
listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.=
html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic