mac mysql bin地址,Mac上的CLASSPATH,以及Mac如何寻找mysql-connector-java-bin.jar

Is there a default classpath on Mac OS X 10.6? When I echo $CLASSPATH, nothing would show up. In my .profile, I only see PATH variable being set. My problem is that My servlet cant seem to find a suitable driver to connect to the mysql server. I use Eclipse, with Glassfish v3 and MAMP for MYSQL server.

解决方案

There are several methods of getting JARs to be seen by Java on Mac OS X:

Place it in /Library/Java/Extensions

Create/edit the CLASSPATH environment variable

Specify the classpath explicitly with the -cp option.

The CLASSPATH environment variable is not set by default, however, you can set it if you so choose. Be aware, however, that any environment variables that you set in ~/.profile will only take effect within your Terminal session and will not affect any GUI applications. If you want to set environment variables so that they affect your GUI applications, you can create a file named ~/.MacOSX/environment.plist that includes your environment variables. Any changes made to that file will take effect when you next login.

As has been observed, placing JARs in the extensions folder or modifying the CLASSPATH environment variable are generally bad ideas since they can lead to dependency hell. A better way is to bundle your JARs with your artifact and to set the metadata appropriately so that they are on your artifact's classpath. If you use Apache Maven2 to build your artifact, you can have it automatically download as well as bundle any thirdparty dependencies and set the classpath appropriately for your artifact.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值