7

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

Rilwan
  • 2,251
  • 2
  • 19
  • 28
  • 1
    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? – J Fabian Meier May 18 '16 at 07:02
  • I started this as a new project. I haven't myself used any other dependency management. – Rilwan May 18 '16 at 08:35
  • I checked my .classpath file. I can see only the jar file path which i added. by project template, you mean .project file ? – Rilwan May 18 '16 at 08:42
  • @Rilwan did you solve this problem ? if yes pls provide answer! – sunleo Nov 23 '17 at 10:37
  • @sunleo: No man, I tried several things, i don't remember it got fixed. Then I moved to `Idea intellij` - https://www.jetbrains.com/idea/ – Rilwan Nov 24 '17 at 04:18

5 Answers5

8

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.

Mihir
  • 572
  • 1
  • 6
  • 24
5

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

Fred
  • 1,486
  • 1
  • 9
  • 6
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.

J-Alex
  • 6,881
  • 10
  • 46
  • 64
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.

VinG
  • 24
  • 1
  • 11