• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jar interdependencies

 
jaffrin abdul salam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone,
I was given some java Batch program to work on.They asked me to find out the libraries needed for the batch program.They gave me the Jar file.
I imported the jar in MyEclipse. And it gave me some errors that some jars files are missing.I included those jars and the error was gone.In that way i find out the libraries for that batch program.I just want to know whether there will be any jar interdependencies?I mean some jars are required at the compile time and some jars are required at run time.?is there anything like that?Some jars wont be needed until we run the program?is that true?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jaffrin abdul salam:
I mean some jars are required at the compile time and some jars are required at run time.?is there anything like that?Some jars wont be needed until we run the program?is that true?

Yes. The Jars that your program directly depends on are detectable at compile time. The jars that those jars depend on comes up at runtime.
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you inherit from a class that is in another jar and that class inherits from a class in another jar your class would compile and yet fail at runtime. If you can test your program in its entirety it is the best way to know that you have all needed classes and this time have them document what is needed!
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Turns out my previous comment was wrong. Last night I tried this and javac reported that a class was missing and would not compile my code.

Not sure if it matters, but I was comipiling with jdk 1.5.
[ August 23, 2007: Message edited by: steve souza ]
 
jaffrin abdul salam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you inherit from a class that is in another jar and that class inherits from a class in another jar your class would compile and yet fail at runtime. If you can test your program in its entirety it is the best way to know that you have all needed classes and this time have them document what is needed!


Steve,Did you try the above one?That was my real doubt.
I thought Eclipse will be smart enough.It will find out all the libraries that are required.Because When i import the jar in eclipse,it will find out all the libraries that are required.
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<<If you inherit from a class that is in another jar and that class inherits from a class in another jar your class would compile and yet fail at runtime.>>
I did this and it failed at compile time, not runtime.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And anything that you create by reflection - maybe Class.forName(name).newInstance() - will go undetected at compile time. You can compile JDBC programs with no drivers at all, but it's hard to run them that way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic