Is it possible to load attributes files from inside the jar file in a plugin?

I tried the following:

   1 String attrs[] = new String[2];
   2 attrs[0] = getClass().getResource("/file1.txt").toString();
   3 attrs[1] = getClass().getResource("/file2.txt").toString();
   4 Cytoscape.loadAttributes(attrs, null);
   5 

but I got an exception:

java.io.FileNotFoundException: jar:file:plugins/test.jar!/file1.txt(No
such file or directory)

and in my plugin:

$ jar tvf test.jar
    25 Thu Jul 14 11:13:20 CEST 2005 META-INF/MANIFEST.MF
  1974 Thu Jul 14 11:11:14 CEST 2005 csplugins/test/TestPlugin.class
  88501 Thu Jul 14 10:59:00 CEST 2005 file1.txt
226650 Thu Jul 14 10:59:00 CEST 2005 file2.txt 

LoadAttributesFilesInsideJar (last edited 2009-02-12 01:03:38 by localhost)

MoinMoin Appliance - Powered by TurnKey Linux