[Ikvm-developers] Compile and Run Problem
Brought to you by:
jfrijters
From: NAGWA A M B. . <nb...@st...> - 2009-06-11 04:23:24
|
Dear all, can you help me please in this arugant problem, i am working in project using java ,i want to work it using C# in .net framework.. i read this teatourial carfully and follow what they wrote as these steps: first,i comiple weka.jar(java executable file) into weka .dll by type in console this command (> ikvmc -target:library weka.jar),the only thing i get when i compile the weka jar file is weka .dll file, then i turn to VS.NET 2005 and wrote the following c# code: /************************************************************ //start of file Main.cs using System; class MainClass { public static void Main(string[] args) { Console.WriteLine("Hello Java, from C#!"); classifyTest(); } const int percentSplit = 66; public static void classifyTest() { try { weka.core.Instances insts = new weka.core.Instances(new java.io.FileReader("iris.arff")); insts.setClassIndex(insts.numAttributes() - 1); weka.classifiers.Classifier cl = new weka.classifiers.trees.J48(); Console.WriteLine("Performing " + percentSplit + "% split evaluation."); //randomize the order of the instances in the dataset. weka.filters.Filter myRandom = new weka.filters.unsupervised.instance.Randomize(); myRandom.setInputFormat(insts); insts = weka.filters.Filter.useFilter(insts, myRandom); int trainSize = insts.numInstances() * percentSplit / 100; int testSize = insts.numInstances() - trainSize; weka.core.Instances train = new weka.core.Instances(insts, 0, trainSize); cl.buildClassifier(train); int numCorrect = 0; for (int i = trainSize; i < insts.numInstances(); i++) { weka.core.Instance currentInst = insts.instance(i); double predictedClass = cl.classifyInstance(currentInst); if (predictedClass = insts.instance(i).classValue()) numCorrect++; } Console.WriteLine(numCorrect + " out of " + testSize + " correct (" + (double)((double)numCorrect / (double)testSize * 100.0) + "%)"); } catch (java.lang.Exception ex) { ex.printStackTrace(); } } } //end of file Main.cs /********************************************************* then i add these referances to c# project(weka.dll,IKVM.Runtime.JNI.dll,IKVM.Runtime.dll) then i compile and run the project but it is not work well and i get the following run output: 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\jit\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Deployment\2.0.0.0__b03f5f7f11d50a3a\System.Deployment.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The thread 0xf90 has exited with code 0 (0x0). The thread 0xf8c has exited with code 0 (0x0). 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\jit\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.exe', Symbols loaded. Hello Java, from C#! 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\jit\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\weka.dll', No symbols loaded. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\jit\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\IKVM.OpenJDK.ClassLibrary.dll', No symbols loaded. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\jit\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\IKVM.Runtime.dll', No symbols loaded. 'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', No symbols loaded. A first chance exception of type 'java.io.FileNotFoundException' occurred in IKVM.OpenJDK.ClassLibrary.dll The thread 0xfb8 has exited with code 0 (0x0). The thread 0x164 has exited with code 0 (0x0). The program '[3940] WindowsApplication1.vshost.exe: Managed' has exited with code 0 so, please can you help and guid me what i can do or what is the problem and mistake... i wait for your reply as soon as you can. Thanks you alot nagwa |