aspose file tools*
The moose likes Java in General and the fly likes Classpath problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Classpath problem?" Watch "Classpath problem?" New topic
Author

Classpath problem?

tim smit
Greenhorn

Joined: Oct 22, 2007
Posts: 1
I was trying to run a slight modification of weka as provided by the university of texas (austin), available at: http://www.cs.utexas.edu/users/ml/risc/code/

I'm running it on a x86_64 Linux platform:
Linux version 2.6.9-42.ELsmp (bhcompile@ls20-bc1-13.build.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-2)) #1 SMP Wed Jul 12 23:32:02 EDT 2006

I have installed java in my local directory, and have modified the Makefile accordingly.The makefile specifies the paths as:

------------------------------------
# Java version to use
JAVADIR = /home/ts/java/j2sdk1.4.2_16

CLASSPATH = ${JAVADIR}:${INSTALL_DIR}/weka-latest/weka/core/metrics:./:../:../../:../../../:${INSTALL_DIR}/packages/rmn.jar:${INSTALL_DIR}/packages/Jama-1.0.1.jar
:${INSTALL_DIR}/packages/cplex.jar:${INSTALL_DIR}/packages/jmage.jar:${INSTALL_DIR}/packages/ir.jar:${INSTALL_DIR}/packages/jmatlink.jar

[ The above lines are really joined; I added a line break for readability - Jim ]

------------------------------------

I get the following errors when trying to run from the command line:

-------------------------------------------------------------------------------------

$ $ java weka/clusterers/MPCKMeans -D data/iris.arff -C data/iris.constraints

..
..
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: weka.core.metrics.WeightedMahalanobis
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.Class.initializeClass() (/usr/lib64/libgcj.so.5.0.0)
at java.lang.Class.isInstance(java.lang.Object) (/usr/lib64/libgcj.so.5.0.0)
at weka.clusterers.MPCKMeans.calculateMaxCLPenalties() (Unknown Source)
at weka.clusterers.MPCKMeans.runKMeans() (Unknown Source)
at weka.clusterers.MPCKMeans.buildClusterer(weka.core.Instances) (Unknown Source)
at weka.clusterers.MPCKMeans.buildClusterer(weka.core.Instances, int) (Unknown Source)
at weka.clusterers.MPCKMeans.buildClusterer(java.util.ArrayList, weka.core.Instances, weka.core.Instances, int, int) (Unknown Source)
at weka.clusterers.MPCKMeans.runFromCommandLine(java.lang.String[]) (Unknown Source)
at weka.clusterers.MPCKMeans.main(java.lang.String[]) (Unknown Source)
Caused by: java.lang.ClassNotFoundException: Jama.Matrix not found in [file:/usr/share/java/libgcj-3.4.6.jar, file:./, core:/]
at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib64/libgcj.so.5.0.0)
at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib64/libgcj.so.5.0.0)
at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib64/libgcj.so.5.0.0)
at _Jv_BytecodeVerifier.type.compatible(_Jv_BytecodeVerifier.type&, _Jv_BytecodeVerifier) (/usr/lib64/libgcj.so.5.0.0)
at _Jv_BytecodeVerifier.verify_instructions_0() (/usr/lib64/libgcj.so.5.0.0)
at _Jv_VerifyMethod(_Jv_InterpMethod) (/usr/lib64/libgcj.so.5.0.0)
at _Jv_PrepareClass(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
at _Jv_WaitForState(java.lang.Class, int) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)


------------------------------------------------------------------------------------

Where am I configuring the classpath incorrectly (why is it going to /usr/lib64/libgcj.so.5.0.0)? Any insight would be highly appreciated.

thanks!
[ October 22, 2007: Message edited by: Jim Yingst ]
Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
[tim smit]Any insight would be highly appreciated.
In no paticular order, and until someone else who knows more comes along:
  • weka is experimental, java was finding things util it got to the WeightedMahalanobis
  • Put your code inside code tags, there are some squarish script buttons below the text area, use code.gif marked "code" - put any code between the [ tag ] - code goes here - [ /tag ], format as you would in an editor except don't let the lines get very long. There is a constant battle to get a balance in all the information needed compared to available screen space.
  • Where do you get the weka-latest/weka/core/metrics:./:../:../../:../../..semantics and what are the colons ? { this may be unice conventions, i work in winnie the poo land } ';' is the path separator, not ':' - that may be your problem.



  • "The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
    Jim Yingst
    Wanderer
    Sheriff

    Joined: Jan 30, 2000
    Posts: 18671
    Focusing on these two parts:

    CLASSPATH=[...]:${INSTALL_DIR}/weka-latest/weka/core/metrics:[...]

    Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: weka.core.metrics.WeightedMahalanobis


    It looks like weka.core.metrics is the package name. If ${INSTALL_DIR}/weka-latest/weka/core/metrics contains a file WeightedMahalanobis.class, then your CLASSPATH should contain the root directory ${INSTALL_DIR}/weka-latest/ - you don't need to add the weka/core/metrics directories, as those will be inferred from the package name.
    [ October 22, 2007: Message edited by: Jim Yingst ]

    "I'm not back." - Bill Harding, Twister
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Classpath problem?