Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to install JAR files on OS X so other Java applications will find them?

Tags:

java

macos

I want to install different JAR files, like database JDBC drives on OS X so other Java applications will find them.

Where am I supposed to put them? I tried ~/Library/Java/Extensions but it doesn't seam to work.

Details:

OS X 10.8.2

java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-11M3811)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode)

Note: I do not have control over how the application is initialized, but I do assume that the application does not incude it's own Java distribution and that it will start the OS installed versions (the one that is available from the command line).

Also, I do not have any CLASSPATH setup, and please remember that environment variables that are available to command line programs are not the same as the ones available to GUI apps on OS X.

I need to specify that I am trying this for my development machine and that this approach is not a way of deploying Java applications.

like image 248
sorin Avatar asked Oct 11 '12 14:10

sorin


1 Answers

They have to be included in to the classpath of the application. If you execute it from the command line, then use e.g. "java -cp ~/Library/Java/Extensions/foo.jar Bar"

On the other hand, if you use an application server like tomcat, you can either package the jar inside the war of your application of place it into a shared library folder of the server.

like image 126
blomqvie Avatar answered Oct 18 '22 03:10

blomqvie