• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

why library is getting priority over application code

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
hope all are well. Presently i faced a problem in java. I am using a java method that has a method and packaged structure same as a library the project is using.But at run time the code of the library code is executed not the code written in the class of my application.Why the library is getting priority ??? . Thanks in advance
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you mean that in your application you have a class that has the same name as a class in a library, and it is also in a package with the same name as the package name in the library?

In principle, which one Java uses in such a situation is undefined. It might depend on the order on which things are on the classpath, but it would be a bad idea to write a program that only works correctly if the order of things on the classpath is right (that would be very brittle).

Change the package name or class name in your application.
 
ani bua
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks ........ OK i am changing my package name
 
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic