Results 1 to 2 of 2
  1. #1
    AlakaAlaki is offline Member
    Join Date
    Jun 2008
    Posts
    1
    Rep Power
    0

    Default Issue with JNI and C library

    Hi, I hope this is in the right forum since I am a beginner heh.

    I'm working in fedora code 5.
    I'm a math student trying to put together what should be not too complicated a program.
    I've written some code in java using JNI to call a method from a C library to make a call to another program (written in C).
    However, I'm getting an error that I can't figure out.
    I run my program from the terminal and get the following:
    Java Code:
    $java RunApplication
    Exception in thread "main" java.lang.NoClassDefFoundError: loaded class RunApplication was in fact named sequence.RunApplication
       at java.lang.VMClassLoader.defineClass(libgcj.so.7)
       at java.lang.ClassLoader.defineClass(libgcj.so.7)
       at java.security.SecureClassLoader.defineClass(libgcj.so.7)
       at java.net.URLClassLoader.findClass(libgcj.so.7)
       at java.lang.ClassLoader.loadClass(libgcj.so.7)
       at java.lang.ClassLoader.loadClass(libgcj.so.7)
       at java.lang.Class.forName(libgcj.so.7)
       at gnu.java.lang.MainThread.run(libgcj.so.7)
    All of my java class files are in the same folder, along with the Clibraries and I have set the library path to said folder.
    I'd read that this error can come from a problem with the classpath, however it should check the folder the executed class is in(or so I have read). So unless I somehow messed that up I don't think it is the issue.

    In case it helps, here is the code of the class I am executing.

    Java Code:
    package sequence;
    
    public class RunApplication {
    	private native static int getAutomorphismGroup(int fw, int[] arr);
    	public static void main(String args[]) {
    		int[] p = {1, 5,12};
    		OfszObject ofz = new OfszObject(p);
    
    		int fw = ofz.getfw();
    
    		int[][] adj = ofz.getadjacencylist();
    		int[] arr = new int[fw*fw];
    		System.out.print(fw+"\n");
    		int c = 0;
    		for (int i=0; i<fw; i++){
    			for (int j=0; j<fw; j++){
    				System.out.print(adj[i][j]+" ");
    				arr[c] = adj[i][j];
    				c++;
    			}
    			System.out.print("\n");
    		}
    		getAutomorphismGroup(fw, arr);
    	}
    	static {
    		System.loadLibrary("NautyWrapper");
    	}
    }
    Thank you very much for any and all help.
    I hope I've followed all the rules :).

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    I have grown frustrated with this error, on win it seems to reduce if one does all the work in My Documents or otherwise as traditionally considered to be home dir. Not the way I would do it but the os wants to prepend home dir info.

    Directed Acyclic or simple edge list?

Similar Threads

  1. Compile Issue
    By CrazyShells Slam in forum New To Java
    Replies: 4
    Last Post: 05-14-2008, 09:51 PM
  2. JFormattedTextField Issue
    By teracomp in forum AWT / Swing
    Replies: 1
    Last Post: 01-21-2008, 07:55 PM
  3. Try Catch issue
    By curtis_fraser in forum Advanced Java
    Replies: 2
    Last Post: 12-14-2007, 12:04 AM
  4. Issue
    By chaitu444 in forum New To Java
    Replies: 2
    Last Post: 11-06-2007, 08:49 PM
  5. compilation issue
    By orchid in forum Eclipse
    Replies: 2
    Last Post: 04-20-2007, 01:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •