Passing properties file to java

I have this program that I want to accept a propertie file like thid
    public static void main(String args[]){
         CrsCodeGenerator codegen;
        if(args.length>=1)
            codegen = new CrsCodeGenerator(args[0]);
        else
            codegen = null;
        when I do
java CrsCodeGenerator farouk.propertiesi get
java.lang.NoClassDefFoundError: farouk/properties
Exception in thread "main"
Java Result: 1How should i do it?

gcameo wrote:
that is all that shows in NetbeansI really doubt that you are trying to launch CrsCodeGenerator in that case. Since it looks like you are trying to launch the class farouk.properties
Kaj

Similar Messages

  • Passing properties file to portal

    Hi experts,
    I have one application which was built on PDK. I have one properties file which holds connection information of backend. now how can i pass these properties file to portal. In webdynpro java, we can achieve this using application parameters. but in PDK which procedure we have to follow?
    one more question is, For PDK applications creating the system object is mandatory or optional?. if mandatory how can we do that one for PDK application?
    Regards
    maha

    Hi,
    If it is a AbstractPortalComponent, DynPage or JSPDynPage you can put the information in the portalapp.xml file of the project into the component profile-section for example:
        <component-profile>
            <property name="z.system" value="R3_SYSTEM"/>
            <property name="z.debugMode" value="false"/>
        </component-profile>
    See [http://help.sap.com/saphelp_nw70/helpdata/en/c9/c8af42a6f6cb6ae10000000a155106/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/en/c9/c8af42a6f6cb6ae10000000a155106/frameset.htm] for more info about portalapp.xml.
    Then in code you access the values:
    String system = request.getComponentContext().getProfile().getProperty("z.system");
    The properties are visible in iview properties in Content Administration -> PortalContent -> [iview properties] - here you can change them.
    Hope that helps,
    Romano

  • Accessing .properties file from java code

    Hi,
    I want my java code in a Tomcat Web Application to access values in a custom .properties file.How can i do it.
    Any sample code / suggestions welcome.
    Thanks
    Vignesh.

    ResourceBundle vResourceBundle = ResourceBundle.getBundle("database", Locale.ENGLISH);
            sDriverName = vResourceBundle.getString("database.DriverName");
            sDbURL = vResourceBundle.getString("database.DriverUrl");
            sDbUser = vResourceBundle.getString("database.UserName");
            sDbPasswd = vResourceBundle.getString("database.PassWord");Where "database" is the name of the property file. ie., database.properties.
    the content of the database.properties file
    # Properties to access dabase                 
    database.UserName = scott
    database.PassWord = tiger
    database.DriverName = oracle.jdbc.driver.OracleDriver
    database.DriverUrl = jdbc:oracle:thin:@nn.nn.nn.nn:port:orartgnull

  • Configure properties file that java file uses in OSB.

    I have a jar file consisting of java files which maintain the session id in the queue. One main jar depends on 3 more jars for logging.
    Also java files in the jar depends on the *.properties file to read the queue length dynamically.
    I need to access the main jar from osb proxy server. I used java callout to access the java method provided in the main jar.
    My question is: where should I place *.properties which is used by java class, in the osb folder. I don't see how I can add *.properties in the osb console.
    Your timely help is greatly appreciated.

    sudheshna wrote:
    another java class which loads property file...I'm understanding that you don't have way to modify this +"another java class"+, but you have to figure out what strategy it uses to pick up the properties file... classpath? environment variable? absolute path? relative path?
    If the file needs to be on the classpath (a common strategy) then you can just place the it in %DOMAIN_HOME%\config\soa-infra... This one is usually in the classpath... Other option is to change setDomainEnv.cmd(setDomainEnv.sh) to add a directory to the classpath and place the file there...
    Hope this helps...
    Cheers,
    Vlad

  • Unable to read Properties file from Java code

    Hi,
    The directory structure of my application is as follows:-
    My App
    ++++++ src
    ++++++++com
    ++++++++++readProp.java
    ++++++++resource
    ++++++++++message.properties
    I am trying to read the file as follows:-
    <code>
    public Static final string FilePath="resource.message.properties"
    Here the code to read the file. I tried using the following two techniques but to no use... :(
    File accountPropertiesFile = new File(FacesContext.getCurrentInstance()
    .getExternalContext().getRequestContextPath()
    + FilePath);
    properties.load(externalContext.getResourceAsStream(FilePath));
    </code>
    But none yeild any sucess while reading through the Bean class. please help...

    Your source code isn't there at run time, at least it shouldn't be, so the directory structure you've shown is irrelevant.
    If the file is in the corresponding position under WEB-INF/classes at runtime, the second technique should work, but you need to fix FilePath to agree with what it says under Class.getResource() and friends.

  • How to load Java properties file dynamically using weblogic server

    Hi,
    We are using Java properties file in Java code. Properties in java properties file are frequently modified. If I keep these properties file in project classpath or as part of war, I will have to redeploy application after each change.
    We are using Weblogic Server.
    Can you please suggest me how can this properties file be loaded at weblogic server startup. Then in that case, how to refer property file in Java code?
    What is the best practice for this?
    Thanks,
    Parshant

    Another alternative is, keep the property file in any pre-defined location. Write a class which reads the properties from the file and returns the one which is requested by caller and deploy this class. Whenever you have to change the properties just update the property file on server and next call to fetch the property should return the updated one.
    Downside of this approach is file I/O everytime. To overcome that you can actually "cache" the properties in a hashmap. Basically when any property if requested, first check the hashmap, if not found then only read from property file and also update in hash map. Next time same property will be returned from hash map itself. The hash map will be cleared at every server restart since its in the memory. You will also need to build a method to clear the hashmap when you update the values in the property file on server.
    This solution would be suitable for small size files and when network overhead of calling a DB needs to be avoided.

  • How to read properties file(key-value) in OSB?

    Hi
    I have a scenario in which I have to read some properties(key-value) from a file. Earlier whole code was developed in java and its easy to read properties file in java.
    But now need to implement this in OSB and performance is very critical in this project.
    I followed DVM approached defined in
    http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html and http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html
    But it did not work. I have hundreds of properties(key-value pairs) to read and need pass them to the business service along with input of proxy service.
    What is the best approach for this (Can not go for db call as performance is very critical)?
    Thanks
    Vibhor

    $DVM= <dvm      name="InterfaceProperties" xmlns:ns1="http://xmlns.oracle.com/dvm" xmlns="http://xmlns.oracle.com/dvm">
         <columns>
         <column      name="PROPERTY_KEY" qualifier="false" order="1"/>
         <column      name="PROPERTY_VALUE" qualifier="false" order="1"/>
         </columns>
         <rows>
         <row>
         <cell>dealer.locate.default.buypower.link</cell>
         <cell>http://www.xyz.com</cell>
         </row>
         <row>
         <cell>dealer.locate.default.unitOfMeasure</cell>
         <cell>MILES</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.nu</cell>
         <cell>Nurun</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.bu</cell>
         <cell>Buick</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.ca</cell>
         <cell>Cadillac</cell>
         </row>
    </rows>
    </dvm>
    XPATH is- ns1:dvm/ns1:rows[1]/ns1:row[1]/ns1:cell[1]/text()
    If I run this xpath in Jdeveloper,its giving me proper output.
    Please this as CQuery resource and try to run this xpath on OSB console.
    Thanks
    Vibhor
    Edited by: Vibhor Rastogi on Sep 21, 2010 4:59 AM

  • How use properties file

    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 that

    int 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.

  • Specifying a path to loada properties file

    I'm trying to load a properties file in java, the properties file is located in
    META-INF/sample.properties
    the class that loads the properties is in
    WEB-INF/classes/com/pkg1/pkg2/pkg3/pkg4/samplepgm.java
    how do I specify the path to load the properties file...

    you can only add images by using the place-function
    so you need to address the rectangle where the image is placed in.
    you can use use scriptlabels and then you can use something in the terms of
    document.Rectangles.Item("image").place(linktoyourfile)

  • Usage of Properties files

    Friends, What are the uses and in which context we use the properties files like .txt or .properties files in java technologies?

    now i explain : wherever we need text content it might change often
    or in future we put that message (or)text in the Properties files .in future if we need to modify the view (or)user name login we may easily change in this file.

  • Help on properties file

    I am writing following code to read parameters from properties file (using java.util.properties) but it does not give any output. Please help ASAP.
    CODE::
    FileInputStream propFile = new FileInputStream("cont.properties");
              String dbUrl = "";
    Properties props = new Properties();
    props.load(propFile);
         props.getProperty("DatabaseUrl",dbUrl);
         System.out.println("DatabaseUrl = " + dbUrl);

    I am finding one probelm.
    it seems your property file contents is
    dbUrl="1.2.3.4"; but it should be
    DatabaseUrl="1.2.3.4";
    Try this out.
    Code is :
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Properties;
    public class Test {
         public Test() {
         public static void main(String args[])
              try {
                   FileInputStream fis = new FileInputStream("temp.prop");
                   String dbUrl = "";
                   Properties prop = new Properties();
                   prop.load(fis);
                   dbUrl = prop.getProperty("DatabaseUrl",dbUrl);
                   System.out.println("DatabaseUrl="+dbUrl);
              } catch (FileNotFoundException e) {
                   System.out.println("file not found");
              } catch (IOException e) {
                   System.out.println("ioexception");

  • Passing Arguments/Properties File to SUN JAVA ONE WEBSERVER at startup

    We are porting a Java App currently running on an Orion Web Server to Sun Java One Web Sever.
    We have found that with the various java application servers we've used over the years, that each want to find the properties file in a different spot. They way we've got around this is that we start Orion with a -D option to java to set a system property called cdsProps. Example: java -DcdsProps=Path_to_properties_file. We then reference that cdsProps arugment throughout the java code so it knows where to find the properties file. Because the cdsProps argument is used thoughout the java code, if the -D option is not used when starting the webserver to point to the properties file, the website will not function properly.

    in the case above, the command line arguments are passed in the aaaaaaaaaaaaaaaaaaaaaaarggggggggggs array
    you probably want aaaaaaaaaaaaaaaaaaaaaaarggggggggggs[0] for the filenameAm not sure i understand, do you mean i must change the param of the main method to String[] args[0] as this resulted in error when i did so. Or do you mean at command line instead file simply being passed to the Compressor program as
    "java Compressor < examplefilename"
    It has to be "java Compressor < examplefilename[0]" ?
    If you could expand on this, would be grateful,
    Thanks.

  • Reading a properties file in a servlet and passing its contents to a JSP pa

    Hi all,
    I'm totally new to Servlet pgmg n JSP. Please can ne1 tell how to read a simple properties file (in a servlet) and pass its contents to a JSP page.Actually the reason is to fill a combo box in a JSP page with the contents of a properties file.If calling a servlet for the same is d best way to do that, plz can ne1 tell me :
    1> whether to override the doPost method in the servlet in which to read d file using FileInputStream
    2> Putting the contents in an array and then how to pass this array to the JSP page.
    Thanks,
    deepthy.

    I'm using a properties file to let my web application know what the name of the database is. I'm using an abstract class GeneralDao which will be extended by all the DAO's (Data Access Objects or java classes containing SQL statements).
    Here's the code :
    protected Connection getDatabaseConnection()
              throws Melding
         Connection dbconn = null;     
         ResourceBundle resBundle;
         try
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         resBundle = ResourceBundle.getBundle("gcoConfig");
         String dbConnectie = resBundle.getString("databaseconnection");
         gcoLogger.debug("lezen databaseconnection in resourceBundle " );
         dbconn = DriverManager.getConnection(dbConnectie);
         } catch (InstantiationException exc)The ResourceBundle is used to read the properties file, named gcoConfig.properties.
    With the getString() command I read the content of the string named databaseconnection.
    The gcoConfig.properties file is placed inside the folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco\WEB-INF\classes
    The GeneralDao is placed in the folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco\WEB-INF\classes\org\gertcuppens\cluifDao.
    So this class is placed some folder below the WEB-INF\classes folder of gcoConfig.properties.
    And the content of the properties file is just one line :
    databaseconnection=jdbc:mysql://localhost/cluif
    If you want to let the JSP know what's inside the properties file, wrap the content in a Javabean, put it in the request or even the session and pass the control to the JSP.

  • How to call a java method so I can pass a file into the method

    I want to pass a file into a java method method from the main method. Can anyone give me some help as to how I pass the file into the method - do I pass the file name ? are there any special points I need to put in the methods signature etc ?
    FileReader file = new FileReader("Scores");
    BufferedReader infile = new BufferedReader(file);
    Where am I supposed to put the above text - in the main method or the one I want to pass the file into to?
    Thanks

    It's a matter of personal preference really. I would encapsulate all of the file-parsing logic in a separate class that implements an interface so that if in the future you want to start taking the integers from another source, e.g. a db, you wouldn't need to drastically alter your main application code. Probably something like this, (with an assumption that the numbers are delimited by a comma and a realisation that my file-handling routine sucks):
    public class MyApp{
    public static void main(String[] args){
    IntegerGather g = new FileIntegerGatherer();
    Integer[] result = g.getIntegers(args[0]);
    public interface IntegerGatherer{
    public Integer[] getIntegers(String location);
    import java.io.*;
    public class FileIntegerGatherer implements IntegerGatherer{
    public Integer[] getIntegers(String location){
    FileInputStream fs=null;
    try{
    File f = new File(location);
    fs = new FileInputStream(f);
    byte[] in = new byte[1024];
    StringBuffer sb = new StringBuffer();
    while((fs.read(in))!=-1){
    sb.append(new String(in));
    StringTokenizer st = new StringTokenizer(sb.toString(),",");
    Integer[] result = new Integer[st.countTokens()];
    int count = 0;
    while(st.hasMoreTokens()){
    result[count]=Integer.valueOf(st.nextToken());
    count++;
    catch(IOException e){
    //something sensible here
    finally{
    if(fs!=null){
    try{
    fs.close();
    catch(IOException f){
    return result;
    Once compiled you could invoke it as java MyApp c:\myInts.txt
    Sorry if there are typos in there, I don't have an ide open ;->

  • Static lookup lists:read data from a Java *.properties file

    Hi
    i need to make static lookup lists i am using read data from a Java *.properties file
    i am using the Class "PropertyFileBasedLookupViewObjectImpl" that wrote by Steve Muench in ToyStore.
    but i need to use the default language for that i update the loadDataFromPropertiesFile()
    method to find the correct properties file
    String temp=Locale.getDefault().getLanguage();
    String propertyFile =
    getViewDef().getFullName().replace('.', '/')+"_"+temp+ ".properties";
    the problem:
    For English(TEST_en.properties) it is good and working
    For Arabic(TEST_ar.properties) read from correct file _ar.properties
    but the dispaly character is wrong
    When Debug
    In the File 1=&#1583;&#1605;&#1588;&#1602;
    In debug 1=/u32423

    Depending on your use case you can either use a programmatic VO or directly expose the JV class as a data control.
    http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_36/jdtut_11r2_36.html

Maybe you are looking for

  • Profit Center on Vendor Line Item - When other line item is Bank

    Dear Experts, We have a peculiar problem here.  Recently we went live with SAP ECC6.0.  On the date of migration one cheque was issued to a Vendor who did not presented the same into Bank.  The Cheque is now expired and we need to pass an entry into

  • Making a pdf file from pdf documents in preview

    Many times I get a .pdf from online & when I open it, there are many pages attached with it & I can scroll through it. Is there a way on the macbook to compile pdf pages and make them into a pdf document like this in preview. I've looked & don't see

  • My tutors won't help me with my assignment plz help!!

    im trying to build a website and im struggling with the flare bit i put in my original plan. the plan s for two turntables with a mixer in the mddle to act as a navagation bar. I want to make the mixer so when the user rolls over the "home" button th

  • Activating New GL & Doc Splitting

    Hi Can anyone suggest me a solution: We are working in ECC 6.0, New GL & Doc Splitting is not acvtivated. We are already in Production, can I activate it now, if not what is the procedure. We are just 3 months after live. SAP suggests a migration pro

  • The art of preloading.

    I would like to ask the experts how can I make a preloader along with how to preload my webpage too. I've searched many websites but they have complicated demos with outdated files to use so it's impossible for me to make one. I was thinking for some