1

I am trying to run program from command prompt

Here is my director structure

directory structure

In the classes directory i have this structure

Classes Directory

In the email folder i have two properties file general-mail-settings.properties and customer-mail-settings.properties

Now when i run the command

D:\vintnes\lasses>java -cp ".;..\dependency-jars\*"  com/softech/ls360/integration/BatchImport vintners

Then i get the error that

java.lang.Exception: Email Properties File not found: src\main\resources\email\general-mail-settings.properties (The system cannot find the path specified)
    at 
...

I tried this to specify path

java -cp ".;..\dependency-jars\*;.\email\*.*"  com/softech/ls360/integration/BatchImport customer

But still i am getting the error. I tried ;email\* and \email\*, but still i am getting the error. How can i specify path so program get run?

Thanks

1
  • You specific directories and JARs in class pathes, not individual resources as such. If you want to include a resource, add the base directory for the file. Your error message suggest it is looking for src\main\resources\email\general-mail-settings.properties relative to the current working directory. Commented Aug 13, 2013 at 12:30

1 Answer 1

1

You put a path to src/main/resources in your code somewhere. This is a directory used by Maven builds to hold "resource" files (files that aren't code but that should be copied into the finished artifact, like configuration files or media). The contents of src/main/resources are copied directly into the root of the artifact as-is, so in this case, the email directory is copied straight into your classes directory. Remove the src/main/resources part of the path from your properties lookup.

Sign up to request clarification or add additional context in comments.

1 Comment

In the code i am doing something like this ResourceBundle rb = ResourceBundle.getBundle("email/general-mail-settings"); By default maven uses src/main/recources/ so i just specify email/general-mail-settings. Now what should i do ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.