Reputation: 461
We know that we use the below for setting classpath for java execution from UNIX. This will work for ading all the jar files to classpath.
java -cp ..jars/* MainClass
But if I want to add an xml file to classpath, what should I do? I tried the below and it is not working.
java -cp ..jars/*:../resources/abc.xml MainClass
In eclipse, to do the same thing, I just have to right click the resources folder and select "Use as Source Folder".
Can you please help?
Upvotes: 3
Views: 2576
Reputation: 139
You don't need to add the xml file name to the classpath. Just add the path to the folder which holds the xml file. In your example: ../resources/
Upvotes: 2