Go Back   Velocity Reviews > General Computer Discussion > Software
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
Old 10-17-2007, 02:46 PM   #1
Unhappy how to use resources in jar


hi,
i have a jar file with 2 reosources, when i use the reosources in jar file it's all ok.
If i import the file jar as library and use it in a new file Prova i recive the following message:

ERRORE: '/home/gianni/workspace/Prova/file:/home/gianni/JfuzzyLogicFML.jar!/net/sourceforge/jFuzzyLogic/fml2fcl.xsl (No such file or directory)'.

i have duplicate path and i don't get resources right....

how can do to work right?

public class Resources {

this is the class that manage resources;

public enum ResourceName{
fmlSchema,
xslt,
}

/**
* @uml.property name="properties"
*/
private static final String resourceName[] = new String[]{
"fmlSchema.xsd",
"fml2fcl.xsl"
};

/**
* @uml.property name="singleton"
*/
private static Resources singleton;

/**
* @throws Exception
*/
public static Resources getInstance() throws Exception {
if (singleton == null) {
synchronized (Resources.class) {
if (singleton == null) {
singleton = new Resources();
}
}
}
return singleton;
}

/**
* Constructor
*
* @throws Exception
*/
private Resources(){
mapResources = new HashMap<ResourceName, File>();
}

Map<ResourceName, File> mapResources;

public File getResource(ResourceName name){
File file;

file = mapResources.get(name);
if( file == null ){
file = new File( getClass().getResource(resourceName[name.ordinal()]).getPath());
mapResources.put(name, file);
}

return file;
}

}


and here i s where i use it:
public static FIS loadFML(String fmlFilePath, boolean verbose) throws SAXException {
FMLValidator validator = new FMLValidator();

File xml = new File(fmlFilePath);

File fmlSchema = resources.getResource(Resources.ResourceName.fmlSc hema);


File xslt = resources.getResource(Resources.ResourceName.xslt) ;

validator.validate( xml , fmlSchema.getPath());

String fclDefinition = FML2FCLTransformation.transform( xml , xslt);
System.out.print(xslt);
return createFromString(fclDefinition, verbose);

}


daniele
daniele is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Great dump resources! Starry A+ Certification 0 07-31-2007 04:09 PM
74-134 Exam Books & Resources Yasin MCTS 2 07-13-2007 01:40 PM
Legacy Devices and Reserving Resources Question Bloke_in_a_box A+ Certification 1 05-04-2004 06:52 PM
OT: Free Learning Resources Dom A+ Certification 0 09-12-2003 10:51 AM
a+ files and resources Dave_Dave A+ Certification 0 08-02-2003 06:30 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46