0

I have a program which is located in

say

$A430CLASS/com.airbus.adcsip.batch.GlobalReportBatch

$A430CLASS is the path where my class file is present.

i want to run it through shell script so i entered following command :

java -classpath $A430CLASS/com.airbus.adcsip.batch.GlobalReportBatch $A430CONF/batch.properties

$A430CONF is the path where the batch.properties file is present. GlobalReportBatch is my class file name As you can see i want to pass this batch.properties file as argument to my java program. but when i run my script it tries to replace "." in batch.props file to "/" it gives me NoClassDefFound error.

7
  • I tried using quotes.. but no luck... same error.. :( Commented Oct 3, 2012 at 13:44
  • 3
    I don't see a classpath actually in your statement above. Commented Oct 3, 2012 at 13:46
  • Separate the classes in classpath by a semi-colon ; Commented Oct 3, 2012 at 13:46
  • what if, java -classpath . $A430CLASS/com.airbus.adcsip.batch.GlobalReportBatch $A430CONF/batch.properties Commented Oct 3, 2012 at 13:47
  • Hovercraft is right : "$A430CLASS/com.airbus.adcsip.batch.GlobalReportBatch" is interpreted as the classpath and that's while the last argument is interpreted as the class. Commented Oct 3, 2012 at 13:47

1 Answer 1

4

What you put after the -classpath option must be a list of directories and JAR files, separated by : (on Unix-like operating systems) or ; (on Windows).

Look at what you are passing:

-classpath $A430CLASS/com.airbus.adcsip.batch.GlobalReportBatch

Remove the slash / between $A430CLASS and your class name; replace it by a space:

-classpath $A430CLASS com.airbus.adcsip.batch.GlobalReportBatch

So the entire line becomes:

java -classpath $A430CLASS com.airbus.adcsip.batch.GlobalReportBatch $A430CONF/batch.properties
Sign up to request clarification or add additional context in comments.

13 Comments

actually $A430CLASS and com....GlobalReportBatch is related.. consider $A430CLASS as my home directory... so is your syntax right?
@Datta: again you've not told us your package structure yet.
my class file is in $A430CLASS/com/airbus/adcsip/batch/ where my class GlobalReportBatch is located... $A430CLASS - is my variable set to some xyz path so it becomes xyz path/com/airbus/.....
@Datta: but again, please tell us what is the package structure? I'm not sure how to ask this any clearer sort of way. What is on the package statement at the top of your java file?
@DattaprasadPatil Try @Jesper answer: java -classpath $A430CLASS com.airbus.adcsip.batch.GlobalReportBatch $A430CONF/batch.properties It should work.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.