error while executing the code

Discussion in 'Ruby' started by Ravikiran Basa, Oct 12, 2010.

  1. i run the below code with ruby interpritor(1.8.7)

    i am getting error " ruby: illegal switch in RUBYOPT: -=EF=BF=BD (Runtime=
    Error)"

    ------------------------------------------------------------

    class Animal
    def set_noise(noi)
    @noise=3Dnoi
    end

    def make_noise
    @noise
    end
    end

    ani=3DAnimal.new
    ani1=3DAnimal.new
    puts ani1.make_noise
    ani.set_noise("gur")
    puts ani.make_noise

    ---------------------------------------------------------------

    if the same code is run in Netbeans IDE(Jruby) i am getting expected
    output.

    Can somebody explain the reason?

    -- =

    Posted via http://www.ruby-forum.com/.=
    Ravikiran Basa, Oct 12, 2010
    #1
    1. Advertising

  2. On Tuesday 12 October 2010, Ravikiran Basa wrote:
    > |i run the below code with ruby interpritor(1.8.7)
    > |
    > |i am getting error " ruby: illegal switch in RUBYOPT: -=EF=BF=BD (Runtim=

    eError)"
    > |
    > |------------------------------------------------------------
    > |
    > |class Animal
    > | def set_noise(noi)
    > | @noise=3Dnoi
    > | end
    > |
    > | def make_noise
    > | @noise
    > | end
    > |end
    > |
    > |ani=3DAnimal.new
    > |ani1=3DAnimal.new
    > |puts ani1.make_noise
    > |ani.set_noise("gur")
    > |puts ani.make_noise
    > |
    > |---------------------------------------------------------------
    > |
    > |if the same code is run in Netbeans IDE(Jruby) i am getting expected
    > |output.
    > |
    > |Can somebody explain the reason?


    The error you're seeing doesn't depend on your code, but it's caused by the=
    =20
    environment variable RUBYOPT including an invalid option. In case you don't=
    =20
    already know it, RUBYOPT is a list of options passed to ruby every time it =
    is=20
    run and it's used to avoid repeating the same options every time on the=20
    command line. In your case, it seems that your RUBYOPTION contains an inval=
    id=20
    option. For example, I get the same error message with the following line:

    RUBYOPT=3D"-q" ruby
    ruby: invalid option -q (-h will show valid options) (RuntimeError)

    Try display the contents of RUBYOPT and see if it contains something wrong.

    I hope this helps

    Stefano
    Stefano Crocco, Oct 12, 2010
    #2
    1. Advertising

  3. Thanks Stefano,

    I have run the above code (copied above code to test.rb) with the
    command
    # RUBYOPT="-w" ruby /home/basa/Desktop/test.rb
    then it worked fine.But can you tell me how to set RUBYOPT properly.

    I mean i should be able to execute

    # ruby test.rb

    --
    Posted via http://www.ruby-forum.com/.
    Ravikiran Basa, Oct 12, 2010
    #3
  4. Ravikiran Basa, Oct 12, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    784
  2. mahesh
    Replies:
    3
    Views:
    4,689
    cb_1987
    Apr 6, 2010
  3. kath
    Replies:
    1
    Views:
    367
    Paul McNett
    Oct 31, 2006
  4. Replies:
    1
    Views:
    1,841
    smcneill
    Oct 15, 2007
  5. Pallav singh

    Error while Executing template Code

    Pallav singh, Feb 22, 2008, in forum: C++
    Replies:
    2
    Views:
    316
    Andrey Tarasevich
    Feb 22, 2008
Loading...

Share This Page