简体   繁体   English

如何将JDK添加到类路径(Mac)

[英]how to add JDK to classpath (mac)

Ive been using Eclipse, and this hasnt been an issue, but Im trying out IntelliJIDE. 我一直在使用Eclipse,但这还不是问题,但是我正在尝试IntelliJIDE。 In order to do so, I need to install JDK and load it in my classpath. 为此,我需要安装JDK并将其加载到我的类路径中。

Ive never accessed my classpath before, and Im reading conflicting reports on here about whether I need to add JDK to my classpath or if I should simply pass it to Java via commandline while running program. 我以前从未访问过我的类路径,我在这里阅读有关是否需要将JDK添加到我的类路径或者是否应该在运行程序时通过命令行将其传递给Java的相互矛盾的报告。

I really know nothing about said classpath and am not even sure how to access mine. 我真的不了解所说的类路径,甚至不知道如何访问我的。 I dont want to mess with it and re-route all of my java libs. 我不想弄乱它并重新路由我所有的Java库。

You need to add it in .bash_profile file like 您需要将其添加到.bash_profile文件中,例如

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home
export PATH=$PATH:${JAVA_HOME}/bin

The .bash_profile file should in /User/"your username" if it is not there please create it. .bash_profile文件应该位于/ User /“您的用户名”中,如果没有,请创建它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM