Loading properties files inside Operations classes
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 83
- Joined: Wed May 20, 2009 1:18 pm
Loading properties files inside Operations classes
Hi,
I am attempting to load a properties file from inside an Operation class.
My operation is packaged inside a jar file 'acm.jar', the Operation I have loads the properties file as follows:
I have tried deplying the properties file in two ways:
1. In the root of the acm.jar file
2. Inside the ACM framework folder, and then explicity adding the properties file to the classpath of the framework inside the 'Document Type Associations->Classpath' area.
Neither of these work, I just get a null pointer when loading the file.
Any ideas?
Simon.
I am attempting to load a properties file from inside an Operation class.
My operation is packaged inside a jar file 'acm.jar', the Operation I have loads the properties file as follows:
Code: Select all
Properties properties = new Properties(); properties.load(ClassLoader.getSystemResourceAsStream("CaseLinkOperation.properties"));
LCR_TOOL_USERNAME = (String)properties.get(LCR_TOOL_USERNAME_KEY);
LCR_TOOL_PASSWORD = (String)properties.get(LCR_TOOL_PASSWORD_KEY);
1. In the root of the acm.jar file
2. Inside the ACM framework folder, and then explicity adding the properties file to the classpath of the framework inside the 'Document Type Associations->Classpath' area.
Neither of these work, I just get a null pointer when loading the file.
Any ideas?
Simon.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Loading properties files inside Operations classes
Post by sorin_ristache »
Hello,
Regards,
Sorin
Your jar file is not loaded in Author by the system class loader. Use getClass().getClassLoader().getResourceAsStream("CaseLinkOperation.properties") instead of the system class loader.sijomon wrote:Code: Select all
Properties properties = new Properties(); properties.load(ClassLoader.getSystemResourceAsStream("CaseLinkOperation.properties"));
This option works too but you have to add to the framework classpath the folder that contains the file CaseLinkOperation.properties, not the file CaseLinkOperation.properties.sijomon wrote:2. Inside the ACM framework folder, and then explicity adding the properties file to the classpath of the framework inside the 'Document Type Associations->Classpath' area.
Regards,
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service