3

I'm trying to use LibSVM programmatically in Java, via the Weka wrapper written by El-Manzalawy, running on Windows 7. I've added C:\Program Files (x86)\libsvm-3.12\java\libsvm.jar to my CLASSPATH environmental variable. After adding that I can now use LibSVM via the Weka explorer user interface, but it still fails when I'm calling it in code (debugging in eclipse).

I try to create it using Weka.core.Utils.forName. This goes through to LibSVM.java which then calls the java method Class.forName(...), passing CLASS_SVM as the param which is set to "libsvm.svm".

I've used Weka.core.Utils.forName to create others classifiers programmatically without problems.

Anyone have any ideas?

jabaldonedo
  • 25,822
  • 8
  • 77
  • 77
Philip Welch
  • 4,488
  • 2
  • 20
  • 17
  • @Sicco - thanks for answer. I will try upgrading soon. – Philip Welch Aug 01 '12 at 13:15
  • UPDATE: I've manually added LibSVM as an external java to my own project which fixes it (although I'm not too sure what *exactly* was happening, other than it not finding the jar...) – Philip Welch Aug 01 '12 at 13:16
  • I have the same issue with Weka 3.7.11 . Everything works greate in Explorer and SimpleCLI, but the error appear when trying to specify a training file! I think this is El-Manzalawy's fault because the exception is thrown from LibSVM.java . (It's seems crazy. LibSVM has problem to find itself!!!!) – SuB Dec 30 '14 at 23:29

2 Answers2

1

You should be able to glue libsvm and weka in your java program using the answer posted here: How to use LibSVM with Weka in my Java code?

Community
  • 1
  • 1
andrew
  • 521
  • 1
  • 7
  • 14
0

Adding LibSVM is real easy when using Weka 3.7.6, because it allows you to install it via its package manager, either via command line or GUI. So I'd recommend using Weka 3.7.6.

Sicco
  • 6,167
  • 5
  • 45
  • 61