How to use properties file
Hi,
I want to use properties file in my application. I have kept properties file inside a directory called properties which is inside myProject(which is the parent directory of my project) i.e "myProject/properties".
My java file where i want to call this properties file is inside the myProject/WEB-INF/src/java.
How can i call the properties file from myProject/WEB-INF/src/java/PropertyReader.java
I wrote java program in myProject/WEB-INF/src/java/PropertyReader.java like:::::
ResourceBundle resBun = ResourceBundle.getBundle("Test", Locale.getDefault()); // Test.properties is inside myProject/properties
resBun..getString("name");
After running the program i am getting the following errors:::::
Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name Test, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:576)
at PropertiesReader.main(PropertiesReader.java:4)
What is the issue? How to use properties file?
Waiting for reply.
Thanks
Still getting same exception. As you explained i tried like the below:::
1. I am using ant as build tool.
2. My properties file is for database configuration
My properties file is::
database.properties (inside myProject/properties)
JDBCDriver=org.gjt.mm.mysql.Driver
JDBCConnectionURL=jdbc:mysql://pmdbmysql:3306/bandwidthshaper?user=admin&password=admin
My java package structure is
WEB-INF/src/java
WEB-INF/src/classes
For build WEB-INF is the base directory and build.xml is inside the src directory
In my build.xml i wrote the following lines for compilation::
<target name="compile" >
<javac srcdir="src" destdir="src/classes" debug="true" debuglevel="lines,vars,source">
<classpath refid="class.path"/>
</javac>
<copy todir = "src/classes" >
<fileset dir = "../properties" />
</copy>
<jar jarfile="lib/${project.jar.file}" basedir="src/classes"/>
</target>
I am copying properties file to the classes directory.
Now in java file which is inside /WEB-INF/src/java, I wrote::
try {
Properties programProps = new Properties();
InputStream is = getClass().getResourceAsStream("/database.properties");
if(is == null)
throw new IllegalStateException("Properties file missing ");
programProps.load(is);
System.out.println("driver name::::::: "+programProps.getProperty("JDBCDriver"));
is.close();
} catch(Exception e) {
e.printStackTrace();
After compilation in my classes directory i am getting database.properties file and my java file with package.
At the time of running i am getting "java.lang.IllegalStateException: Properties file missing"
Now tell me where is the fault. Why again i am getting exception.
Thanks
Similar Messages
-
How to use .properties files in Webdynpro Java code?
Hi all,
I want to use a logon.properties file when I initial a JCO connection pool in my webdynpro DC (JCO.addClientPool()),but I found when I deployed this DC to the server, it always giv e me an FileNotFoundException. So I donot know how to deploy a .properties file to the server and how to access this file in my Java code?
Thans and Best regards
DeyangHi,
1) put .properties file to your packege under src\packages folder (src\packages\com\sdn\properties\jco.properties)
2) load property:
final InputStream is = getClass().getClassLoader().getResourceAsStream("com/sdn/properties/jco.properties");
final Properties properties = new Properties();
try
properties.load(is);
catch(Exception e)
wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);
Regatds Maxim R. -
How to use property file - sql query define in property file
Hi All,
Anybody please tell me how to use property file.
I have placed sql query in propery file and I have to access this in my file.
well so far this is my code but don't know how to implement in the following ...
pstmt = con.prepareStatement("select * from registration where username=?");
instead of writting the query I want to use the property file.
so far I have developed the following code...
FileInputStream fis = new FileInputStream("querysql.property");
Properties dbProp = new Properties();
dbProp.load(fis);is the code correct... or is there another way to access property file
Please help.
please reply soon....
ThanksBefore answering, check if it's already been done here http://www.jguru.com/forums/view.jsp?EID=1304182
-
How to use batch files to send the load from ODC to UCM?
Hello all.
We're trying to do this along this week and, until now, we couldn't figure out how to use batch files containing metada on ODC and commit the output files to UCM.
So these are our specs:
VM 1
ODC - 10gR3
OS - Windows XP 32 bits SP3
DB - Oracle DB 11.2
VM 2
No ODC
UCM 11.1.1.6
OS - Enterprise Linux Enterprise Linux Server release 5.5 (Carthage)
We've opened a ticket with Oracle Support to know how we should do this. The number is SR 3-6108348211.
Let me try to explain what we want to do:
1 - we have a batch file with all metadata of many files from UCM
2 - we want to use this file in ODC, so the application will convert the images and commit them to UCM
3 - we should see all these files, their metadata, thumbnails and related content in UCM
4 - this is a batch file example we want to send to ODC:
@Properties LocalData
IdcService=CHECKIN_UNIVERSAL
dRevLabel = 1
primaryFile=/tra/Relatorio_UHPF-03-04-2008-M-RL-EA.pdf
dDocName=TRA_33
dDocTitle=UHPF-03-04-2008-M-RL-EA
dSecurityGroup=MAM_TRA
dDocType=Document
dDocAuthor=luis.neotropical
dInDate=14/05/08
xC_CLASSIFICACAO=EA - Educação Ambiental
xC_DATA=01/04/08
xC_DATAVALIDADE=30/04/08
xC_LOCALIZACAOFISICA=N/D
xC_USUARIO_DEP=LUIS FERNANDO DA CAMARA
xC_TIPO=RL - Relatório
xC_USINA=UHPF - USINA HIDRELÉTRICA PASSO FUNDO
xC_FICHA=MAM - Relatorios Ambientais
xC_IDDOCMAN=TRADocID=157
xC_IDANEXODOCMAN=TRAFileID=33
xC_DESTINOINICIAL=Tractebel
xC_ORIGEM=Neotropical
xC_FORMATODOCUMENTO=Digital
xC_GENERODOCUMENTO=
xC_DOCPRINCIPAL=Sim
@end
<<EOD>>
5 - So, when we use this batch file on ODC, the file (or image) will be converted, all metadata attached and then sent to UCM.
But we don't know how to do the link between ODC and UCM. The Oracle Support says it is necessary to do some customization. In the books I could not find any info about how to do, just generic information or how to use ODC.
Is there a way (without customization) to do that? Can anyone give us a step-by-step guide?
Thanks for all help and guidance.
FernandoWhat is the one-sentence requirement or issue you're trying to solve?
If you only want content to be converted to pdf, then you should already have that with your items checked into UCM (if you have IBR enabled).
if you really want to feed content into ODC using a batchfile, my first thought would be to create a transformation utility/app that will convert your batchfiles to the expected ODC import server folder job format. then you'll have to move or map the content to match.
Again, without knowing the exact issue/business requirement you're trying to work through, I'd say a redesign of your ingestion process may be in order.
If you feed content directly into ODC through any supported ODC method (watch folder, email, scanner, fax, etc), then you'll be able to use everything ootb as you'll be able to auto-commit directly into UCM or add an indexing step and manual commit to UCM.
ODC is basically a front end for indexing and extra ingestion options to your content repo.
IPM is basically the same, but it includes some extra process-related details (process metadata, process integrations/bpel/bpm, other system integrations/ebs/crm, etc). I don't feel that IPM would help with the transformation-specific question you've put out there.
-ryan -
How to use XSJS file path in Controller.js file
Hi Experts,
Regarding How to use XSJS file path in Controller.js file.
I have gone through the SAP HANA Extended Application Services (Thomas Jung http://scn.sap.com/community/developer-center/hana/blog/2012/11/29/sap-hana-extended-application-services article.)
Seems to be there is no information about the same. May be the article is targetted for Beginners and above. As I am a learner I am not able to do the same.
var aUrl = '../../logic/demo_main.xsjs? (highlighted)
Suppose my XSJS file is at http://ipaddress:8000/newtest/Func.XSJS.
Can I use like below
var aUrl = 'http://ipaddress:8000/newtest/Func.xsjs?
or
var aUrl = '../../newtest/Func.xsjs?
I tried with multiple options but not able to get the expected output.
Can you please provide more details on this?Dear Thomas,
I am a abap developer , recently we meet a problem on our webdynpro report performnace issue. As in the development, we use SALV_WD_TABLE to design a ALV. and verything work correctly in our DEV system.
But after when our QAS system, there are more records for the ALV, one of them has 21000 records. And in the layout, we have a column as checkbox.
If we click any one checkbox, then the layout will respond almost 1~2 minutes. With debug I found the most time cost in the standard program.
And with search I found that you have solution to solve it as 1,000,000 rows.
So is it possible to provide some idea or solution to us?
Many thanks for your help!
BR
Vincent Chen -
How to use XML file as a source in BODS?
How to use XML file as a source in BODS?
Could anyone please help me out for this?exmpale XML file :
<?xml version="1.0" encoding="utf-8"?>
<MM_RECON_REPORT>
<RPT_DATE>str1234</RPT_DATE>
<RPT_ROW>
<SRC_EXT_REC_COUNT>123.45</SRC_EXT_REC_COUNT>
<PRE_TRANS_REC_COUNT>123.45</PRE_TRANS_REC_COUNT>
<POST_TRANS_REC_COUNT>123.45</POST_TRANS_REC_COUNT>
<PASS_BAPI_REC_COUNT>123.45</PASS_BAPI_REC_COUNT>
<TOT_SAP_RETURN>123.45</TOT_SAP_RETURN>
<TOT_SAP_SUCC_REC_COUNT>123.45</TOT_SAP_SUCC_REC_COUNT>
<PARTIAL_SUCC_REC_COUNT>123.45</PARTIAL_SUCC_REC_COUNT>
<TOT_SAP_ERR_REC_COUNT>123.45</TOT_SAP_ERR_REC_COUNT>
<MM_SUCC_REC_COUNT>123.45</MM_SUCC_REC_COUNT>
<MM_ERR_REC_COUNT>123.45</MM_ERR_REC_COUNT>
<CLS_SUCC_REC_COUNT>123.45</CLS_SUCC_REC_COUNT>
<CLS_ERR_REC_COUNT>123.45</CLS_ERR_REC_COUNT>
<CP_SUCC_REC_COUNT>123.45</CP_SUCC_REC_COUNT>
<CP_ERR_REC_COUNT>123.45</CP_ERR_REC_COUNT>
<VMS_SUCC_REC_COUNT>123.45</VMS_SUCC_REC_COUNT>
<VMS_ERR_REC_COUNT>123.45</VMS_ERR_REC_COUNT>
<SOURCE_TYPE>str1234</SOURCE_TYPE>
<RUN_ID>123.45</RUN_ID>
<RUN_SEQ>123.45</RUN_SEQ>
<RUN_DATE>2012-12-13</RUN_DATE>
</RPT_ROW>
</MM_RECON_REPORT>
example XSD file :
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">
XML Schema generated by Data Services
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType name="DIType-decimal-28-0">
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="28"/>
<xsd:fractionDigits value="0"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DIType-varchar-200">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="200"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DIType-varchar-10">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DATE">
<xsd:restriction base="xsd:date">
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="MM_RECON_REPORT" >
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="RPT_DATE" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="RPT_ROW" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="RPT_DATE" type = "DIType-varchar-200"/>
<xsd:element name="RPT_ROW" >
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="SRC_EXT_REC_COUNT" />
<xsd:element ref="PRE_TRANS_REC_COUNT" />
<xsd:element ref="POST_TRANS_REC_COUNT" />
<xsd:element ref="PASS_BAPI_REC_COUNT" />
<xsd:element ref="TOT_SAP_RETURN" />
<xsd:element ref="TOT_SAP_SUCC_REC_COUNT" />
<xsd:element ref="PARTIAL_SUCC_REC_COUNT" />
<xsd:element ref="TOT_SAP_ERR_REC_COUNT" />
<xsd:element ref="MM_SUCC_REC_COUNT" />
<xsd:element ref="MM_ERR_REC_COUNT" />
<xsd:element ref="CLS_SUCC_REC_COUNT" />
<xsd:element ref="CLS_ERR_REC_COUNT" />
<xsd:element ref="CP_SUCC_REC_COUNT" />
<xsd:element ref="CP_ERR_REC_COUNT" />
<xsd:element ref="VMS_SUCC_REC_COUNT" />
<xsd:element ref="VMS_ERR_REC_COUNT" />
<xsd:element ref="SOURCE_TYPE" />
<xsd:element ref="RUN_ID" />
<xsd:element ref="RUN_SEQ" />
<xsd:element ref="RUN_DATE" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SRC_EXT_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="PRE_TRANS_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="POST_TRANS_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="PASS_BAPI_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="TOT_SAP_RETURN" type = "DIType-decimal-28-0"/>
<xsd:element name="TOT_SAP_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="PARTIAL_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="TOT_SAP_ERR_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="MM_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="MM_ERR_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="CLS_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="CLS_ERR_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="CP_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="CP_ERR_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="VMS_SUCC_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="VMS_ERR_REC_COUNT" type = "DIType-decimal-28-0"/>
<xsd:element name="SOURCE_TYPE" type = "DIType-varchar-10"/>
<xsd:element name="RUN_ID" type = "DIType-decimal-28-0"/>
<xsd:element name="RUN_SEQ" type = "DIType-decimal-28-0"/>
<xsd:element name="RUN_DATE" type = "xsd:date"/>
</xsd:schema>
compare the xml vs xsd for better understanding -
Its urgent how to use calss file of jar located in lib folder
how to use calss file of jar located in lib folder.
i want to use RowSetDynaClass class which is in beanutil jar file which is in my lib folder .if i use that class in my jsp following error is coming.
Class RowSetDynaClass not found.
RowSetDynaClass resultSet = new RowSetDynaClass(rs, false);
how to access class in jar file.
please helpYou have to either refer to the class in its fully quallified name, or import it into the JSP:
<%
some.full.packagename.RowSetDynaClass resultSet = new some.full.packagename.RowSetDynaClass(rs,false);
...-or-
<%@ page import="some.full.packagename.RowSetDynaClass" %>
<%
RowSetDynaClass resultSet = new RowSetDynaClass(rs, false);
...As long as the class has public visibility and you have re-started the server/servlet context since you added the JAR. -
How to Use PHP Files and .tpl files
I have taken a course and it includes a resource section with templates that I can use. These templates are squeeze page ones and inside the folder are index.php, config.php and a whole lot of .tpl files that open up in empty Stickies on my Mac.
Can someone explain how to use these files. When I open them in Dreamweaver I see code related to the php files but I can't browse the index.php file in a browser to see what the so called sqeeze page looks like.
Yikes I'm really lost here.
thanks
JohnORA-06401, 00000, "NETCMN: invalid driver designator"
Cause: The login (connect) string contains an invalid driver designator.
Action: Correct the string and re-submit.
The //ip:port/sid connect string will only work with 10g clients.
Check your tnsnames.ora file. Does the file have control characters or missing carriage-return characters ? (Maybe you ftp'd the file from a unix box ?)
I would suggest that you create a new tnsnames.ora - hand edit it (don't copy the old one). If you have sqlplus client - try using it to connect to the remote DB first.
The instructions for connection to a local or remote DB are all the same (when using plain OCILogon) because the connection is made over TCP. -
How to use usb files on ipad mini
how to use usb files on ipad mini
If you're trying to read files off a USB drive onto an iPad, it really doesn't work. The iPad can read specifically named photo and video files off SOME USB drives, but cannot read documents or music or other kinds of files. And there is zero support to write info from the ipad onto any USB device
-
hi master
sir i forget my sun application server password
sombody give me idea i use my master-password file
please give me idea how i use bainary file
thanks
aamirhi master
sir i forget my sun application server password
sombody give me idea i use my master-password file
please give me idea how i use bainary file If that sun application server is any smart it would store those passwords
one way encrypted so those binary files aren't really of any use.
And, as everybody knows you should stick your passwords at the back
of your keyboard scribbled on a little yellow note ;-)
kind regards,
Jos -
How to use swf file for Spark Skin
Hi all
I have little confuse about how to use swf file with Spark Skin,
in Flex3 , i use Flex Skin Design Extension for Flash to deal with skin ,
so basically , I just create a swf file and import to the project , then everything is ok
but , seem that not working in flex4 , spark skin.
1` I can't find the Flex Skin Design for the FlashCs4
2` I try to use FlashCs3 version to import the skin art to the project , but seemed not working.
3` I Google and check the Flex4 Help , seemed Spak skin need the Skin-Class , which I don't know how to use that with swf file
what I have searched is how to use FXG , or some jpg file in that skin class, none of them are use swf file.
so , is there any way that let user use the swf file to deal with the skin?
is the Flex Skin Design can use in Flex4?
ThanksHello,
I'm new to Flex, but have come to it from Flash Pro. I'd like to know the same thing. I think I found the answer here:
http://www.flashallys.com/blog/spark-button-skinning-with-flash-symbols/
However my question is now: Is this a good approach to use?
99% of the googling I've done tells me to skin components with fxg files. I've tried that by creating graphics and exporting from flash, but using swfs containing lots of graphics is much faster so I'd rather use that.
The other thing I've done is to create custom components using these helpful tutorials:
Creating component in flash:
http://www.webkitchen.be/2008/12/12/video-tutorial-make-flex-components-with-flash-cs4/
Dealing with Resizing with method overrides for your flash component:
http://www.psyked.co.uk/flex/creating-flex-components-the-easy-way-for-flash-ide-converts. htm
This allows me the flexibility of Flash Pro design with the layout, transistions, data binding etc from Flex.
So my question is: Is this approach (skinning spark components with swfs, and using custom swc components made in flash) a bad idea for any reason? E.g. does it create slow mobile apps?
Cheers
Chris -
Hi i read about properties file in java .. i didn't get much more..
how can we use this in program.. what is the benefit..
anyone know any examples in site.please let me know about thatint count=getGoogleSearchCount();
public int getGoogleSearchCount(){
search keyword="http://www.google.co.ke/search?hl=en&q=java+properties+class&btnG=Google+Search";
// missing code
return count;
System.out.println(count);i ran the above code snipplet and guess the output?
291,000 results.
DONT BE LAZY. -
How to read multiple files at multiple locations using properties file
hi all ,
in my code i take configuration input from a properties file ,it was really easy but what if there are multiple files ? how can i take configuration input (file path etc) from properties file in that case ? any suggestion ?thanks :) ..i am doing like this :
String fName[]=new String[10];
String choice[]=new String[10];
String Delim[]=new String[10];
ResourceBundle a = ResourceBundle.getBundle("input");
String n=a.getString("NOF");
try
for(int i=0;i<Integer.parseInt(n);i++)
fName=a.getString("PATH"+(i+1));
choice[i]=a.getString("HEADER"+(i+1));
Delim[i]=a.getString("DELIMITER"+(i+1));
putData(fName[i],choice[i],Delim[i]);//to put data in database
catch (NumberFormatException e)
System.out.println("Number of files are invalid");
hope this method would be fine ....again thanks for the advice :) :) -
How can load properties file for one time and use in entire application
Hi folks,
I dont want to read properties file every time , and want to get property value in any servelet or jsp page.(means i want to read only property file only for once and want to get value in any where ) , how to do this.
Message was edited by:
RajeshwarReddyTmeans we have to read file every time Know but i dont
want to be happen that ??? No you don't . You read the file once. You store it in the hashmap. Then you hand that hashmap to whatever class needing the data.
getProperties() returns the hashmap, doesn't read the file.
Maybe I should have called the method getMap or something.
Message was edited by:
karma-9 -
Using .properties file in web dynpro
Hi,
I am having a requirement. I have to create a .properties file and I have to use it in my web dynpro application. How can I do that? Any help...
Thanks & Regards,
RajHi,
Go to the navigator view...select src\Components\<ComponentName> and create create a .properties file.
You can read the configuration file in your webdynpro app as follows
IWDConfiguration configuration =
WDConfiguration.getConfigurationByName(
wdComponentAPI.getDeployableObjectPart(),
"<<>>");
http://help.sap.com/saphelp_nw04/helpdata/en/b8/aa343e32ff1033e10000000a114084/frameset.htm
Regards, Anilkumar
Message was edited by:
Anilkumar Vippagunta
Maybe you are looking for
-
PGI status at delivery header level has not updated
Dear Friends, We had created deliver, picking was completed and PGI was completed successfully. However when we try to create Billing, an error occurs stating that PGI is not completed. Further when we check the delivery, the Goods Issue status at it
-
Testing RFC without Executing RFC in SAP R/3
Hi All, Is it possible to test a sender RFC adapter to invoke Web service in SAP XI without executing RFC in R/3. I am facing problems when executing RFC in R/3. So would like to confirm that the other portion ie, from XI to Webservice is working fin
-
In SPROXY transaction ,the inbound interface is showing inactive.
HI i am having a proxy interface from PI to ECC. I made some changes to the structur of the message type in PI Repository , and in sproxy i regenerated the proxy and saved , but when i activate it it is getting activated but showing inactive at the
-
RFC comunication channel performance
Hi All, My clients business will have inflow of huge messages and frequency is also more , As far as the performnace is concerned while using RFC lookups .which one of the below options is better while performance tuning ?. 1. Creating RFC communic
-
Duplicate Files Question - Need Expert Advice . . .
I have completed my transition from PC to Mac and have all of my files running on my MacBook Pro. I have synced my iPod Classic to iTunes and have noticed that when I click on "Music" from the iTunes Library the number of files at the bottom states "