Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #14283

Re: my java is broken !

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: my java is broken !
Date 2012-05-05 15:02 +0000
Organization UK Free Software Network
Message-ID <jo3fec$8uq$1@localhost.localdomain> (permalink)
References (6 earlier) <HLEor.33482$JR1.13053@newsfe06.iad> <jnvpvs$1bo$1@dont-email.me> <TrmdnTWNrM06fj7SnZ2dnUVZ8nCdnZ2d@giganews.com> <jo1jtl$i5j$1@dont-email.me> <__GdnXciLNRT5TnSnZ2dnUVZ7tudnZ2d@giganews.com>

Show all headers | View raw


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       |

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

my java is broken ! bilsch <king621@comcast.net> - 2012-04-29 05:13 -0700
  Re: my java is broken ! bilsch <king621@comcast.net> - 2012-04-29 05:36 -0700
    Re: my java is broken ! Roedy Green <see_website@mindprod.com.invalid> - 2012-04-29 07:05 -0700
  Re: my java is broken ! Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-04-29 09:25 -0500
    Re: my java is broken ! bilsch <king621@comcast.net> - 2012-04-29 15:21 -0700
      Re: my java is broken ! Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-04-29 20:06 -0300
        Re: my java is broken ! bilsch <king621@comcast.net> - 2012-05-03 15:03 -0700
          Re: my java is broken ! Lew <lewbloch@gmail.com> - 2012-05-03 16:05 -0700
            Re: my java is broken ! Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-05-03 20:44 -0300
              Re: my java is broken ! bilsch <king621@comcast.net> - 2012-05-03 22:38 -0700
                Re: my java is broken ! Lew <lewbloch@gmail.com> - 2012-05-04 06:43 -0700
                Re: my java is broken ! Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-05-04 14:07 +0000
                Re: my java is broken ! Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-05-04 09:11 -0500
                Re: my java is broken ! bilsch <king621@comcast.net> - 2012-05-04 15:06 -0700
                Re: my java is broken ! Martin Gregorie <martin@address-in-sig.invalid> - 2012-05-04 23:06 +0000
                Re: my java is broken ! bilsch <king621@comcast.net> - 2012-05-05 15:03 -0700
                Re: my java is broken ! bilsch <king621@comcast.net> - 2012-05-05 15:04 -0700
                Re: my java is broken ! Lew <lewbloch@gmail.com> - 2012-05-04 17:04 -0700
                Re: my java is broken ! bilsch <king621@comcast.net> - 2012-05-05 15:30 -0700
                Re: my java is broken ! markspace <-@.> - 2012-05-05 15:58 -0700
                Re: my java is broken ! Lew <noone@lewscanon.com> - 2012-05-05 22:37 -0700
                Re: my java is broken ! Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-05-04 19:48 -0500
                Re: my java is broken ! Martin Gregorie <martin@address-in-sig.invalid> - 2012-05-05 15:02 +0000
                Re: my java is broken ! bilsch <king621@comcast.net> - 2012-05-05 15:26 -0700
                Re: my java is broken ! Martin Gregorie <martin@address-in-sig.invalid> - 2012-05-05 22:57 +0000
                Re: my java is broken ! Lew <noone@lewscanon.com> - 2012-05-05 22:41 -0700

csiph-web