Path: csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: bilsch Newsgroups: comp.lang.java.programmer Subject: Re: my java is broken ! Date: Sat, 05 May 2012 15:26:51 -0700 Organization: A noiseless patient Spider Lines: 51 Message-ID: References: <15508526.29.1336086347980.JavaMail.geo-discussion-forums@ynjj16> <__GdnXciLNRT5TnSnZ2dnUVZ7tudnZ2d@giganews.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 5 May 2012 22:26:52 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="llALXQ6TxsVqIoSLcrwVyA"; logging-data="8180"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HVzQxAgttgsEKiVQ7VPkz" User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 In-Reply-To: Cancel-Lock: sha1:wcCQ5ScmaUkWoKxkgKdS+vSepCE= Xref: csiph.com comp.lang.java.programmer:14301 On 05/05/2012 08:02 AM, Martin Gregorie wrote: > On Fri, 04 May 2012 19:48:14 -0500, Leif Roar Moldskred wrote: > >> This isn't a problem with NetBeans, but has to do with how environment >> variables work. An "export" statement only sets an environment variable >> for the current shell. To have the change stick, you need to put the >> addition to PATH in a configuration file (most likely ~/.profile, but >> some linux distroes can be a little weird about it) so that it will be >> set for every shell you open. >> > In the Redhat family of distros you can make this sort of change by > putting a script in /etc/profile.d > > Scripts in profile.d are run after /etc/profile so I have one called > java.sh which sets all my Java-related environment variables, e.g. > JAVA_HOME, ANT_HOME and uses the pathmunge shell function to add /usr/ > java/sdk/bin and /usr/java/ant/bin to $PATH > > I make a lot of use symlinks: /usr/java is a symlink to /home/java so my > Java set-up will survive a system reinstall. /home is in a separate > partition that isn't reformatted during an install. > > Inside the /home/java directory, jdk is a symlink to the current Java SDK > install and ant is a symlink to the current Ant install. This means that > the contents of /etc/profile.d/java.sh doesn't change when I install a > new version of the JDK: I merely switch the sdk symlink at the same time > as I unpack the download. > It is interesting and I grasp the concepts but actually doing those things myself is beyond me. >>> Also, a pain in the ass is I must change directory to where the source >>> file resides to compile. I must change directory to where the .class >>> file resides in order to run. >> >> You don't have to do either of these. I suggest you follow Lew's >> suggestion and read the documentation for the java and javac commands. >> > Seconded. > I can't find any documentation for command line java and javac. >>> These directories are different for every >>> project therefore it's not practical to automate with a script. >> > If you take the time to set your system up appropriately everything will > 'just work'. > >