[SOLVED] sudo and "command not found" problems

Ok, the problem I've got is this: sudo has suddenly started acting real strange. It can't find any programs. For example, if i type
sudo echo
It just goes
sudo: echo: command not found
And another problem I've got, is that as a regular user, it can't find programs in /sbin, or other "exotic" places. For example it can't find firefox, because it's not in /usr/bin or /bin, but in /opt/mozilla/bin.
Please, help me!
Last edited by mrpedroxx (2008-06-14 13:23:49)

sudo -V outputs this
Sudo version 1.6.9p15
$PATH outputs
bash: /usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.: No such file or directory
pacman -Q firefox outputs
firefox 2.0.0.7-1
Yeah, maybe I should update it anyway
And /var/log/errors.log does contain stuff about hard disks, but it's just me mounting my iPod and the Windows partition on my hd

Similar Messages

  • Sudo: user: command not found

    Hi there,
    I'm struggling with this sudo problem.
    All i've been doing with terminal was logging into another account on my iMac and running an application, so i write sudo disk (disk is username for the other account)
    then i enter password and path to the application
    i've been doing this for past 3-4 month every day, bet since yesterday after entering pasword i get this error - sudo: user: command not found
    Any help here would be appreciated!
    Thank you

    which sudo returns: /usr/bin/sudo
    i used First Aid to verify disk permissions 3 times.. repaired them, but it keeps giving me the same errors every time i hit Verify Disk Permissions..
    List of errors:
    Permissions differ on "System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jconsole.ja r", should be lrwxr-xr-x , they are lrw-r--r-- .
    User differs on "System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib", should be 0, user is 95.
    User differs on "System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries", should be 0, user is 95.
    Permissions differ on "System/Library/Java/Support/Deploy.bundle/Contents/Home/lib/security/cacerts", should be lrwxr-xr-x , they are lrw-r--r-- .
    Permissions differ on "System/Library/Java/Support/Deploy.bundle/Contents/Resources/Java/deploy.jar", should be lrwxr-xr-x , they are lrw-r--r-- .
    Permissions differ on "System/Library/Java/Support/Deploy.bundle/Contents/Resources/JavaPluginCocoa.b undle/Contents/Resources/Java/deploy.jar", should be lrwxr-xr-x , they are lrw-r--r-- .
    Permissions differ on "System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jconsole.jar ", should be -rw-r--r-- , they are lrw-r--r-- .
    Permissions differ on "System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Deploy.bundle/ Contents/Home/lib/security/cacerts", should be -rw-r--r-- , they are lrw-r--r-- .
    Permissions differ on "System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Deploy.bundle/ Contents/Resources/Java/deploy.jar", should be -rw-r--r-- , they are lrw-r--r-- .
    Permissions differ on "System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Deploy.bundle/ Contents/Resources/Java/libdeploy.jnilib", should be -rwxr-xr-x , they are lrwxr-xr-x .
    Permissions differ on "System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Deploy.bundle/ Contents/Resources/JavaPluginCocoa.bundle/Contents/Resources/Java/deploy.jar", should be lrwxr-xr-x , they are lrw-r--r-- .
    Permissions differ on "System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Resources/JavaPlugin Cocoa.bundle/Contents/Resources/Java/deploy.jar", should be -rw-r--r-- , they are lrw-r--r-- .
    Permissions differ on "System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Resources/JavaPlugin Cocoa.bundle/Contents/Resources/Java/libdeploy.jnilib", should be -rwxr-xr-x , they are lrwxr-xr-x .
    Warning: SUID file "System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/MacOS/ARDAg ent" has been modified and will not be repaired.
    Permissions verification complete
    Are these pretty bad errors? Are these causing sudo not to work?

  • HT5627 when I copy it in the terminal, it tells me : " sudo: serveradmin: command not found "

    what should I do ? What did I do wrong ?

    This error?
    $ sudo serveradmin
    Password:
    sudo: serveradmin: command not found
    $
    That usually means you're not logged in on an OS X Server configuration — which is separate from having the Server.app tool loaded onto the system, when you're doing remote management —  or as Linc Davis mentions, that the PATH setting is incorrect.  The correct PATH should look something like this:
    $ sudo echo $PATH
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Server.app/Contents/S erverRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin
    $
    I wouldn't expect PATH to be incorrect on the root user on the server, barring some site-local tweaks to that context.  But if there have been changes to PATH, then I'd add both bin and sbin within Server.app into the path.  (This change should not be necessary, though.  The PATH should have the correct settings within Server.app by default.)
    If you're looking to use serveradmin on a remote server, then the usual approach is to enable and ssh into the target OS X Server system (ssh [email protected]), or to use ARD or related to push commands, or to use screen sharing and a remote desktop.   ssh is by far the lightest and fastest of these options.  
    AFAIK, the command-line serveradmin tool doesn't do remote management.  There's no obvious way provided to specify the identity of a target server.

  • Installing mysql:sudo launchctl: command not found

    After several days of reading about:
    Installation of MySQL
    Enabling apache server
    And getting phpMyAdmin up
    I have run into an obstacle.  See error message below **
    I am Running:
    'Mountain lion' , 'Mac OS X 10.8.3'
    I have downloaded:
    MySQL version. Mac OS X 10.7. (X86, 64-bit), DMG Archive.
    Within this forum I found a very brief but helpful 'user tip' post.
    Link1.
    https://discussions.apple.com/docs/DOC-3082
    Where this sentence lead me to believe I could use the version listed above.
    There is NO version for 10.8
    " Download MySQL from a local mirror. You want the Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive. At the time of writing this User Tip, the current version is 5.5.34. By the time you read this, there may be a newer version to use instead. Open the archive mysql-5.5.34-osx10.6-x86_64.dmg. "
    Following the instructions on link1, and all went well until
    I am getting this error message when I type the following command at the terminal prompt:
    **Error message
    -bash: launchctl: command not found.
    1. I cd - changed directories all the way back up the file structure to type the  command
    to see if it needed to be run someplace special but the same error came up.
    2. I searched here on this forum and on the web.
    3. I went back and checked over every step and everything that i typed.
    4. I ended up typing the instructions below by hand
    because somewhere I read that a copy/paste may insert invisible characters.
    Excerpt from link1.
    sudo vi /Library/LaunchDaemons/com.mysql.mysql.plist
    Use the following content:
    <plist version="1.0">
      <dict>
        <key>KeepAlive</key>
        <true/>
        <key>Label</key>
        <string>com.mysql.mysqld</string>
        <key>ProgramArguments</key>
        <array>
        <string>/usr/local/mysql/bin/mysqld_safe</string>
        <string>--user=mysql</string>
        </array>
      </dict>
    </plist>
    Can someone please explain what I am missing ?
    Why is this command
    -bash: launchctl: command not found.
    That is launch c t lowercase L not number 1
    An added note. 
    The following link also had a very nice set of instructions but unlike link1, this link uses the
    'Preference pane' and 'startup item' which link1 discourages because it causes problems down the road.
    I would rather use the command line and do not want to give up on this method.
    Link2.
    http://coolestguidesontheplanet.com/install-configure-apache-mysql-php-phpmyadmi n-osx-10-8-mountain-lion/
    Now that I am going head strong with this project, I hope that my issue can be resolved quickly with this community
    so I don't loose my momentum.
    Thanks a lot.

    1. You are really a nice person.  Thank you.  I really want to understand these file structures.  Sorry my posts are lengthy.
    Thank you for taking the time to look at the original User Tip.
    2. I hope that you do not end this thread when I tell you that I actually have gotten php running.  These concepts are still very important to me.
    I am not up to the point where I am using mySQL so that may end up another troubleshooting problem.
    3. Last week and this I have been exploring my files with terminal by cd-ing  up and down; using sudo nano to open the file to see what is in there.
    I have included some things that may be useful since you have a much better idea about how these paths work.
    4. If you have a chance - Can you elaborate.  I understand a PATH.  What to you mean when you say PATH environmental variable.
    I think of a variable in the computer programmer syntax sense.
    5. I also cannot find a .profile file anywhere. See the below.... where I found something....
    4. Searching like crazy for the load executable.  I cannot find it yet.  I thought that it might be with the  other commands in /bin
    below are some exploratory commands I am running and things I find of interest.
    I use ls -la to display 'all' files. I use -la to list hidden files. those that start with a dotFileName.
    /user/local/mysql/bin
    there is NO load executable here.
    I looked around for 'load'
    macBookPro: /shortname$  ls
    cd bin
    ls -la
    lots of commands:  launchctl  mkdir  pwd  echo ....   i thought that 'load' should live here.
    cd etc
    ls -la
    has:apache2  my.conf  named.conf  passwd paths php.ini sudoes nanorc
    apache2 empty - title: new buffer
    sudoers  i have questions about this but not a priority now.
    nanorc
    php.ini
    my.conf
    name.conf
    passwd
    paths
    sudo nano paths
    /usr/bin
    /bin
    /usr/sbin
    /sbin
    /usr/local/bin
    I did not find the .profile file. what I have found is the below which references the .profile for sh(1)
    I am unable to interpret the below file/code - well maybe a little.
    cd etc
    ls -la 
    sudo nano profile
    # System-wide .profile for sh(1)
    if [ -x /usr/libexec/path_helper ]; then
            eval `/usr/libexec/path_helper -s`
    fi
    if [ "${BASH-no}" != "no" ]; then
            [ -r /etc/bashrc ] && . /etc/bashrc
    fi
    Here is
    /usr/sbin
    sudo nano apachectl
    the following is the code in apachectl
    I see 'run launchctl load ....'
    LAUNCHCTL="/bin/launchctl"
    LAUNCHD_JOB="/System/Library/LaunchDaemons/org.apache.httpd.plist"
    run_launchctl() {
        if [ $UID != 0 ]; then
            echo This operation requires root.
            exit 1
        fi
        $LAUNCHCTL $@
    # Set the maximum number of file descriptors allowed per child process.
    if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
        $ULIMIT_MAX_FILES
    fi
    ERROR=0
    if [ "x$ARGV" = "x" ] ; then
        ARGV="-h"
    fi
    case $ARGV in
    start)
        run_launchctl load -w $LAUNCHD_JOB
        ERROR=$?
    stop|graceful-stop)
        run_launchctl unload -w $LAUNCHD_JOB
        ERROR=$?
    restart|graceful)
        run_launchctl unload -w $LAUNCHD_JOB 2> /dev/null
        run_launchctl load -w $LAUNCHD_JOB
        ERROR=$?
    startssl|sslstart|start-SSL)
        echo The startssl option is no longer supported.
        echo Please edit httpd.conf to include the SSL configuration settings
        echo and then use "apachectl start".
        ERROR=2
    configtest)
        $HTTPD -t
        ERROR=$?
    status|fullstatus)
        echo Go to $STATUSURL in the web browser of your choice.
        echo Note that mod_status must be enabled for this to work.
        $HTTPD $ARGV
        ERROR=$?
    esac
    exit $ERROR
    Thanks again for helping me to understand these file structure.
    There is no preview option so i hope this posts well.

  • Xorg: module "glx" and commands not found???

    Hello, all.
    I'm fairly new to Linux but I'm not a total noob. I have FC6 on my laptop and am currently trying to get a GUI working for Arch on my desktop.
    I pacman-ed hwd, and ran it to create a Xorg.conf, and upon running it I get the following errors:
    (EE) Failed to load module "glx" (module does not exist, 0)
    /etc/X11/xinit/xinitrc: line 28: twm: command not found
    /etc/X11/xinit/xinitrc: line 29: xclock: command not found
    /etc/X11/xinit/xinitrc: line 30: xterm: command not found
    /etc/X11/xinit/xinitrc: line 31: xterm: command not found
    /etc/X11/xinit/xinitrc: line 32: exec: xterm: not found
    waiting for X server to shut down FreeFontPath: FPE "/usr/share/fonts/misc:unscaled" refcount is 2, should be 1; fixing.
    The last comment it makes I know isn't critical, so I'm not worried about that. But I need help with the "glx" part and the commands not found.
    Thanks in advance.

    Did you installed libgl-dri? If not install it, and it will fix glx problems.
    For the command not found, you need to create a ~/.xinitrc file. Before, you'll need to install the WM/DE that you want to use.
    There is a sample file in the wiki: http://wiki.archlinux.org/index.php/Sta … ents_HOWTO

  • Gcc: command not found problem

    Hi,
    i just full installed cygwin 1.5.5-1 'cause i need to comiple and build a dll so i need to use gcc but in response to this command:
    gcc helloworld.cpp
    i get:
    bash: gcc: command not found
    Is that a windows xp problem or do i have to somehow configure cygwin? I read all the manuals i found but couldn't help.
    Best regards
    Nereida

    Depending on the way you install cygwin, the start for setup.exe is different.
    I will explain the way starting from web:
    http://www.cygwin.com/setup.exe
    You have to choose
    1) Install from Internet
    2) your directory for cygwin like: "D:\Programme\cygwin"
    and the install for all or just for you
    3) choose a local package directory like "D:\Programme\cygwin"
    4) choose the settings to access the web like "Use IE5 Settings"
    5) choose the nearest you download server
    !!! and now the interesting Selection starts: !!!
    A tree of packages is listed you have to click at 6. line (+Devel) at the word Default
    +Devel # Default
    Default should changed to:
    +Devel #  Install
    ...this is already your developer-pack within gcc
    but further you have to go to Libs (line 12) and now click to the '+' -sign:
    + Libs # Default
    The lib tree should now opened.
    go up to the 5. last line at the 6. column "Package" you should read w32api: Win32 API header and library ...
    look back to column 3 "New" there stands Skip click on it [as long] that you see the version number (2.5-1) or any better
    It should help but it is not necessary to click on
    + Doc # Default (line 7)
    so that it changes to
    + Doc # Install.
    so now you can finish your installation!
    I hope it helps
    mike

  • [SOLVED] 'sh: nano: command not found' on installation in arch-chroot

    Hello,
    I'm trying to install Arch Linux on a new laptop with a UEFI motherboard, however while following the beginners' guide on the step which requires you to arch-chroot into the /mnt base system to modify the locale.gen file using nano, I receive the following error:
    'sh: nano: command not found'
    I have mounted the partitions, installed the base system and have tried searching online for a solution but nothing seems to work. Also, nano works while outside of arch-root so I believe it is installed on my system.
    I'm almost completely out of ideas on how to fix this, so any help or a point in the right direction would be greatly appreciated.
    - Thanks.
    Last edited by tyor (2013-01-20 12:01:54)

    I had the same problem during my first attempts to install Arch. When you use the command as stated:
    # pacstrap -i /mnt base base-devel
    it seems not all packages were downloaded/installed. Now I know it was my own fault by not selecting the packages properly.
    In the beginnersguide right above the pacstrap command is stated:
    The -i switch can be omitted if you wish to install every package from the base and base-devel groups without prompting.
    So I did, and installed without a problem

  • [SOLVED] rc.d: command not found

    I am in the process of installing xfce. One of the steps is to run:
    rc.d start dbus
    However, when I run this it returns:
    bash: rc.d: command not found
    Am I missing something?
    Last edited by george55 (2011-08-11 04:03:16)

    Inxsible wrote:
    rc.d is not a command. its a location under /etc. your command should be
    sudo /etc/rc.d/dbus start
    $ which rc.d
    /sbin/rc.d
    $pacman -Qo /sbin/rc.d
    /sbin/rc.d is owned by initscripts 2011.07.3-1
    $ rc.d --help
    usage: rc.d <action> <daemon> [daemon] ...
    rc.d list [started|stopped]
    rc.d help
    <daemon> is the name of a script in /etc/rc.d
    <action> can be a start, stop, restart, reload, status, ...
    WARNING: initscripts are free to implement or not the above actions.
    e.g: rc.d list
    rc.d list started
    rc.d help
    rc.d start sshd gpm
    Initscripts update, part 1
    Initscripts update, part 2
    @george55
    If rc.d command doesn't work, check your initscripts version, and check your $PATH.

  • [solved]-bash: open: command not found

    Hello, I'm following the tutorial here to set up pure-ftpd https://wiki.archlinux.org/index.php/SFTP
    When I get to the step to create a self signed certificate, this happens
    [root@(none) private]# open ssl req -x509 -nodes -newkey rsa:1024 -keyout \
    > /etc/ssl/private/pure-ftpd.pem \
    > -out /etc/ssl/private/pure-ftpd.pem
    -bash: open: command not found
    Which package do I have to install to get the "open" command?
    Last edited by learnerofskills (2012-01-26 06:39:11)

    skunktrader wrote:take out the space between open and ssl
    That worked. I feel really dumb and embarrassed now. Thank you.

  • [solved] tuxguitar - java: command not found

    Hi,
    I installed tuxguitar via pacman. When I start it I get this error
    /usr/share/TuxGuitar-0.9.1-linux-gtk-x86/tuxguitar: line 27: java: command not found
    this is the content of that file, line 27 is the last one
    #!/bin/bash
    ##SCRIPT DIR
    DIR_NAME=`dirname "$0"`
    DIR_NAME=`cd "$DIR_NAME"; pwd`
    cd "${DIR_NAME}"
    ##JAVA
    if [ "${JAVA}" == "" ]; then
    if [ "${JAVA_HOME}" != "" ]; then
    JAVA=${JAVA_HOME}/bin/java
    else
    JAVA=java
    fi
    fi
    ##CLASSPATH
    CLASSPATH=$CLASSPATH:./TuxGuitar.jar:lib/swt.jar:lib/itext-1.4.5.jar:./share/
    ##LIBRARY_PATH
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:lib/
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/jni
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
    ##MAINCLASS
    MAINCLASS=org.herac.tuxguitar.gui.TuxGuitar
    ##JVM ARGUMENTS
    VM_ARGS="-Xms128m -Xmx128m"
    ##LAUNCH
    ${JAVA} ${VM_ARGS} -cp :${CLASSPATH} -Djava.library.path="${LD_LIBRARY_PATH}" ${MAINCLASS} "$1" "$2"
    the dependencies jre and swt are installed...
    Last edited by SiD (2007-02-23 13:23:49)

    If jre got installed as a dep together with tuxguitar you first have to source /etc/profile as Java resides in /opt and the PATH variable needs to be refreshed.

  • Input/Output And Method Not Found Problem

    Ok so firstly I think I should apologise on two fronts.
    Firstly, 'cause this is probably posted in the wrong board but I'm not sure this was suitable for the Swing board just 'cause I've been using Swing? And secondly 'cause the code I'm gonna post is so shoddy I would think this constitutes as flaim-bait. >_>
    In my defense this is purely for a little class project to give something to write some documentation on so I'm really not too bothered about the efficiency or ace-mazingness of the end result. I just want it to work.
    To the problem at hand.
    I'm trying to write a program that asks the user a question and then outputs their answer to a file, from which a tally of answers can later be made for the purpose of displaying "results".
    My problem is I've been having problems with the input/output of saving the answers given to the program.
    I'm still learning and input/output is probably my weakest subject (other than, y'know, being good at Java). I've had a bash at it in the following code but all it does it overwrite what is in the file with a single answer so no list of results accumulate. I generally don't have an idea what to try for that one so any pointers would be appreciated.
    Also, my second problem is, in trying to gather results by tallying what is contained in the file, I've run across a problem with the charAt() method not being found and I'm not sure why. Isn't that method a part of java.lang?
    Here's the code thus far:
    //libraries
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.text.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.*;
    import java.io.*;
    class CaseStudy {
         public static void main(String args[]) {
              GUI maininterface = new GUI();
              maininterface.setupMenu();
              maininterface.display();
    class GUI {
         //for the actionlisteners
         int whatframe = 0;
         //creates mainframe and border content panel
         JFrame mainframe = new JFrame("Survey Client");
         JPanel borderpanel = new JPanel(), bottompanel = new JPanel();
         JButton quizbutton = new JButton("Take the quiz"), tallybutton = new JButton("Show Results"), submitbutton = new JButton("Submit Results"), menubutton = new JButton("Return To Menu");
         QuizQuestions toppanel = new QuizQuestions();
         QuizResults toppanel2 = new QuizResults();
         GUI() {
              //sets border in borderpanel, this spaces the main content in from the sides of the window
              borderpanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              //sets up the frame and panels and adds on borders
              mainframe.setDefaultCloseOperation(mainframe.EXIT_ON_CLOSE); // exits java when clicking on close on main frame
              mainframe.getContentPane().add(borderpanel); // adds the panel as a component to the frame, the panel can hold stuffs
              borderpanel.setLayout(new BoxLayout(borderpanel, BoxLayout.PAGE_AXIS));// page_axis means it'll layout vertically
              bottompanel.setLayout(new BoxLayout(bottompanel, BoxLayout.LINE_AXIS));// line_axis means it'll layout horizontally
              //gives button an action
              quizbutton.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e1) {
                        setupQuiz();
              tallybutton.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e1) {
                        if(whatframe == 1) setupResults();
                        else {
                             int rusure = JOptionPane.showConfirmDialog(null, "Are you sure you wish to show results? Any current quiz answers won't be saved.", "Please Choose One", JOptionPane.YES_NO_OPTION);
                             if(rusure == JOptionPane.YES_OPTION) setupResults();
              menubutton.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e1) {
                        setupMenu();
              submitbutton.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e1) {
                        toppanel.doQuiz();
              borderpanel.add(bottompanel);
         public void setupMenu() {
              if(whatframe == 3) {
                   bottompanel.remove(menubutton);
                   borderpanel.remove(toppanel2);
              whatframe = 1;
              //adds components and lays them out
              bottompanel.add(quizbutton);
              bottompanel.add(Box.createRigidArea(new Dimension(0,10)));
              bottompanel.add(tallybutton);
              display();
         public void setupQuiz() {
              bottompanel.remove(quizbutton);
              bottompanel.remove(Box.createRigidArea(new Dimension(0,10)));
              bottompanel.remove(tallybutton);
              whatframe = 2;
              bottompanel.add(submitbutton);
              bottompanel.add(Box.createRigidArea(new Dimension(0,10)));
              bottompanel.add(tallybutton);
              borderpanel.add(toppanel);
              display();
         public void setupResults() {
              if(whatframe == 1) {
                   bottompanel.remove(quizbutton);
                   bottompanel.remove(Box.createRigidArea(new Dimension(0,10)));
                   bottompanel.remove(tallybutton);
              else {
                   bottompanel.remove(submitbutton);
                   bottompanel.remove(Box.createRigidArea(new Dimension(0,10)));
                   bottompanel.remove(tallybutton);
                   borderpanel.remove(toppanel);
              whatframe = 3;
              bottompanel.add(menubutton);
              borderpanel.add(toppanel2);
              display();
         public void display() {
              //sets the size of the frame around it's components and then shows it
              mainframe.pack();
              mainframe.setVisible(true);
              mainframe.validate(); //makes referenced container relayout it's components
    class QuizQuestions extends JPanel {
         LoadingSaving loadsave = new LoadingSaving();
         JPanel popm = new JPanel(), pop1 = new JPanel(), pop2 = new JPanel(), pop3 = new JPanel(), pop4 = new JPanel();
         JFormattedTextField ques = new JFormattedTextField(), op1 = new JFormattedTextField(), op2 = new JFormattedTextField(), op3 = new JFormattedTextField(), op4 = new JFormattedTextField();
         JButton bop1 = new JButton("1"), bop2 = new JButton("2"), bop3 = new JButton("3"), bop4 = new JButton("4");
         char answer;
         QuizQuestions() {
              popm.setLayout(new BoxLayout(popm, BoxLayout.PAGE_AXIS));
              pop1.setLayout(new BoxLayout(pop1, BoxLayout.LINE_AXIS));
              pop2.setLayout(new BoxLayout(pop2, BoxLayout.LINE_AXIS));
              pop3.setLayout(new BoxLayout(pop3, BoxLayout.LINE_AXIS));
              pop4.setLayout(new BoxLayout(pop4, BoxLayout.LINE_AXIS));
              this.add(popm);
              popm.add(ques);
              popm.add(pop1);
              popm.add(pop2);
              popm.add(pop3);
              popm.add(pop4);
              pop1.add(op1);
              pop1.add(bop1);
              pop2.add(op2);
              pop2.add(bop2);
              pop3.add(op3);
              pop3.add(bop3);
              pop4.add(op4);
              pop4.add(bop4);
              //sets up question text fields
              ques.setEditable(false);
              op1.setEditable(false);
              op2.setEditable(false);
              op3.setEditable(false);
              op4.setEditable(false);
              bop1.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e1) {
                        answer = 'a';
              bop2.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e1) {
                        answer = 'b';
              bop3.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e1) {
                        answer = 'c';
              bop4.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e1) {
                        answer = 'd';
              Question1();
         public void doQuiz() {
              loadsave.save(answer);
         public void Question1() {
              ques.setValue("Who's your favourite X-Men character?");
              op1.setValue("Cyclops");
              op2.setValue("Xavier");
              op3.setValue("Wolverine");
              op4.setValue("Rogue");
    class QuizResults extends JPanel {
         LoadingSaving loadsave = new LoadingSaving();
         JPanel popm = new JPanel();
         JFormattedTextField op1 = new JFormattedTextField(), op2 = new JFormattedTextField(), op3 = new JFormattedTextField(), op4 = new JFormattedTextField();
         int[] answerarray = new int[4];
         QuizResults() {
              popm.setLayout(new BoxLayout(popm, BoxLayout.PAGE_AXIS));
              this.add(popm);
              popm.add(op1);
              popm.add(op2);
              popm.add(op3);
              popm.add(op4);
              op1.setEditable(false);
              op2.setEditable(false);
              op3.setEditable(false);
              op4.setEditable(false);
              answerarray = loadsave.load();
              op1.setValue(answerarray[0]);
              op2.setValue(answerarray[1]);
              op3.setValue(answerarray[2]);
              op4.setValue(answerarray[3]);
    class LoadingSaving {
         public void save(char answer) {
              FileReader fr;
              FileWriter fw;
              BufferedReader br;
              String s;
              try {
              //ERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERROR
                   fr = new FileReader("casestudyoutput.txt");
                   fw = new FileWriter("casestudyoutput.txt");
                   br = new BufferedReader(fr);
                   if (br.readLine() == null) s = "x";
                   else s = br.readLine();
                   s = s + answer;
                   fw.write(s);
                   fr.close();
                   fw.close();
              //ERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERROR
              catch(FileNotFoundException exc) {
                   JOptionPane.showMessageDialog(null, "File not found.");
                   return;
              catch(IOException exc) {
                   JOptionPane.showMessageDialog(null, "Something bad happened.");
                   return;
         public int[] load() {
              FileReader fr;
              BufferedReader br;
              int[] answerarray = new int[3];
              String s;
              long length;
              int a = 0, b = 0, c = 0, d = 0;
              answerarray[0] = 0;
              answerarray[1] = 0;
              answerarray[2] = 0;
              answerarray[3] = 0;
              try {
                   fr = new FileReader("casestudyoutput.txt");
                   br = new BufferedReader(fr);
                   if (br.readLine() == null) return answerarray;
                   else s = br.readLine();
                   length = s.length();
                   for(int i = 0; i < length; i++) {
                        char ch = charAt(i); //ERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERROR
                        switch(ch) {
                             case 'a':
                                  a++;
                                  break;
                             case 'b':
                                  b++;
                                  break;
                             case 'c':
                                  c++;
                                  break;
                             case 'd':
                                  d++;
                                  break;
                   answerarray[0] = a;
                   answerarray[1] = b;
                   answerarray[2] = c;
                   answerarray[3] = d;
                   fr.close();
              catch(FileNotFoundException exc) {
                   JOptionPane.showMessageDialog(null, "File not found.");
                   return answerarray;
              catch(IOException exc) {
                   JOptionPane.showMessageDialog(null, "Something bad happened.");
                   return answerarray;
         return answerarray;
    }Any pointers/tips/solutions/angry posts to tell me to stop trying to learn Java would be greatly appreciated.
    Thanks in advance!
    Oh, and in trying to work with it a bit further I realised I'm having a few problems with runtime errors due to exceptions. The first was due to the array being assigned out of bounds (fixed in the above code). But the second reads the following:
    Exception in thread "main" java.lang.NullPointerException
         at Loadingsaving.load(CaseStudy.java:330)
         at QuizResults.(init)(CaseStudy.java.259)
         at GUI.(init)(CaseStudy.java:34)
         at CaseStudy.main(CaseStudy.java:15)Not quite sure what this one means or how to handle it. =\
    Edited by: ThePermster on May 19, 2008 8:08 AM

    A NullPointerException means a method has been called on a null object, or a variable that isn't pointing to any object. Your Exception points to line 330, which is:
    length = s.length();A NPE on that line means that s is null. So let's look at where s is set:
    if (br.readLine() == null) return answerarray;
    else s = br.readLine();s gets it's value from br.readLine(), so that method must be returning null. You have a logical error here. Look at your If-Else. It reads a line, makes sure it isn't null...then it reads another line. Well what if that line is null? You are performing 2 reads here instead of 1.
    Since your If condition returns a value, there's no need for an Else. The code will continue on until it reaches another return. Try this:
    s = br.readLine();
    if (s == null) return answerarray;

  • [SOLVED] udevd and udevadm not found and failure to boot

    I did a system upgrade and installed nvidia and cuda
    and afterwards archlinux failed to boot properly. saying
    /init line 21 udevd not found
    /init line 21 udevadm not found
    it then goes on to say how it could findthe hard disk that grub2 told it about.
    OK, I was then presented with a fairly spartan cmdline, and looked up that line in init and it is "parse_cmdline".
    So what I'd like is to get an orientation on the problem. Naturally I've done a bit of searching on it, though the search was brief.
    In any case, my ideas are:
    - this is not a grub2 problem. Without udev a good grub won't work.
    - the cmdline I get is the ramdisk, and mounting the harddisk will be futile without udev.
    - the ramdisk is messed up and not the harddisk (this is a hope, rather than a conclusion)
    Accordingto this short thread https://mailman.archlinux.org/pipermail … 32762.html
    where I noticed that yes indeed, there is a seemingly broken symlink in the ramdisk's /lib64.
    So I expect I should recreate the ramdisk, but though there is a bunch of information on this, I'm not clear how I can do it from the ramdisk image. I suspect I can't. So, seeing as I can't get in to my archlinux HD installation, I need to try the archlinux install CD. However Im not sure I can generate it there. Maybe I need to mount the installation from the CD and chroot?
    Any helpful advice/guidance welcome. Cheers!
    Last edited by arthro (2013-04-16 15:27:10)

    I followed my logic and loaded up with the CD and mounted on /mnt and chrooted.
    then
    mkinitcpio -p linux
    as per docs and numerous posts.
    and rebooted.
    This finally allowed me into my arch installation.

  • [SOLVED] arch-chroot: Command not found

    Hey,
    I installed Windows 8 alongside Archlinux, so I need to restore my bootloader. I've downloaded the recent image of Arch, made it onto a bootable usb pen drive and booted it without any problems. However, I can't seem to find the arch-chroot binaries (and manually chroot-ing into /mnt after mounting everything fails because bash is not found).
    Am I doing something wrong or is the wiki out of date?
    Last edited by GreenTime (2012-11-01 10:16:56)

    You're doing something wrong.
    Download latest iso and use dd to write it to usb and verify md5 on iso and usb.
    Edit: Normally I roll my own iso with archiso, but to be absolutelly sure on my answer to you, then i've just downloaded latest official iso and tested in a vm, and as expected, arch-chroot is present and working fine.
    Last edited by mhertz (2012-11-01 01:49:59)

  • [Solved] yaourt and liblbxutil: not found on AUR?

    When running yaourt I am receiving the following notice:  liblbxutil: not found on AUR
    Previous runs of yaourt did not produce this message.  Where did the package go and how to fix?
    Last edited by BKJ (2008-11-12 00:45:46)

    I found it in the ABS tree even though it doesn't seem to exist in any of the repos anymore. You may want to file a bug report. I don't know if it's being used by anything. It's listed as installed as a dependency but not required by anything.
    # $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
    #Maintainer: Jan de Groot <[email protected]>
    pkgname=liblbxutil
    pkgver=1.0.1
    pkgrel=1
    pkgdesc="Low Bandwidth X11 Utility Library"
    arch=(i686 x86_64)
    url="http://xorg.freedesktop.org/"
    depends=('zlib')
    makedepends=('pkgconfig')
    options=(NOLIBTOOL)
    source=(${url}/releases/individual/lib/${pkgname}-${pkgver}.tar.bz2)
    md5sums=(b73cbd5bc3cd268722a624a5f1318fde)
    build() {
    cd ${startdir}/src/${pkgname}-$pkgver
    ./configure --prefix=/usr \
    --build=${CHOST} --host=${CHOST}
    make || return 1
    make DESTDIR=${startdir}/pkg install || return 1
    Last edited by skottish (2008-11-09 18:36:54)

  • [SOLVED] bash: strip: command not found

    In which package is the strip command supposed to be? I must have deleted it unadvertedly...
    Thanks in advance.
    Last edited by iosonofabio (2011-06-15 10:28:23)

    [Archer][~]
    pkgfile strip
    core/binutils

Maybe you are looking for