Weird command line thing

When I try to start up my laptop, the white screen grinds away for several minutes before becoming a black screen with a cursor. No command line, really, just the cursor. Every few minutes I get this:
disk0s9: I/O error.
(date) (time) init: can't exec /bin/sh for single user: No such file or directory
Every third one of these replaces 'single user' with '/etc/rc'. I tried rebooting PRAM, NVRAM, and everything else I could think of. I'm out of the country for the immediate future, and I don't have the install disk. Is there anything I can do? I've tried looking around for a Mac OS disk to boot off of, but it seems that no one in Korea uses Macs.
Powerbook G4 17"   Mac OS X (10.3.9)  

Hi--
Welcome to the Apple Discussions. Sorry to hear about your problems.
Unfortunately, it sounds very much to me like your hard drive has a bad block or blocks. Or it has failed in some other way. Normally, what I'd suggest in a situation like this is to get a Firewire hard drive, install the OS on it, and then try to use a program like Data Rescue to recover any files that aren't backed up. You can also put your PowerBook into Firewire Target disk mode and see if it can mount on the desktop of another Mac, and try to recover files that way.
Once you have everything backed up, you would then erase the hard drive in the PowerBook, making sure you use the "Write Zeroes" option, which should remap any bad blocks on the drive to spare sectors. Then, you would use Disk Utility on the OS installation disc to make sure the S.M.A.R.T. status on the HD is still okay, meaning it didn't run out of spare sectors. If it's okay, then you could re-install the OS, and move your files back.
Unfortunately, you're just very limited in what you can do because the error seems to be with the very first file to load, the "init" process, from which all else gets loaded. So you won't even be able to boot to single user mode, which you've already found out.
Apple has resellers in Korea, so you might check out their Korean web site. I sort of took a wild chance and came up with this page that seems to list them. I don't read Korean, but I'd guess the numbers down the center are phone numbers.
Good luck,
charlie

Similar Messages

  • Weird Command Line Prompt in Terminal

    Could someone tell me why my command line prompt is coming up as:
    vickyscomputer:~ lukecartledge$
    This is in a bash shell on 10.5.7.
    This is not the name given to the computer and never has been. What is wrong here and is this serious?

    What is wrong here and is this serious?
    There's nothing wrong. The prompt is showing the current host. The following line from /etc/bashrc produces the prompt->
    PS1='h:W u$ '

  • Command line path problem...?

    Ok, I am only after begining programing in java and hence im starting on HelloWorld. Its not the code that im stuck on though. Its the command line things afterwards. I know how to change the path and stuff and use DIR however this is what the tutorial says:
    "The Java tool set consists of a set of command line programs located in the bin directory of your Java installation. For instance, if your Java installation is in C:\j2sdk1.4.2 then the programs you need will be located in C:\j2sdk1.4.2\bin. Make sure you have modified your PATH environment variable to include this bin directory. You can modify your PATH through the control panel or temporarily on the DOS command line (see your operating system help)."
    When I try that but replace it with my current version its says this "System cannont find file path" Then if I put program files before that it still doesnt work and no matter what ive tried it doesnt seem to work. Another question also, does the HelloWorld.java file need to be saved in the \bin directory also?
    I hope you get back to me, because its kinda hard without someone here to explain it all.
    -ARA

    When I try that but replace it with my current version its says this "System cannont find file path" Then if I put program files before that it still doesnt work and no matter what ive tried it doesnt seem to work.I'm not a Windows guy, but it sounds like you put the wrong path in the PATH variable. Maybe you installed the JVM in a different location?
    Another question also, does the HelloWorld.java file need to be saved in the \bin directory also?NO! You shouldn't put anything in there, or anywhere the directory above it either (the JAVA_HOME directory). Create a separate directory for your own files. Maybe in your home directory, if Windows is supporting the "home directory" concept in any meaningful way.

  • Is it possible to script Firefox to do things from the command line?

    Specifically, I am attempting to print a web page at a specific url from the command line.

    Thanks for the quick reply. I had already seen the page you linked to, but it doesn't have any commands to print a web page. Should I interpret from that absence that there isn't a way to print from Firefox from the command line?

  • [RESOLVED] How I pass in my command-line variables disgusts me

    Hello,
    What I'm trying to do is to make an easily configurable script that the user can run with just a few basic command line variables (some of our users are not programmers.)  Now, here's my problem, when it comes to extracting the variables from the command line, it's kind of messy.  Lets say I have the following command:
    $ ./hl_script.sh --config-file=config_abc.txt --rate=5000 --data-dump=/opt/dump_area -v
    "-v" means verbose
    Now, given the weird arrangement of the different types of command line arguments, I'd like to extract the salient parts of the information that I care about.  However, at this moment, all I have is the "cut" command which can easily get into undefined behavior territory should the user misstype an input.  I would love to know how you have done this and what your approach to this problem is.
    This is the code that I have so far:
    # this is where we run the initial test and check if the user entered the
    # help flag in order to see how to properly use this application.
    if [ $# -gt 1 ]; then
    for argument in $@
    do
    if [ $argument = "--help" ]; then
    echo "Here is how you would use this software and the flags that would"
    echo " be useful."
    echo " --help"
    echo " Brings up this display and shows a listing of the options"
    echo " that can be used to better utilize this app."
    echo ""
    echo " --config-file=N"
    echo " Specify the config file that we'd like to use."
    echo ""
    exit 0
    elif [ `cut $argument | cut -d'=' -f 1` = "--config-file" ]; then
    # read-in the config file that we specified and then proceed to set a
    # bunch of environment variables that we need.
    echo "stuff..."
    fi
    done
    fi
    Last edited by publicus (2014-05-13 13:13:43)

    ewaller wrote:
    I know your sample code is Bash, but you may want to consider doing it in Python and using this library
    Here is a simple Python program I wrote that uses the library:
    ewaller$@$odin ~/devel/python 1004 %./sieve.py
    Usage: sieve.py [options] arg
    sieve.py: error: incorrect number of arguments
    ewaller$@$odin ~/devel/python [2]1005 %./sieve.py 10
    2 3 5 7
    ewaller$@$odin ~/devel/python 1006 %./sieve.py --help
    Usage: sieve.py [options] arg
    Find prime numbers using a sieve of Eratosthenes
    Options:
    -h, --help show this help message and exit
    -v, --verbose
    ewaller$@$odin ~/devel/python 1007 %./sieve.py 10 -v
    removing 4
    removing 6
    removing 8
    removing 10
    removing 6
    removing 9
    removing 10
    2 3 5 7
    ewaller$@$odin ~/devel/python 1008 %cat sieve.py
    #! /usr/bin/python
    Implement a sieve of Eratosthenes
    from optparse import OptionParser
    def main():
    #Handle all the command line nonsense. We need a number as an argument
    usage = "%prog [options] arg"
    description = "Find prime numbers using a sieve of Eratosthenes"
    parser = OptionParser(usage=usage,description=description)
    parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
    (options, args) = parser.parse_args()
    if len(args) != 1:
    parser.error("incorrect number of arguments")
    try:
    maxval=eval(args[0])
    except:
    parser.error ("Argument is not a number")
    # Here is the sieve
    a=[x for x in range(0,maxval+1)]
    for count in range(2,int(maxval/2)+1):
    if a[count]:
    for i in range(count*2,maxval+1,count):
    a[i]=0
    if options.verbose:
    print ("removing %i"%i)
    # and report the results
    wrap=0
    for count in range(2,len(a)):
    if a[count]:
    print (count,end=" ")
    wrap += 1
    if (wrap == 5):
    print()
    wrap = 0
    print ()
    if __name__ == "__main__":
    main()
    ewaller$@$odin ~/devel/python 1009 %
    The thing is, I already have some shell code written that works, so I don't want to re-write (and re-test) that.

  • GUI Applications unable to use command line tools

    Hi All-
    I've searched, but I can't find a thread about this one, so...
    On OS 10.4.5:
    Whenever I use a GUI app that wants to use a command line tool (e.g. curl, df, java), the app fails giving an error message to the effect of "unable to find curl" or the like. It is as if the GUI cannot find my unix $PATH.
    Examples:
    -- Eclipse refuses to launch, because it appears to use "java xxxxxxx" to launch.
    -- Automator fails to run certain Safari actions because they use curl to navigate web pages.
    -- Carbon Copy Cloner fails to launch, because it can't find a tool (df, IIRC) to read drive/volume info
    Possibly relevant details:
    -- I can use the tool in question from the command line, so they are present, and in my $PATH, but the GUI can't find them.
    -- I recently moved from an old G4 to a relatively new G5, and had issues migrating files, so I eventually just copied my entire home directory from the old machine to the new, replacing the freshly created one on the new machine. I feel like that missed something that tells the GUI where your $PATH is, or some other link between GUI and command line.
    -- I created a new user, and that user does not experience the same troubles. This adds to my suspicion that it is account/PATH related.
    Any help anyone can give it greatly appreciated.
    -p
    PM G5 dual 2.0   Mac OS X (10.4.5)  

    Did you by any chance create an evironment.plist file? It is located in ~/.MacOSX/ If you don't know about it or don't know to look (.MacOSX is normally invisible), try this:
    In Finder.app, in the "Go" menu select "Go to Folder..." (shift-command-G), type ~/MacOSX in the text field and hit OK, the finder should then open a window or complain.
    If it opens a window and you find in it a file named environment.plist move that file to the desktop and try your applications. Do they work as advertized? Try again after logging in/out if things don't work. Do they work now?
    Whatever hapens, tell us more...

  • Error Received When Trying To Create DSN From The Command Line

    All,
    Your help is greatly appreciated in advance. I am having trouble packaging Oracle 10G for a batch file deployment. Everything is done except for getting the DSN created which is causing me major problems. We am working with the Oracle 10G R2 10.2.0.1.0 Client on Windows XP Professional SP2. The Oracle database resides on a Windows 2000 Professional Server SP4 running Oracle 9i.
    Our Environment: I am creating two packages of the Oracle 10G client. The first is for a batch file distribution via LANDesk and the other package is for normal batch file install if someone from IT is installing this from a user's desk. Both scripts are really identical the only differences are how they are laid out. I only need help with the DSN creation as everything else is ready to go. I am going to focus on the Non-LANDesk batch file as once I fix this in one script the other one should also be fixed.
    The Problem: The batch script copies the neccesary files to the temporary directory. I then extract the setup files to the temp folder. I run a custom Oracle install using the RSP file from a recorded install. After the install is complete I copy the TNS Names file to the proper location. I then try to call a CMD file with the ODBC command seen below the main script.
    Script (May be easier to read if you download using link below):
    @ECHO ON
    ::This batch files installs Oracle 10G Release 2 Version 10.2.0.1.0 with a Custom Response File
    ::Installation is Interactive
    ::All files are extracted from the ZIP file via the 7-Zip command line tool
    ::The Net Configuration Assistant TNS Names File is copied to its proper location
    ::The CCR ODBC connection is created once the install is complete
    ::All folders used for installation are cleaned up-deleted
    @ECHO Setting Variables
    set NetworkPath=\\dc-landesk\SoftwareForLDAgent\Oracle10G-R2-10.2.0.1.0\Non-LD
    set DefaultPackagePath=C:\Program Files\LANDesk\LDClient\sdmcache\SoftwareForLDAgent\Oracle10G-R2-10.2.0.1.0\Non-LD
    set ExtractionPath=C:\Temp_Oracle10G
    set TempInstallFromPath=C:\Temp_Oracle10G\SetupFiles
    set FileFolderCleanupPath=C:\Program Files\LANDesk\LDClient\sdmcache\SoftwareForLDAgent
    @ECHO Creating Directories
    mkdir "C:\Program Files\LANDesk\LDClient\sdmcache\SoftwareForLDAgent\Oracle10G-R2-10.2.0.1.0\Non-LD"
    @ECHO Copying Files to DefaultPackagePath
    copy /Y "%NetworkPath%\7za.exe" "%DefaultPackagePath%"
    copy /Y "%NetworkPath%\CCR-ODBC.cmd" "%DefaultPackagePath%"
    copy /Y "%NetworkPath%\Oracle10GCustom.rsp" "%DefaultPackagePath%"
    copy /Y "%NetworkPath%\SetupFiles.zip" "%DefaultPackagePath%"
    copy /Y "%NetworkPath%\tnsnames.ora" "%DefaultPackagePath%"
    @ECHO Changing to Extraction Directory
    cd "%DefaultPackagePath%"
    @ECHO Extracting Files to path with no spaces
    "%DefaultPackagePath%\7za.exe" x SetupFiles.zip -o%ExtractionPath% -aoa
    @ECHO Please Open the "Task Manager" manager, Sort by "CPU" Descending
    @ECHO Watch Task Manager For Javaw.exe, press any key when the process Disappears
    @ECHO Install using Custom Response File
    "%TempInstallFromPath%\setup.exe" -responseFile "%DefaultPackagePath%\Oracle10GCustom.rsp" -force -silent -noconsole
    pause
    @ECHO Copying NETCA (Net Configuration Assistant) TNS Names File to proper Location in Oracle Product Directory
    copy /Y "%DefaultPackagePath%\tnsnames.ora" "C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsnames.ora"
    @ECHO Creating ODBC Connections Using Oracle Driver installed by this Batch File
    call "%DefaultPackagePath%\CCR-ODBC.cmd"
    @ECHO Waiting 20 seconds before proceeding
    ping -n 21 127.0.0.1 >NUL
    @ECHO Remove Temp Files and Folders created during Install
    rmdir /S /Q %ExtractionPath%
    del /Q "%DefaultPackagePath%\*.exe"
    del /Q "%DefaultPackagePath%\*.ora"
    del /Q "%DefaultPackagePath%\*.rsp"
    del /Q "%DefaultPackagePath%\*.reg"
    del /Q "%DefaultPackagePath%\*.zip"
    rmdir /S /Q %FileFolderCleanupPath%
    @ECHO The Oracle 10G installation has been Completed
    pause
    ODBC Script
    odbcconf.exe /a {CONFIGSYSDSN "Oracle in OraClient10g_home1" "DSN=CCR|Description=CCR_data|SERVER=BWB|Database=CCR"}
    As soon as the command is called I see the following error message appear.
    "CONFIGSYSDSN: Unable to create a data source for the 'Oracle in OraClient10g_home1' driver: Could not load the setup or translator library with error code -2147467259"
    The really strange thing though is that if I let the main part of the script run (Not the ODBC call) and then immediately manually start the ODBC call script it works just fine. So, I don't really understand why the script can't add it itself. Or, I can go the Administrator Tools>Data Sources (ODBC)>and then add it manually which also works. I have tried just pasting the command directly in the main script, therefore, bypassing the call feature but it doesn't make a difference.
    Link (Zip with all scripts mentioned above): http://www.cbridegum.com/Fourms/Oracle/Files.zip
    Has anyone ever seen this kind of issue before? Does anyone have any idea on how to fix this? Any thoughts or suggestions would be great.
    Thanks so much for your help in advance,
    Clif Bridegum

    All,
    I thought it may be related to spaces in the path in which the script was called from. I tried having the ODBC command script in another directory but the same thing happens. It will give me the "CONFIGSYSDSN: Unable to create a data source for the 'Oracle in OraClient10g_home1' driver: Could not load the setup or translator library with error code -2147467259". As soon as the script is done running I can manually double click the script and it adds the DSN fine.
    Thanks,
    Clif Bridegum

  • Problem using extension manager CS5 with command line

    Hi All,
    I had posted my question here : http://forums.adobe.com/message/4695419#4695419, but was advised to do so here as well..
    I have a requirement to get the path of all the installed Extension Managers on any Windows system for the purpose of installing an extension.. I thought, there would be no problem in getting the path from the registry. There was no problem in Win XP, but the same does not work for Win 7.. I googled, and found alternate ways to get the path.
    Here is the link : http://forums.adobe.com/thread/851359. I followed the instructions in this post, but failed to get this working for CS5 as mentioned in my previous thread... No problem for CS5.1 and CS6.. Why is that?
    I want to get this working for CS5, CS5.1, CS6... How can I get the path of all the Extension Manager versions installed on a Windows system?
    Please refer to the following screenshots to get a better understanding of my problem,
    I created a jsx file named "Result.jsx", which I saved in my D drive, with the following code,
    resultFile = new File("D:/result.log");
    resultFile.open("w");
    resultFile.write(BridgeTalk.__diagnostics__);
    resultFile.close();
    If I run this directly from ESTK CS5, there is no problem, and I get the result.log file. I tried to execute this script via command line as shown in the screenshot,
    On executing the above, I got the following error,
    What is going wrong?
    Please help!

    I am sorry for the poor documentation of Extension Manager which causes you so much trouble.
    1. You can use BridgeTalk API to ask specific version of Extension Manager to do something. There is sample in packaging_extension.pdf about this. You don't need to know the installation path of Extension Manager. One thing to note is that the value of bt.target is version specific, i.e. "exman-5.0", "exman-5.5" send this message to different version of Extension Manager, so you can change this value to install/enable/disable/remove extensions using different version of Extension Manager. More detailed documentation of BridgeTalk can be found by clicking "Help" menu then clicking "Javascript Tools Guide CS5" in "Adobe ExtendScript Toolkit CS5".
    2. Specific version of Extension Manager only manage extensions for corresponding version of product. You should use Extension Manager CS5 to install extensions for Photoshop CS5. The reason that the extension you installed for Photoshop CS5.1 using Extension Manager CS5.5 is displayed for Photoshop CS5 in Extension Manager CS5 is that two versions of Photoshop specified the same directory for Extension Manager to manage extensions. This is a defect and will cause some problems if multiple versions of Photoshop co-existed in one machine. But "to find  previous (CS5) extension manager and to enable it" should work for you, I guess you use command line to enable it and specify wrong product name (see #3) so that it doesn't work.
    3. When using command line, you should specify "product" attribute with the name displayed at the left panel of Extension Manager. So "Photoshop CS5 32" is correct. Remember to enclose it with double quote because of existence of space character.
    4. As above mentioned, use display name of Photoshop, and call proper version of Extension Manager by BridgeTalk.

  • Find unowned files via command line?

    I'm interested in making a list of files not owned by any package and sending it to a text file I can review. I found this thread, which suggests pacpal (link appears to be broken now) and this script. I could try the script, but I noted from a bit back that the Arch news page listed a one-liner for finding unowned packages in the preparation of moving /usr/lib -> /lib:
    $ find /bin /sbin /usr/sbin -exec pacman -Qo -- {} + >/dev/null
    Here's the script linked to above, for reference:
    #!/bin/bash
    # Utility to generate a list of all files that are not part of a package
    # Author: Spider.007 / Sjon
    TMPDIR=`mktemp -d`
    FILTER=$(sed '1,/^## FILTER/d' $0 | tr '\n' '|')
    FILTER=${FILTER%|}
    cd $TMPDIR
    find /bin /boot /etc /lib /opt /sbin /usr /var | sort -u > full
    pacman -Ql | tee owned_full | cut -d' ' -f2- | sed 's/\/$//' | sort -u > owned
    grep -Ev "^($FILTER)" owned > owned- && mv owned- owned
    echo -e '\033[1mOwned, but not found:\033[0m'
    comm -13 full owned | while read entry
    do
    echo [`grep --max-count=1 $entry owned_full|cut -d' ' -f1`] $entry
    done | sort
    grep -Ev "^($FILTER)" full > full- && mv full- full
    echo -e '\n\033[1mFound, but not owned:\033[0m'
    comm -23 full owned
    rm $TMPDIR/{full,owned,owned_full} && rmdir $TMPDIR
    exit $?
    ## FILTERED FILES / PATHS ##
    /boot/grub
    /dev
    /etc/X11/xdm/authdir
    /home
    /media
    /mnt
    /proc
    /root
    /srv
    /sys
    /tmp
    /var/abs
    /var/cache
    /var/games
    /var/log
    /var/lib/pacman
    /var/lib/mysql
    /var/run
    /var/tmp
    Is there any reason to use a script like the above compared to such a simple script, which appears to just be spitting a list of all files in /bin, /urs/sbin, and /sbin into `pacman -Qo`. What I can't figure out is what the end of the command does (the `-- {} + > /dev/null`). From various attempts to pipe that output into a text file, I've noticed that it just gets filled with the owned files... so I'm guessing something in there is filtering so that unowned get printed to stdout and owned go to /dev/null. I can't figure out how to redirect the unowned to a text file.
    Thanks for any suggestions.

    alphaniner wrote:"--" is often used to tell the program there are no more options. I didn't see it in the manpage, but that's the case with pacman as well.* The "{} +" is part of the find -exec argument, search for {} in the find manpage.
    Ah. Thanks for that. I'd been googling things like " linux command line '-- {}'" and not getting any hits. I combined the arguments incorrectly! Thanks for letting me know that this was part of `find`, as I was also looking in the man page for pacman wrongly.
    alphaniner wrote:
    The >/dev/null is redirecting stdout (list of owned files) to oblivion. The list of unowned files (and other errors) goes to stderr. To redirect stderr you use "2>" so try
    find /bin /sbin /usr/sbin -exec pacman -Qo -- {} + >/dev/null 2>unowned_files
    Perfect, and now I understand how `pacman -Qo` is working: it sends the answer to stdout if it knows the answer and to stderr if it doesn't find a hit. Thanks!

  • Running a command in a command line tool in fastest way

    Before anything I want to clarify some terms : 
    apk
    file (android application package file) : equivalent to executable (exe) files on windows
    aapt.exe
    : A command line tool which comes with android sdk in order to fetch information of an apk file (It obviously has other usages)
    note : This question is not about an android feature. It's all about C# and functionality of .Net framework 
    An
    apk file has a name just same as any other file, but it has a internal name (which will be shown when you install apk file on android os as name of application) 
    with
    aapt.exe I can get internal name of an apk using following command :  
    aapt
    d badging "<apk path>"
    I
    have copied aapt.exe where executable file of my c# application is and I want  :
    Enter
    above command for each apk in selected directory (using GetAllFiles method)
    I want to get internal names of apk files and
    I've tried a lot of ways and I've searched a lot. finally this is what I've got : 
    Process proc = new Process();
    proc.StartInfo.FileName = "cmd.exe";
    proc.StartInfo.RedirectStandardInput = true;
    proc.StartInfo.RedirectStandardOutput = true;
    proc.StartInfo.UseShellExecute = false;
    proc.StartInfo.StandardOutputEncoding = System.Text.Encoding.UTF8;
    proc.Start();
    using (StreamWriter sw = proc.StandardInput)
    foreach (string path in Directories.GetAllFiles(@"E:\apk", "apk"))
    sw.WriteLine("aapt d badging " + "\"" + path + "\"");
    //following line doesn't work because sStandardInput is open
    Debug.WriteLine(proc.StandardOutput.ReadToEnd());
    // There will be a really huge amount of text (at least 20 line per sw.Writeline) and
    //it impacts performance so following line is not really what I'm looking for
    Debug.WriteLine(proc.StandardOutput.ReadToEnd());
    GetAllFiles is
    a function that I've created to fetch all apk file full path. It gets two argument. First argument is path and second one is extension of file you want its full path to be fetched.
    This is not final code.
    As I've commented it out first Debug.WriteLine doesn't
    work and second one is not a good idea. how should I get output from proc?
    I have tried running process by argument and its awful :)
    As another approach :
    Because apk files are basically zip files I can extract them get what I want from them.
    There is an xml file named Androidmanifest.xml in every apk file.
    Androidmanifest.xml is like an ID card for an apk file and apk internal name can be found in it but here are some problems with this approach : 
    1. Androidmanifest.xml is not a plain text file. It's coded and it requires a lot of complexity to decode it
    2. application name (or apk internal name) is an attribute in this file and it's value is not a string value. It's a reference to a file where strings are stored and worst thing is it's not an easy to find out reference. It's just a number

    And you don't get any output from it? Maybe you're passing the arguments incorrectly?
    No. I don't get any result and I have checked arguments and it's correct.
    But you are already running a separate process for every apk file. You start a single cmd.exe and then send it commands that will cause aapt to be run for every file. Unless aapt accepts multiple apk filenames on the command line there's no way
    around using separate processes.
    I didn't know that. anyway speed in this way is much more rather than creating a function. creating a Process object in it and calling function for each apk file.
    I read somewhere that it's possible to run multiple commands in cmd by & operator but as you said I think every command runs aapt. I have tested this approach too and it's very very slow
    fastest approach I have found is what I have wrote here and speed is about  0.6 per apk file which is still slow when there is thousands of apk files.
    I tried an application that does same thing (fetching apk information) and in it's installation directory I found aapt.exe which means it uses this tool to get information but speed is significantly faster rather than my application.   
    So what's your suggestion about this? 

  • Question about reading a string or integer at the command line.

    Now I know java doesn't have something like scanf/readln buillt into it, but I was wondering what's the easiest, and what's the most robust way to add this functionality? (This may require two separate answers, sorry).
    The reason I ask is because I've been learning java via self study for the SCJA, and last night was the first time I ever attempted to do this and it was just hellish. I was trying to make a simple guessing game at the command line, I didn't realize there wasn't a command read keyboard input.
    After fighting with the code for an hour trying to figure it out, I finally got it to read the line via a buffered reader and InputStreamReader(System.in), and ran a try block that threw an exception. Then I just used parseInt to get the integer value for the guess.
    Another question: To take command line input, do you have to throw an exception? And is there an easier way to make this work? It seems awfully complicated to take user input without a jframe and calling swing.
    Edited by: JGannon on Nov 1, 2007 2:09 PM

    1. Does scanner still work in JDK1.6?Try it and see. (Hint: the 1.6 documentation for the class says "Since: 1.5")
    If you get behaviour that doesn't fit with what you expect it to do, post your code and a description of our expectations.
    2. Are scanner and console essentially the same thing?No.
    Scanner is a class that provides methods to break up its input into pieces and return them as strings and primitive values. The input can be a variety of things: File InputStream, String etc (see the Scanner constructor documentation). The emphasis is on the scanning methods, not the input source.
    Console, on the other hand, is for working with ... the console. What the "console" is (and whether it is anything) depends on the JVM. It doesn't provide a lot of functionality (although the "masked" password input can't be obtained easily any other way). In terms of your task it will provide a reader associated with the console from which you can create a BufferedReader and proceed as you are at the moment. The emphasis with this class is the particular input source (and output destination), not the scanning.
    http://java.sun.com/javase/6/docs/api/java/util/Scanner.html
    http://java.sun.com/javase/6/docs/api/java/io/Console.html

  • JDev 10.1.3 how to invoke oc4j_remote_deploy.jar from command line?

    Hi, does anyone know how to invoke the JDev 10.1.3 oc4j_remote_deploy.jar from the command line? We have it working for 10.1.2, for automated deployment scripts.
    If I try the same thing for 10.1.3, I get an error.
    See below my command line and the output.
    I think the error is in the Oc4jDcmServlet URL, the format seems to have changed from 10.1.2 to 10.1.3.
    I tried to reverse-engineer by using an HTTP tracer, but that did not help.
    Any help would be much appreciated.
    Regards, Maarten Brugman
    ======================== command line: ==================
    "C:\j2sdk1.4.2_09\bin\java.exe" -Djava.protocol.handler.pkgs=HTTPClient -jar C:\jdev-work\ebrp-new\ear\target\installer\oc4j_remote_deploy.jar http://lnvx0027:29805/Oc4jDcmServletAPI/ oc4jadmin ***** listApplications /oracle/oaedv03/oracle/oas/10.1.3/ontwj2e1013 UNDEFINED UNDEFINED OC4J_OEBRP
    ============ output: ====================================
    Initializing log
    Servlet interface for OC4J DCM commands
    Command timeout defined at 600 seconds
    Executing DCM command...
    Executing command listApplications /oracle/oaedv03/oracle/oas/10.1.3/ontwj2e1013
    UNDEFINED UNDEFINED OC4J_OEBRP
    Command = LISTAPPLICATIONS
    Opening connection to Oc4jDcmServlet
    Setting userName to oc4jadmin
    Sending command to DCM servlet
    **** Could not check HTTP response code
    ** Thread[main,5,main] ** Fri May 11 17:18:13 CEST 2007 ** ** EXCEPTION: java.
    net.SocketException: Unexpected end of file from server
    java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:822)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:711)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:820)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:711)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
    nection.java:635)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:272
    at oracle.j2ee.tools.remote_deploy.Oc4jDcmClient.isHttpResponseOk(Unknow
    n Source)
    at oracle.j2ee.tools.remote_deploy.Oc4jDcmClient.sendCommand(Unknown Sou
    rce)
    at oracle.j2ee.tools.remote_deploy.Oc4jDcmCommand.execute(Unknown Source
    at oracle.j2ee.tools.remote_deploy.Oc4jDcmCommand.listApplications(Unkno
    wn Source)
    at oracle.j2ee.tools.remote_deploy.Oc4jDcmMain.main(Oc4jDcmMain.java:71)
    #### HTTP response is NOT ok
    Closing connection to Oc4jDcmServlet
    #### DCM command did not complete successfully (-1)
    #### HTTP return code was -1
    ============ end output =================================

    In my opinion, you will succeed in handling linefeeds in output texts by using an <tt><af:outputFormatted></tt> tag in conjuction with a JSF converter that replaces the linefeeds with a <tt>&lt;br></tt> tag in the text. You will have to implement a custom converter class (this is quite simple, see below) and to set it to the <tt>converter</tt> attribute of the <tt><af:outputFormatted></tt>. The converter class should look like:
    public class MyLinefeedConverter implements javax.faces.convert.Converter
      public MyLinefeedConverter() {
      public Object getAsObject(FacesContext context, UIComponent component, String value) {
        return value;
      public String getAsString(FacesContext context, UIComponent component, Object value) {
        if (value==null) return "";
        if (value instanceof String) return ((String)value).replace("\n", "<br>");
        return value.toString();
    }In this way the linefeeds in your text values will be replaced by <tt>&lt;br></tt>, which will be rendered by the corresponding <af:outputFormatted> tag as line breaks.

  • CANNOT_START-UP: Stars in Command-Line-Mode: "Deallocation of a pointer not

    HELLO EVERYONE, PLEASE CAN YOU HELP ME...
    My computer: Mac OS X (10.3.9) had froze, couldn't force quit..and i forced started it by holding the power button. Restarted it, came on: the grey-screen and apple, spinning-gear...satayed like that long time then it went into Command-Line_Mode.
    Darvin,
    UserName:
    Password:
    I enterded UserName and Password, but could not start in normal ways.
    Now when I start-up the computer, Command-Line opens with only:
    :/root#
    and a curser-point.
    I have been reading all the leads that I found in the discussions, tryed most of the suggestions: fsck (/sbin/fsck -fy), Safe-Mode (didn't start in), couldn't start up from CD.
    COMMAND-LINE (at one time it said like this):
    *God boot device= IOService:/MacRISCZPE?pci@f2000000/AppleMacRiscPCI/*
    *mac-io@17/AppleKeyLargo/ata-4@1f000/KeylargoATA/ATADeviceNum@0/IOATABlockStorag eDrive/IOATABlockStorageDevice/IOBlockStorageDriver/ST340810A.Media/IOAppleParti tionScheme/MacOS@5 BSD root: diskOs5, Major 14, minor 5*
    *Feb 22 14:32:25 mach_init[2]:Started with uid=0 audit-uid=-1*
    *Feb 22 14:32:25 init:ignoring exwss arguments/etc/rc.boot:cannot dublicate*
    *fd-1048577 to fd 1: Bad file descriptor*
    **malloc[3]: Dealocation of a pointer not malloced: 0x710; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug*
    *at an other time after using fsck*
    Command-Line-Interface:
    *:root#/sbin/fsck -fy*
    **/dev/rdiskOsF
    *Root file System*
    *Checking HFS Plus volume.*
    *Checking Extents Overflow file.*
    *Checking Catalog file.*
    *Keys out of order*
    *(4, 8874)*
    *Rebuilding Catalog B-tree.*
    *The Valume Macintosh could not be repaired.*
    PLEASE HELP!
    WHAT Should i do?
    If nothing works, could i start-up from OS 9.2.2? (Both Systems OSX and OS_9.2.2 were installed)
    If the B-tree is corrupt, does it being shared by both OSX and OS_9.2.2?
    THANK YOU

    Hi Kappy,
    Thank you for taking an interest.
    I already tryed to start_up from CD, but it either didn't started-up
    or it started still in Command-Line-Mode.
    Put the CD in the tray, startedUP with the C_Key Held.
    It took a little longer and seemed it was going to start from CD but went into CommanLine again.
    but instead of
    :/root#
    it said something else, something like:
    2e_sh.. (Something! i could redo it and write it down here if it will help)
    Other times i tryed to bootUP from CD by holding-down the Option-Key and saw the install-CD icon next to
    OSX-Icon, so i chose the CD and hit the Straight-ARROW-Icon to start up from the CD, but again it fell
    into CommandLine.
    If i try the Target-Disk-Mode with a healty-Mac, could i be able to see my HD. Then i can switch to
    OS_9.2.2 which i spose is healty because i was using OS_10.3 when this problem happened. And the way
    i think, if the B-tree Catalog is not being shared by both Systems, if each have its own one, then the
    OSX's B-tree Catalog have been corrupted, not OS9's, and so if i could change the start-up-system(Disk)
    somehow, i could be able to start the computer with OS_9.2.2 running. Both systems were installed,
    and i was switching back and forth between them. Then i can fix my computer by, at least, starting
    to throw away some of the junk and so making some free-space.
    I had read that HD should not be full more than 85%. I had 2.5GB space left out of 40GB.
    But if there is a risk that things like this could happen because your HD is too full;
    why arn't they (Apple) fix this, buy, at least, showing as if you HD is full before it gets
    too full to leave a safety net for the B-tree Catalog files evidently that need to be written
    in continuous blocks on the HD.
    So thank you again, and keep me posted if you might think something else could fix my computer. I need
    this computer.
    thanks

  • How to give filename at Command Line

    Hi,
    what do I do to make sure that when my user gives a command line argument like "-Dn" and then a filename , the system writes to that file.
    I have everything working properly and can achieve the same thing using a properties file, but do not know what to do in this case. Here is a snippet from my code:
    if(args.equalsIgnoreCase("-Dn")) {
         obj.setLogFileName(); //what to do here???
    The setLogFileName method resides in a class which writes to the disk and is working properly
    Thankx in advance...

    If you are usgin the command line syntax you are describing, like "java MyClass [arguments]" you can just go on traversing the argument list:
    String fileName = args[0];
    However, you can also do this as follows:
    java -Dlogfile=<the path> MyClass [arguments]
    In that case the <the path> string is available as a system property named "logfile", and can be retrieved as this:
    String fileName = System.getProperty( "logfile" );

  • Parsing in Weblogic/jsp doesn't work; application-mode (command-line) works

    Hello-
    Parsing my XML file in Weblogic/jsp doesn't work, whereas it works
    in application-mode... (albeit on two different machines)
    Here are the parameters:
    server1:
    weblogic 6.0
    win2k server
    jre1.3
    my personal machine:
    ***no weblogic***
    win2k server
    jre1.3
    When I run my code as an application (command-line style) on my machine,
    parsing in my xml file works fine, and I can do a root.toString() and it
    dumps out the entire xml file, as desired.
    However, running my code inside weblogic (on server1) in JSP, parsing in
    my file and doing a root.toString() results in the following: [dmui: null]
    (where dmui is my root)
    (even though i'm running it on two different machines, i'm positive its the
    same code (the servers share a mapped drive)...
    So, I think its probably because I'm using a different parser, as
    specified by weblogic? There are no exceptions being thrown. Here's my
    (abbreviated) code, which is called either command line style or in a JSP:
    // Imports
    import org.w3c.dom.*;
    import org.w3c.dom.Document;
    import javax.xml.parsers.*;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    DocumentBuilderFactory docBuilderFactory =
    DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    mDocument = docBuilder.parse (inFile);
    myRoot.toString()
    -END
    Doing a System.getProperty("javax.xml.parsers.DocumentBuilderFactory")
    results in:
    server1 (weblogic/jsp):
    "weblogic.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
    my machine (application-mode):
    null
    Does anyone have any ideas about how to get this work? Do I try to set it
    up so that they both use the same parser? Do I change the Weblogic parser?
    If so, to what? And how?
    Am I even close?
    Any help would be appreciated..
    Thanks, Clint
    "[email protected]" <[email protected]> wrote in message
    news:[email protected]...
    No problem, glad you got it worked out :)
    ~Ryan U.
    Jennifer wrote in message <[email protected]>...
    I completely missed setting the property(:-o), foolish mistake. That wasit. Thanks.
    "j.upton" <[email protected]> wrote:
    Jennifer,
    Personally I would get rid of import com.sun.xml.parser.* and use xerces
    which comes with WLS 6.0 now, unless like I said earlier you have a need
    to
    use the sun parser :) Try something like this with your code --I've put
    things to watch for as comments in the code.
    import javax.xml.parsers.*;
    import org.xml.sax.SAXException;
    import org.w3c.dom.*;
    import java.io.FileInputStream;
    public class BasicDOM {
    public BasicDOM (String xmlFile) {
    try{
    FileInputStream inStream;
    Document document;
    /*You must specify a parser for jaxp. You can in a simple view
    think
    of this as being analogous to a driver used by JDBC or JNDI. If you are
    using this in the context of a servlet or JSP and have set an XML
    registry
    with the console this happens automatically. You can also invoke it in
    the
    context of an application on the command line using the -D switch. */
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
    >>>
    "weblogic.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
    // create a document factory
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    // specify validating or non-validating parser
    dbf.setValidating(true);
    // obtain a factory
    DocumentBuilder db = dbf.newDocumentBuilder();
    // create a document from the factory
    inStream = new FileInputStream(xmlFile);
    document = db.parse(inStream);
    }//try
    catch (Exception e)
    System.out.println("Unexpected exception reading document!"
    +e);
    System.exit (0);
    }//catch
    }//BasicDom
    // Main Method
    public static void main (String[] args) {
    if (args.length < 1)
    System.exit(1); file://or you can be more verbose
    new BasicDOM(args[0]);
    }//class
    =============================================
    That will give you a basic DOM you can manipulate and parse it fromthere.
    BTW this code
    compiled and ran on WLS 6.0 under Windows 2000.
    Let me know if this helped or you still are having trouble.
    ~Ryan U.
    "Jennifer" <[email protected]> wrote in message
    news:[email protected]...
    Actually I included com.sun.xml.parser.* as one last febble attempt toget
    it working.
    And as for source code, I included the code. If I just put that oneline
    of code
    in, including the imports, it fails giving me an error listed above inthe
    subject
    line. Here is the code again:
    package examples.xml.http;
    import javax.xml.parsers.*;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.w3c.dom.*;
    import java.util.*;
    import java.net.*;
    import org.xml.sax.*;
    import java.io.*;
    public class BasicDOM {
    static Document document;
    public BasicDOM (String xmlFile) {
    try {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    } catch (FactoryConfigurationError e){
    System.err.println(e.getException());
    e.printStackTrace();
    // Main Method
    public static void main (String[] args) {
    BasicDOM basicDOM = new BasicDOM (args[0]);

    Hi, Rob
    Does it work in WL9.2?
    It seems I do it exactly as the explained at http://edocs.bea.com/wls/docs81/programming/classloading.html - and it fails :o(.
    I try to run my app.ear with WL9.2 There are 2 components in it: webapp and mdb. The webapp/WEB-INF contains weblogic.xml:
    <weblogic-web-app>
    <container-descriptor>     
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
    </weblogic-web-app>
    Mdb is expected to run in the same mode, i.e. to prefer the webapp/WEB-INF/*.jar over the parent Weblogic classloader. To do so I add the weblogic-application.xml to the app.ear!/META-INF:
    <weblogic-application>
    <classloader-structure>
    <module-ref>
    <!-- reminder: this webapp contains
    prefer-web-inf-classes -->
    <module-uri>webapp</module-uri>
    </module-ref>
    <classloader-structure>
    <module-ref>
    <module-uri>mdb.jar</module-uri>
    </module-ref>
    </classloader-structure>
    </classloader-structure>
    </weblogic-application>
    Now, when classloader-structure specified, both webabb and mdb prefer the weblogic root loader as if prefer-web-inf-classes not defined at all.

Maybe you are looking for