1

I need to add some files on my CLASSPATH so I am using the following command:

export CLASSPATH=$CLASSPATH:/usr/local/lib/antlr-4.0-complete.jar

Although everytime my terminal is reseted, I have to add the classpath again. Is there a way that I can permamently add the above file on classpath ?

Commands are executed on OSX.

Giannis
  • 5,286
  • 15
  • 58
  • 113
  • See [this SO answer](http://stackoverflow.com/a/588442/680925) for options on setting persistent environment properties on OSX. – Perception Feb 20 '13 at 20:02
  • Please don't do this, it's a bad habit to get into. I can't count the number of times that I've heard people complain that they can't run some piece of code because one of the members of the team had this habit (and as a result forgot to update the build scripts properly). – parsifal Feb 20 '13 at 20:26
  • It's more for an individual use so I guess that doesn't apply. But I'll keep it in mind. – Giannis Feb 20 '13 at 23:34

1 Answers1

2

You should edit a file called ~/.profile and add the

export CLASSPATH=$CLASSPATH:/usr/local/lib/antlr-4.0-complete.jar

to that file. If ~/.profile doesn't exist then create it. The file is executed each time a new shell session is started.

Matti Lyra
  • 12,828
  • 8
  • 49
  • 67