Duplicate Class Error In Ant Build
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn duplicate class error netbeans more about Stack Overflow the company Business Learn more about hiring developers or posting
Java Duplicate Class Error
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community duplicate class netbeans Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up how to avoid “duplicate class” in Java up vote 8 error duplicate class maven down vote favorite 3 Suppose I have have a java project myProject and am using an external library jar (someJar.jar), which has a class com.somepackage.Class1.class. Now I find an updated version of Class1.java which fixes a bug in the original jar. I include the new Class1.java in my source code under package com.somepackage When I build the project (e.g., using Netbeans), there is a dist\myProject.jar which contains the classcom.somepackage.Class1.class
Error Duplicate Class Android Studio
and a dist\lib\someJar.jar which also contains a class with the same name. When I run the file (e.g, using java -jar dist\myProject.jar), the new version of Class1.class is used (as I want). How does Java decide which class file to run in case of such duplicates? Is there any way I can specify precedence ? Is there any 'right' way to avoid such clashes? In Proguard, when I try to compress my code, I get a duplicate class error. How do I eliminate this? java share|improve this question asked Jun 21 '11 at 16:50 Jus12 6,8341460110 add a comment| 3 Answers 3 active oldest votes up vote 4 down vote accepted Java decides which one to use based on the order of the classpath. List yours first and you'll be fine. The "right" way would be to fix the orignal source, but sometimes that's not always an option. I haven't used ProGuard, but I have re-jarred libaries before that had duplicate classes. The solution in my case was to tell Ant to ignore duplicate classes. I would assume ProGuard would have that support too. share|improve this answer answered Jun 21 '11 at 16:57 Reverend Gonzo 22.4k43769 add a comment| up vote 6 down
Things LocationTech Long-Term Support PolarSys Science OpenMDM More Community Marketplace Events Planet Eclipse Newsletter Videos Participate Report a Bug Forums Mailing Lists Wiki IRC How to netbeans 8.1 duplicate class Contribute Working Groups Automotive Internet of Things LocationTech Long-Term Support PolarSys duplicate class java compilation error Science OpenMDM Toggle navigation Home Projects Forums Eclipse Community Forums Forum Search: Search Help Register
Java Duplicate Class Intellij
Login Home Home» Eclipse Projects» Eclipse Platform» Duplicate Class error when using ANT to build project Show: Today's Messages :: Show Polls :: Message Navigator Duplicate http://stackoverflow.com/questions/6428992/how-to-avoid-duplicate-class-in-java Class error when using ANT to build project [message #308966] Wed, 11 October 2006 18:52 Eclipse User Originally posted by: pelly.lists.gmail.com I have a pretty basic configuration issue I haven't been able to solve. I'm trying to build using Ant and I am getting this error: [javac] Compiling 47 source files to /home/greg/src/wb/tmp/WEB-INF/classes [javac] /home/greg/src/wb/java/com/wb/contract/Contract.java:3: duplicate class: com.wb.contract.Contract https://www.eclipse.org/forums/index.php/t/101096/ My workspace is /home/greg/src/ My project source folder is set up as: wb/java The default output folder is wb/tmp/WEB-INF The ant task is executing this:
error Summary: Duplicate Class error Status: VERIFIED INCOMPLETE Product: java Classification: Unclassified Component: Source Version: 8.1 Hardware: PC Windows 7 Priority: P3 with https://netbeans.org/bugzilla/show_bug.cgi?id=197983 5 votes (vote) TargetMilestone: 7.3 Assigned To: Jan Lahoda QA Contact: issues@java URL: Whiteboard: 72patch-candidate Keywords: Duplicates: 198466 215437 (view as bug list) Depends on: Blocks: Show dependency tree /graph Reported: 2011-04-22 05:12 UTC by debopamg Modified: 2016-06-08 08:01 UTC (History) CC List: 9 users (show) emanuel_ hennr nnovic ovrabec pwvirgo scgm11 slass100 steveoh444 tombart See Also: Issue Type: DEFECT Exception Report : Attachments screencap duplicate class showing duplicate file warning (68.57 KB, image/png) 2011-07-19 18:26 UTC, slass100 Details ~/.netbeans/var/log/message.log (40.59 KB, text/plain) 2011-07-19 18:28 UTC, slass100 Details View All Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description debopamg 2011-04-22 05:12:46 UTC Product Version = NetBeans IDE 7.0 RC1 (Build 201103280000) Operating System = Linux version 2.6.35-28-generic duplicate class error running on i386 Java; VM; Vendor = 1.6.0_24 Runtime = Java HotSpot(TM) Client VM 19.1-b02 There was a git merge conflict, and after resolving it (outside the IDE, using Meld), I find that the IDE is reporting the conflicted class as Duplicate class. I am using the GIT plugin. Comment 1 Ondrej Vrabec 2011-05-17 09:39:11 UTC What does it mean "Duplicate class"? Can you make a screenshot? Comment 2 Ondrej Vrabec 2011-05-19 08:19:36 UTC Please explain further Comment 3 debopamg 2011-05-19 09:29:47 UTC The problem occurs under the following circumstances: 1. the netbeans git plugin is installed 2. a merge/rebase is performed with the remote git repo 3. there is a conflict in one of the files 4. the conflict is resolved using an external tool (like Meld) 4. after the conflict is resolved, and the change commited, netbeans shows Duplicate class error for the class for which there was a conflict. Hope that helps. I am unable to reproduce this error right now since there are no conflicts. Comment 4 Ondrej Vrabec 2011-05-19 09:45:22 UTC > Hope that helps. I am unable to reproduce this error right now since there are > no conflicts. I cannot reproduce either. Merged, resol