Running a jar from the command line

Hi all,

I needed a XML compare tool that can be run from the command prompt so I downloaded an open source tool called diffx.
This is just a jar file that I assume you run giving it 2 xml files but I can't get it to work!!

On the command prompt I keep getting:-

C:\Diffx>java -jar c:\diffx\diffx-0.6.jar Actual_.xml Expected_.xml
com.topologi.diffx.load.LoadingException: java.lang.ClassNotFoundException: org.apache.cri
mson.parser.XMLReaderImpl
        at com.topologi.diffx.load.SAXRecorder.init(SAXRecorder.java:319)
        at com.topologi.diffx.load.SAXRecorder.process(SAXRecorder.java:245)
        at com.topologi.diffx.Main.diff(Main.java:287)
        at com.topologi.diffx.Main.main(Main.java:332)
Caused by: java.lang.ClassNotFoundException: org.apache.crimson.parser.XMLReaderImpl
        at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)
        at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
        at com.topologi.diffx.load.SAXRecorder.init(SAXRecorder.java:316)
        ... 3 more

Here is the usage given:-
C:\Diffx>java -jar diffx-0.6.jar
Compare the SAX events returned by two XML files.
usage:
  Main [xml_file] [xml_file]
where:
  xml_file = Path to an XML file

You have no idea how amazing it would be if someone could take a little look at this tool and tell me how to get it up and running!! (sounds OTT but I need to get this working)

Alternatively, if any one has any other good tools that run on the command line, compare XML files, and output the result to another file, please get in touch!!!!

Many thanks in advance
paddykoolAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
You're missing a dependency - the Crimson parser. See their docs about the dependencies
0
paddykoolAuthor Commented:
OK,

I just downloaded crimson-1.1.3 that has the crimson.jar file. What do i do woth it now?!? I put it in the same folder as the diffx.jar but no joy?!?
0
CEHJCommented:
Execute the following code and place crimson.jar in any folder named as a result of running the below


System.out.println(System.getProperty("java.ext.dirs"));

Open in new window

0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

objectsCommented:
you need to have the crison jar in

/lib/ext

where  is the location of the jre you are running it with
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CEHJCommented:
It's not always a good idea to use lib/ext, particularly xml jars, so you might find it better to rewrite the manifest to include crimson.jar in Class-Path
0
objectsCommented:
why are you using crimson anyway, you shouldn't need to

are you using the latest java version?
0
paddykoolAuthor Commented:
Just had to download JDK 6 as didn't have a comiler.

Got it sorted now!!!
0
objectsCommented:
cool, so you were running it with an old version of Java before were you?
Hopefully the latest shouldn't give you anymore problems
0
paddykoolAuthor Commented:
Well, I was running it with jre 1.5. 0 0 00 . . . .  something but needed to get the jdk to execute the line CEHJ gave me so got the latest version indirectly!!!
0
CEHJCommented:
That's good
0
objectsCommented:
you didn't need to run that :)  Its a standard location

you just need to use the latest jre to run diffx
0
paddykoolAuthor Commented:
OK, new issue, I'm geting an error The namespace URI "http://www.xxxx.com/2009/FiML-4" has not been mapped to any prefix when i run the compare

Think i need to open a new post.
Many thanks for your help CEHJ and object :)
0
CEHJCommented:
>>why are you using crimson anyway, you shouldn't need to

You do need to

>>are you using the latest java version?

The java version is not relevant
0
objectsCommented:
Was this comment helpful? Yes No
>>why are you using crimson anyway, you shouldn't need to

> You do need to

thats rubbish

0
CEHJCommented:
>>you didn't need to run that :)  Its a standard location

You do need to run that. There are often > 1 locations and it's easy to get the wrong one
0
CEHJCommented:
>>
> You do need to

thats rubbish
>>

If you want to know WHY you need to paddykool, feel free to contact me
0
objectsCommented:
no sorry,  there can only be one in this scenario
and theres no dependency on crimson anyway :)
 
0
CEHJCommented:
>>and theres no dependency on crimson anyway :)

That of course is easy to test - just get rid of the crimson jars - good luck ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.