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


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

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-04 23:06 +0000
Organization UK Free Software Network
Message-ID <jo1ndu$ra8$1@localhost.localdomain> (permalink)
References (5 earlier) <15508526.29.1336086347980.JavaMail.geo-discussion-forums@ynjj16> <HLEor.33482$JR1.13053@newsfe06.iad> <jnvpvs$1bo$1@dont-email.me> <TrmdnTWNrM06fj7SnZ2dnUVZ8nCdnZ2d@giganews.com> <jo1jtl$i5j$1@dont-email.me>

Show all headers | View raw


On Fri, 04 May 2012 15:06:43 -0700, bilsch wrote:

> On 05/04/2012 07:11 AM, Leif Roar Moldskred wrote:
>> bilsch<king621@comcast.net>  wrote:
>>
>>
>>> Programs java and javac are in directory: /home/bilsch/jdk7/bin/
>>> Offending program, Nvr1.java is in directory:
>>>
>>>   /home/bilsch/NetBeansProjects/NVRAM/src/
>>>
>>> environment variable PATH is:
>>>
>>> /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/
usr/bin:/sbin:/bin:/usr/games
>>
>> And there's your problem -- your PATH does not contain the directory
>> your java and javac commands are found in, neither as an explicit entry
>> of /home/bilsch/jdk7/bin/ or implicitly through the current directory .
>>
>>> However note that when I run; java Nvr1.class (or simply Nvr1) from my
>>> home directory the output errors are in javanese, as follows:
>>>
>>> bilsch@p4pwj:~/jdk7/bin$ java Nvr1 Exception in thread "main"
>>> java.lang.NoClassDefFoundError: Nvr1 Caused by:
>>> java.lang.ClassNotFoundException: Nvr1
>>
>> You're running a java command here, but not the one at
>> /home/bilsch/jdk7/bin/java -- you must have another java command in
>> your system somewhere. (Try the command "which java" to show where the
>> java command that's actually being run is.)
>>
>> The solution is to add the directory /home/bilsch/jdk7/bin/ to the
>> front of your PATH. Write the following command on the command line:
>>
>>    export PATH=/home/bilsch/jdk7/bin/:$PATH
>>
>> You should then be able to call javac, use that to create a .class file
>> and then use java to run the class file.
>>
>>
> I added /home/bilsch/jdk7/bin to PATH and was able to both compile and
> run program Nvr1 from the command line.  Also, when I then go into
> NetBeans and run the file it works without errors.  HOWEVER, AFTER I RUN
> IN NETBEANS MY PATH STATEMENT REVERTS TO THE ORIGINAL VERSION ie.  the
> /home/bilsch/jdk7/bin part has been removed.  I even put the PATH change
> in two different places in the PATH variable and both were removed. Does
> anybody have a java IDE other than NetBeans ?
>
Look at where PATH is defined in the NetBeans configuration and change 
that.

> 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.  These directories are different for every
> project therefore it's not practical to automate with a script.
> 
Either use Ant (write a build.xml file if you can't use the one that 
NetBeans uses) and/or write a shell script to run the compile from the 
correct directory.

 
-- 
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