Eclipse- How to remove jars which are added "from class path" of referenced library
Asked Answered
N

5

8

I use eclipse. I just added two jars into my project as library >Add external jar . As in below picture, all other jars in the folder are coming to my project as referenced library. How to remove this. Are these really required ? After I compiled, the app jar file size is much bigger than I expected.

enter image description here

tool tip shows-from class path of .jar

enter image description here

Newcastle answered 18/5, 2016 at 6:56 Comment(5)
Usually, jars don't magically appear. Are they part of a project template? Or are you extending a project someone started before? Or (maybe) did you use some kind of dependency management?Kramlich
I started this as a new project. I haven't myself used any other dependency management.Newcastle
I checked my .classpath file. I can see only the jar file path which i added. by project template, you mean .project file ?Newcastle
@Newcastle did you solve this problem ? if yes pls provide answer!Pernambuco
@sunleo: No man, I tried several things, i don't remember it got fixed. Then I moved to Idea intellij - jetbrains.com/ideaNewcastle
H
9

To remove a library reference from the project classpath, follow this procedure:

1.Right-click on the project in the Project Explorer view and select Properties from the drop-down menu.This will open the Propertis dialog.

2.On the Propertis dialog, select the Java Build Path from the list of properties.

3.On the Java Build Path part of the dialog, select the Libraries tab.

4.Find the entry in the list of libraries called Shared Library [], and then select it.

5.Click Remove.

Heliacal answered 18/5, 2016 at 7:25 Comment(2)
thanks, but all jars are not appearing in project properties. uploaded another image.Newcastle
There is no "Shared Library []" hereAcciaccatura
D
5

Right click on project, goto Build Path -> Configure Build Path, then goto the Libraries Tab, select the Referenced library and click remove.

Despair answered 18/5, 2016 at 7:0 Comment(2)
thanks, but all jars are not appearing in project properties. uploaded another image.Newcastle
There is "Referenced Library" in that dialog, although I have libraries imported "from Class-Path" of another libraryAcciaccatura
W
1

The only way I found to remove those other .jar files was to move them into another directory.

In my case, I had a lib/foo-deps directory from which I needed two small .jar files out of about a dozen huge .jar files. This made Ctrl+Shft+T Open Type take almost a minute. So, I made a lib/foo-runtime-deps directory and put everything I did not need to compile into that directory.

Withe answered 14/5, 2018 at 18:17 Comment(0)
H
0

Select Project in Project Explorer and Press "Alt+Enter" then Go to Java Build path and select Libraries then select jar file finally click on Remove button.

Or Another way is their

select jar in the Project tree-view and right click on it and select Build Path then in select the Remove from Build Path . You are done.

Hebraize answered 18/5, 2016 at 7:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.