0

I am using CLIPSJNI.

What I have is:

Environment clips = new Environment();
clips.load("main.clp");

where main.clp is put in the same level as src and bin folder.

This runs fine in Eclipse. However when I export to JAR. It cannot work.

I understand that there are some problems with the path when we export to JAR. So I've seen people suggesting using this.getClass().getResourceStream() but this is not the case. Because what I need is the name of the file, not its content.

Any suggestions on how to fix this?

1 Answers1

0

The issue is that the load is being done within the native library on the C side which is being passed a file name as an argument. The C code has no concept of a JAR file or how to extract files embedded within one. I think what you would need to do is always place your .clp files within the JAR file and then have a routine which extracts the data from the JAR file and saves it to a file. You can then load it using the load method and delete the file once done.

Gary Riley
  • 10,130
  • 2
  • 19
  • 34