Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!usenet.ukfsn.org!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: Re: my java is broken ! Date: Sat, 5 May 2012 15:02:36 +0000 (UTC) Organization: UK Free Software Network Lines: 47 Message-ID: References: <15508526.29.1336086347980.JavaMail.geo-discussion-forums@ynjj16> <__GdnXciLNRT5TnSnZ2dnUVZ7tudnZ2d@giganews.com> NNTP-Posting-Host: 84.45.235.129 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: localhost.localdomain 1336230156 9178 84.45.235.129 (5 May 2012 15:02:36 GMT) X-Complaints-To: usenet@localhost.localdomain NNTP-Posting-Date: Sat, 5 May 2012 15:02:36 +0000 (UTC) User-Agent: Pan/0.135 (Tomorrow I'll Wake Up and Scald Myself with Tea; GIT 30dc37b master) Xref: csiph.com comp.lang.java.programmer:14283 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. >> 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. >> 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'. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |