How to know the dependence between .jar files?

X

xie bo

Hi,

In Windows, we can use Microsoft's "DEPENDS.EXE" to show the
dependences between .dll files. e.g., a.dll depends on b.dll.
In Linux, we can use "ldd" utility to show the dependences between .so
files. e.g., a.so depends on b.so.

Now I have two .jar files(a.jar and b.jar) and I want to know whether
a.jar depends on b.jar or not. How to?

Thanks!

Best Regards,
Xie, Bo
 
A

Andrew Thompson

xie bo wrote:
....
In Windows, we can use Microsoft's "DEPENDS.EXE" to show the
dependences between .dll files. e.g., a.dll depends on b.dll.
In Linux, we can use "ldd" utility to show the dependences between .so
files. e.g., a.so depends on b.so.

Now I have two .jar files(a.jar and b.jar) and I want to know whether
a.jar depends on b.jar or not. How to?

In Java these things are often documented in the
documentation (especially JavaDocs). Though a
compilation of the source of a project should indicate
the class dependencies.

Why is it, that you are effectively needing to
'work this out' rather than 'read the docs.'?

Andrew T.
 
X

xie bo

In Java these things are often documented in the
documentation (especially JavaDocs). Though a
compilation of the source of a project should indicate
the class dependencies.

Why is it, that you are effectively needing to
'work this out' rather than 'read the docs.'?

Actually I have not the Javadoc. What I have is just a .jar file. I
know I can de-compile the .jar file and know the dependence by checking
the decompiled source code. But it is not an elegant approach.

I am a Java newbie and I think it is a common problem: How to know the
dependent .jar files for a given .jar file? ( Just like how to know a
..dll or .so file's dependence)
 
A

Andrew Thompson

xie said:
Actually I have not the Javadoc. What I have is just a .jar file.

Like.. from where? Who gave it to you?
How is it launched?
...I
know I can de-compile the .jar file and know the dependence by checking
the decompiled source code. But it is not an elegant approach.

I am a Java newbie and I think it is a common problem:

You think wrong.
..How to know the
dependent .jar files for a given .jar file? ( Just like how to know a
.dll or .so file's dependence)

Do .dll's usually come with *documentation*?
I don't see any lying around on my Win. box.

Andrew T.
 
N

Nigel Wade

xie said:
Hi,

In Windows, we can use Microsoft's "DEPENDS.EXE" to show the
dependences between .dll files. e.g., a.dll depends on b.dll.
In Linux, we can use "ldd" utility to show the dependences between .so
files. e.g., a.so depends on b.so.

Now I have two .jar files(a.jar and b.jar) and I want to know whether
a.jar depends on b.jar or not. How to?

Thanks!

Best Regards,
Xie, Bo

Look in the manifest file in the jar. That should specify the classpath for the
jar, including any other jar's on which the jar depends. If the jar builder
didn't actually specify any, then blame that on the jar builder.

It's just the same as someone not linking a DLL/DSO against dependent DLL/DSOs,
so whoever uses it has to find which library the unresolved references are
located in. ldd only knows about dependencies because the developer who built
the DSO added the dependencies to the command when the DSO was linked (I don't
know how depends works on Windows).
 
A

Andrew Thompson

xie said:
You think wrong.

Actually I am looking for 'JarAnalyzer'-like tool [1].

Just because a tool exists, does not mean either..
a) it is a common problem, or
b) you are approaching this the right way, or..
c) you would actually have the sense to answer
my questions, rather than simply treat this
discussion forum as if it were a help desk.

Andrew T.
 
Joined
Feb 28, 2008
Messages
1
Reaction score
0
Sorry to bring up an old thread but people like Andrew, awwww...

Andrew Thompson said:
xie bo wrote:


Just because a tool exists, does not mean either..
a) it is a common problem, or
b) you are approaching this the right way, or..
c) you would actually have the sense to answer
my questions, rather than simply treat this
discussion forum as if it were a help desk.

Andrew T.


a) It is a common problem especially when JNI is used and you have native .so or .dll dependencies. JAR files rarely come with enough documentation in the open source community.

b) It's a simple question, why not just let him ask it?

c) Are you talking about your questions that had nothing to do with the thread subject and was only your pathetic attempt to make the thread owner feel stupid?

Finally, the only good way of doing this that I've found is decompiling and parsing.

/D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top