Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding to the classpath on OSX

Tags:

java

classpath

Can anyone tell me how to add to the classpath on OSX?

like image 327
Mike2012 Avatar asked Nov 04 '09 18:11

Mike2012


People also ask

How do I set classpath in OSX?

CLASSPATH (for macOS/Ubuntu) To set the CLASSPATH permanently, place the above export command in the bash shell initialization script ( . bashrc or . bash_profile of the home directory or /etc/profile for all users). See "How to Set an Envrionment Variable".

How do I find classpath on Mac?

To check our CLASSPATH on Windows we can open a command prompt and type echo %CLASSPATH%. To check it on a Mac you need to open a terminal and type echo $CLASSPATH.

What does adding to classpath mean?

Classpath is a parameter in the Java Virtual Machine or the Java compiler that specifies the location of user-defined classes and packages. The parameter may be set either on the command-line, or through an environment variable.


1 Answers

If you want to make a certain set of JAR files (or .class files) available to every Java application on the machine, then your best bet is to add those files to /Library/Java/Extensions.

Or, if you want to do it for every Java application, but only when your Mac OS X account runs them, then use ~/Library/Java/Extensions instead.

EDIT: If you want to do this only for a particular application, as Thorbjørn asked, then you will need to tell us more about how the application is packaged.

like image 179
Matt Solnit Avatar answered Sep 28 '22 01:09

Matt Solnit