Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the class path in Eclipse and Android Studio

I've heard that you can use classpath to use classes in other libraries. I googled about this and all results tell me to use the command line to compile the program and specify a classpath. But who would use command line to compile java programs nowadays?

I am using eclipse and Android Studio. I mean they are IDEs so they surely can set the classpath very easily, right?

Also, I want to know the word "library" in this context is just a jar file , right?

like image 358
Sweeper Avatar asked Aug 11 '15 08:08

Sweeper


People also ask

What is class path in Eclipse?

classpath file is created in the project's root directory. If you created the project on an existing code-base, eclim will attempt to setup the . classpath file with any source code directories or libraries in the project. Regardless of the state of your project you will at some point need to update the classpath.

What is class path in Android?

android.graphics.Path. The Path class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves. It can be drawn with canvas.


1 Answers

In Eclipse:

Right-Click on the Project → Build Path → Configure Build Path. Under Libraries tab, click Add Jars or Add External JARs and give the Jar.

Image from link
enter image description here

Android Studio: from Android Studio: Add jar as library?

  1. Right click on the module in the left hand panel and choose Open Module Settings. enter image description here
  2. On the left panel of the dialog, choose Libraries.
  3. Click the + sign above the panel second from the left -> Java enter image description here
  4. Select your local jar and add it to the project.
like image 64
Sumit Singh Avatar answered Nov 04 '22 08:11

Sumit Singh