Problem: '\' character of file location disappears

Hi
I am trying to pass the location of a file on local disk as parameter to a java function... the function accepts 'String' type... but when I do this... the '\' characters in the location disappear.
For Example: If C:\Documents and Settings\Hllo\Desktop\trials is passed then it appears as C:Documents and SettingsHlloDesktop       rialsI dont understand what is happening... any pointers....?
How do I overcome this? Please help..

Ok,
This is what I am trying to do:
1. From a web page a user selects a file
2. On a button click, JavaScript function gets invoked and the file location is stored in a local variable and passed as parameter.
3. I am using DWR (AJAX), where the server side code 'FileOpener' will accept this string as parameter and tries to open the file.
So therefore I need something in this server side code to escape the backslash characters from the received argument.... How do I do it?
At present this is what I am doing and it shows me error:
BufferedReader read = new BufferedReader(new FileReader(fileLocation));
while((line = read.readLine()) != null) {
                   str = str + " " + line ;
read.close();

Similar Messages

  • Problems with file locations

    Hi,
    I've done a file location, but I've problems when I register the location with the next root path (This directory is on my local host):
    c:\test\
    All works fine, but when I execute the mapping that contais the file (prueba.dat), I obtain the next error:
    SQL*Loader-500: Unable to open file (c:testprueba.dat)
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    I have problems with the character "\", because it doesn't appear in the file name (view SQL*Loader-500).
    I'm using Windows XP as local host, Oracle Wareuse Builder installed on a Linux Machine, version 9.2.0.4.0
    Any idea of what could happen?
    Thanks in advance,
    Carlos.

    I am using the client OWB11 through CITRIX (an emulator Xterm - similar to anyone else). In the configuration of my locations, I am not using local directories of my Win, I use only unix directories, such as (/ swpkg/oracle/11g/owb/bin/unix). Now DBAdministrator asked him to verify the existence of these directories.
    We attach the Log generated by OWB.
    MAP_T_ITZ_ACCOUNT_SUPPORT
    Description : Runtime User : OWBHYP Started : 2008-08-22 12:15:25.0
    Name
    Status
    Log
    MAP_T_ITZ_ACCOUNT_SUPPORT
    Error
    RPE-01013: SQL Loader reported error condition, number 1.
    SQL*Loader: Release 11.1.0.6.0 - Production on Fri Aug 22 12:15:26 2008
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    Control File: /swpkg/oracle/11g/owb/bin/unix/MAP_T_ITZ_ACCOUNT_SUPPORT.ctl
    Character Set WE8MSWIN1252 specified for all input.
    Data File: /swdata/db/ora_rman/inbound/SWPLAN_ACCOUNT.CSV
    Bad File: /swdata/db/ora_rman/inbound/bad/SWPLAN_ACCOUNT.BAD
    Discard File: /swdata/db/ora_rman/inbound/dis/SWPLAN_ACCOUNT.DIS
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 200 rows, maximum of 50000 bytes
    Continuation: Concatenate every 1 physical records
    Path used: Conventional
    Table "SWAHY_INTER"."SWA_HY_T_ITZ_ACCOUNT_SUPPORT", loaded from every logical record.
    Insert option in effect for this table: TRUNCATE
    Column Name Position Len Term Encl Datatype
    "PARENT" 1 * ; O(X) CHARACTER
    "CHILD" NEXT * ; O(X) CHARACTER
    "ALIAS" NEXT * ; O(X) CHARACTER
    "DATASTORAGE" NEXT * ; O(X) CHARACTER
    "TWOPASSCALC" NEXT * ; O(X) CHARACTER
    "UDA" NEXT * ; O(X) CHARACTER
    "SMARTLIST" NEXT * ; O(X) CHARACTER
    "DATATYPE" NEXT * ; O(X) CHARACTER
    "ACCOUNTTYPE" NEXT * ; O(X) CHARACTER
    "TIMEBALANCE" NEXT * ; O(X) CHARACTER
    "EXCHANGERATETYPE" NEXT * ; O(X) CHARACTER
    "VARIANCEREPORTING" NEXT * ; O(X) CHARACTER
    "SOURCEPLANTYPE" NEXT * ; O(X) CHARACTER
    "MEMBERVALIDFORPLAN1" NEXT * ; O(X) CHARACTER
    "PLAN1AGGREGATION" NEXT * ; O(X) CHARACTER
    "MEMBERVALIDFORPLAN2" NEXT * ; O(X) CHARACTER
    "PLAN2AGGREGATION" NEXT * ; O(X) CHARACTER
    "MEMBERVALIDFORPLAN3" NEXT * ; O(X) CHARACTER
    "PLAN3AGGREGATION" NEXT * ; O(X) CHARACTER
    value used for ROWS parameter changed from 200 to 10
    SQL*Loader-500: Unable to open file ( /swdata/db/ora_rman/inbound/SWPLAN_ACCOUNT.CSV)
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    Table "SWAHY_INTER"."SWA_HY_T_ITZ_ACCOUNT_SUPPORT":
    0 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 49020 bytes(10 rows)
    Read buffer bytes: 65536
    Total logical records skipped: 0
    Total logical records read: 0
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Fri Aug 22 12:15:26 2008
    Run ended on Fri Aug 22 12:15:26 2008
    Elapsed time was: 00:00:00.08
    CPU time was: 00:00:00.01
    SQL*Loader: Release 11.1.0.6.0 - Production on Fri Aug 22 12:15:26 2008
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    SQL*Loader-500: Unable to open file ( /swdata/db/ora_rman/inbound/SWPLAN_ACCOUNT.CSV)
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    Message was edited by:
    ignacio.vega

  • Java 7: Problems launching applets with jars on "file://" location

    Hi,
    We are experiencing a problem when updating our client's JRE from Java6 U 21 up to Java7 U 55.
    We have developed an Applet which is composed by several JAR files. Some of those JARs must be stored in local drive, and the JAR with the main Java class is stored on server.
    Let's supose we have a similar scenario like this:
    https://blahblahbah/bar.jar
    https://blahblahbah/test.html
    C:/foo.jar
    The code of test.html:
    <embed
      archive="file:///C:/foo.jar"
      cache_archive="bar.jar"
    />
    This code works fine on Java 6 and Applet is correctly loaded.
    However, with Java 7 a security exception is raised when trying to load JAR files from "file:///" location during Applet launch:
    java.lang.SecurityException: Permission denied: file:/C:/foo.jar
        at sun.plugin2.applet.Applet2Manager._loadJarFiles(Unknown Source)
    We have tried several tests using a java.policy file which grants all possible permisions:
    grant codeBase "file:/C:/foo.jar" {
        permission java.security.AllPermission;
    grant {
      permission java.security.AllPermission;
    We also tried to low Java's security level to "MEDIUM", with no success.
    We finally only managed to run the Applet if we explicity disable the "Next-Generation Plugin" with Internet Explorer 8. However, that's not a suitable solution, and still does not work with Mozilla family browsers.
    Eventhought with Mozilla browsers is still not working.
    Is there any restrictions in Java 7 that prevents to read jars from being loaded from local drive when launching Applets?
    Thanks in advance,

    Thank you baftos.
    I had read the whole message before posting mine. It's not the same problem. I'm able to run the sample signed applet always having the jar in the same location than the HTML page serving the applet via JNLP:
    <jar href="SignedAppletTest.jar" main="true"/>
    However, the security exception raises when trying to read that jar from local drive:
    <jar href="file://C:/SignedAppletTest.jar" main="true"/>
    ExitException[ 3]java.lang.SecurityException: Permission denied: file://C:/SignedAppletTest.jar
        at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
    I have even tried to decompile JNLP2Manager class, without seeing anything useful on that loadJarFiles method
    The only way I managed to avoid the problem is unchecking the New Generation Plugin and running the Applet with IE. Not a suitable solution for me at all..

  • Error writing to temporary file location. If this problem persists contact customer support. (-70)

    I've been trying to update/install Creative Cloud applications via Adobe Application Manager and no matter which application I try to install I receive this error: "Error writing to temporary file location. If this problem persists contact customer support. (-70)"
    Prior to this I was having trouble running updates to an application, and it told me I needed "Administrative Privleges" to do so. I have tried everything I can think of with the assistance of the Apple Store. Can anyone at Adobe help me?

    You do not have the permission on the TMP folder for write because of which you are facing the issue.
    Tmp folder is hidden on the Mac hence you have to unhide it first to check the permission and getting it corrected.
    I would recommend you to check the install/update from
    1) New user account
    2) Run the Disk repair utitlity
    if these steps doesn't help then contact support to get the permission corrected.

  • Problems with file location variables and Oracle 9i

    I'm new to Oracle and I'm seeing if I can get Oracle 9i running and do anything useful for me on a Solaris 9 platform.
    The installation of Oracle went OK except step three, creating a starter database. The installation wanted to put it on the same file system as {ORACLE_HOME} although I told the installation that I wanted {ORACLE_BASE} on another file system. So of course there wasn't enough room on the file system to make the starter database.
    I thought I'd be able to correct this after installation. I tried to make a General Purpose Database with Database Configuration Assistant but DBCA in step 5 of 7, File Location Variables still shows {ORACLE_BASE} to be the same as {ORACLE_HOME}, and no way to change that variable on this screen. Don't I want to change { ORACLE_BASE} to a file system that has enough space to make the data base? How do I change this variable? When logged in as the oracle user, I don't see it listed by setenv.
    When I ignored this setting and tried to finish DBCA, it hung.

    I looked for the {ORACLE*} environmental variables in the profile and login files of my oracle user, but didn't find that they were added by my Oracle setup. So I didn't think defining them as environmental variables would persist or overrule the global variables set at dbca run time.
    In the dbca windows, step 5 displays these global variable settings provocatively in a table, as if Oracle wants me to verify and edit them if necessary, but I keep poking at them with right mouse clicks, left mouse clicks, backspace, and delete, but all I can do is turn them blue.
    Currently when I use dbca to try to create a general purpose database, it hangs at 50% done, but not much space is used up on {ORACLE_HOME}. So it doesn't really look like the hang is caused by the disk being full. One of the processes that is hung is jre, so I thought I'd review the Oracle requirements and locations for JRE on my system.

  • XI2 scheduling to file location problem

    source file error. CrystalEnterprise.DiskUnmanaged: The system cannot find the path specified.
    I receive the above error when scheduling to put a file in a file location.
    I have used the format
    servername\directory\subdirectory\subdirectory
    and
    servername\directory\subdirectory\subdirectory
    The scheduler appears to change all \ to / - not sure if this is relavent
    Previously I was receiving file cannot be found error and I replaced a space in the path name with %20 and I received the cannot find path specified.

    I am using XI 3.1, so I am not sure whether this is the enhancement compared to XI R2.
    I have used Directory path llike
    //servername/directory/subdirectory/subdirectory
    & it works fine.
    -Raghu

  • Problem opening ses_v011 file

    Hi there,
    I made a project in encore in CS5 a while ago and burned some DVDs from it.  Now I want to open the project and it keeps asking me to locate asset 'Baby Room Motion Menu.m2v".  In the 'sources' folder there is a folder called "Baby Room Motion Menu.m2v_ses_ses" and in the folder is a file called "Baby Room Motion Menu.ses_V011" but this file doesn't show up when 'all formats' is selected, only when 'all files' is selected.  When I select it and Encore tries to open, it says: "The software that's used to decode the media is not available on this sytem.  Installing the correct decoders for the files you are woking with may help to correct the problem".  NB there are 2 such files I need to locate to open this project and without them, my menu has disappeared.
    This is a new computer after the old computer died.  I only installed the CS5 Master Collection programs I have used (including Encore, Premiere Pro, After Effects, Soundbooth).  Do I have to install the whole Master Collection?  Or would there be a problem with the file?  Or some other problem?  It took me ages to figure out how to do the menu in the first place as I am new to this stuff so I would dearly love not to have to do it all again.
    Thanks for your help

    I don't think It is looking for a sess file. The "Baby Room Motion Menu.m2v" is in the library, and is used to create a new m2v when rendered.
    Do you have the library loaded on your computer?

  • Baggage Files keep disappearing

    I am aware of the RH6 issue of the baggage files not being
    able to be added the traditional way, and the user having to add
    them manually in rhbag.apj file. I have done that and they do work
    after that is done, but my problem is that they keep disappearing
    after some time, and I will have to go in manually to add them
    again. I add them, they work, and then after a couple days and a
    couple compilations they are removed again and my link doesn't work
    of course. Does anyone know a work-around to this, and how to make
    them permanently stick? Or, am I to accept this nuisance and find a
    different method for displaying these files? Any advice is greatly
    appreciated!
    Danni

    I link to .pdf files from the TOC with no problem.
    Danni, you mention,
    "...and the user having to add them manually in rhbag.apj
    file."
    I always import baggage files in the RH explorer view, and I
    let RH take care of the rhbag.apj file. (This is not to reject my
    colleagues' advice to edit the file. It may be necessary. I haven't
    needed to do that.)
    RH also keeps the baggage file list in a database table in
    the .cpd file. It has a separate table for links to baggage files.
    On the rare occasion when I have a problem, I discover an
    error in the database table. For example, each topic and baggage
    file has an ID number, and sometimes a file ID acquires a "minus"
    sign. Normally that's a "missing file" flag, but RH can't reconcile
    the database flag with the file's presence in the project folder.
    Open a backup copy of the .cpd file in MS Access, go to
    tables view and open the ones for baggage files. If you see a
    negative topic or file ID, and you know the file is in the
    project's Windows directory, delete the minus sign.
    If you see entries for baggage files that you know are
    obsolete, and you've removed them in RH and the project directory,
    delete those entries. Save before you exit from Access.
    Access may warn that you won't be able to save any changes
    unless you convert the database file to your current version of
    Access. I've ignored this warning and successfully saved changes.
    On the other hand, I don't believe any harm would come from
    updating.
    Temporarily change the name of the original cpd file and
    substitute the revised copy with the correct file name.
    Launch RH and open the project. The baggage files should be
    straightened out, but if not, try importing the "missing" ones from
    a location outside the project directory. (The corollary is that
    you shouldn't try to import a baggage file that's already in the
    project directory and may be in the rhbag.apj list as well. That's
    what sometimes confuses RH.)
    Interestingly, when you import a file that RH previously
    couldn't find, sometimes the import dialog says the baggage file is
    already in the project, do you want to overwrite it? Just say yes.
    Don't try to explain it, because RH can't tell you why it has to
    overwrite a file that isn't there.
    Of course, you have the option of going back to the original
    .cpd file by removing the new one and renaming the old one.
    Sometimes I start by making a copy of the entire project, but then
    I have to label and remember which folder contains the version I
    want to use later. Don't use the "recent projects" list in RH
    unless you revised the project name for the copy.
    Harvey

  • Read character from file

    Hi,
    I coded a program that reads a given integer.  The integer represents a character location in another file.  The program then opens a text file.  The program is supposed to goto the integer laction and read 500 characters past that location.  I  am unable to get the program to goto the correct location in the file.  If I give an integer value like 135159, the program goes the location it claims is correct, but it is not.  Are there any constant values that LV uses when reading file locations?  In my file there are 71 characters per line, 70 real characters and 1 line feed.
    Adam
    Attachments:
    Find in other sequence_14.zip ‏258 KB

    The problem is your offset doesn't take into account the file header or the end of lines.  So, when you read from file, it includes all those characters.  I wrote a little VI that will calculate the "true offset."  Now, one point of confusion for me is that I had to enter the original spot (in your example 357750) to get what you said is the right point for the -500 spot.  I would have thought I would have to take the 500 into account, as going 500 back also covers line feeds (in this case 7), but if you say that the spot you have is the correct spot, then do this with the desired offset not included.
    You can avoid this by reading the file in, stripping the header, and removing all the line feeds.  Your data should be one contiguous stream at that point.  But, you will need to determine if loading the whole file to do this is practical.  With this calculation, you can do it a byte at a time if you wish.
    Message Edited by Matthew Kelton on 10-28-2007 10:17 PM
    Attachments:
    front panel.png ‏5 KB
    block diagram.png ‏4 KB

  • On Finder Freeze/Relaunch All my desktop files & icons disappear

    The title sums it up.
    When ever my mac decides to go into spinning wheel mode and I have to force quit/relaunch finder, when I relaunch finder every desktop file & icon disappear.
    At that point I'm forced to push the shutdown button on the tower and reboot, then all is well until the next time.
    And the next time could be a day or a few days or a week. No rhyme or reason why.
    Please help me solve this frustrating problem.
    Thanks
    497secrets

    Cloud backup plans can slow your Mac down, and if used simultaneously with your Mac's networking, or you have an unreliable internet connection, could be the cause of your freezes.  You may be better off seeing if turning off iCloud temporarily helps.   This can especially be a problem with non-Apple routers whose firmware may not be up to date.   Multitasking with backups can lead to corruption of your backups.  Time Machine should only backup to hard drives twice the capacity of the original, otherwise it spends a lot of time trying to discover which archives to eraes to maintain room.  Here are some other options:
    https://discussions.apple.com/docs/DOC-1992
    Energy Saver can also create problems for backups, as it takes a moment for the Mac to recognize the connection.  Use screen saver instead of Energy Saver when backing up.  System Preferences lets you control both.   Putting hard drives to sleep when backing up is ill advised.

  • Problem with attaching file to Sales Order

    Hello,
    In my company we have the possibility to attach files to sales orders, e.g. pdf files with the printing details.
    These files are added by the GUI user, this works fine.
    Now we have an extra order creation stream in which a pdf file has to be added to the SO without user interaction.
    I found a helpful link ( /people/rammanohar.tiwari/blog/2005/10/10/generic-object-services-gos--in-background )
    This program creates URL links with no problem, but the file generation is not implemented yet.
    I tried to add the file functions to his sample report but still have one problem. The file is uploaded, but not reported as a PDF file in sap. If I select the created attachment SAP allows only the saving of the attachment. After saving the created file is a good PDF file, it opens with PDF-viewers.
    Why does SAP not know this is a PDF file and report it as such (and open the pdf viewer when selected).
    Thanks, Frank.
    source-code:
    REPORT  zzfb_brc                                .
    * Report  Z_RMTIWARI_ATTACH_DOC_TO_BO
    * Written By : Ram Manohar Tiwari
    * Function   : We need to maintain links between Business Object and
    *              the attachment.Attachment document is basiclally a
    *              business object of type 'MESSAGE'.In order to maintain
    *              links, first the attachment will be crated as Business
    *              Object of type 'MESSAGE' using Message.Create method.
    *              Need to check if we can also use FM
    *              'SO_DOC_INSERT_WITH_ORIG_API1' or SO_OBJECT_INSERT rather
    *              than using Message.Create method.
    * I took this program and removed all the parts for adding URL's and
    * notes.
    * Include for BO macros
    INCLUDE : <cntn01>.
    * Load class.
    CLASS cl_binary_relation DEFINITION LOAD.
    CLASS cl_obl_object      DEFINITION LOAD.
    PARAMETERS:
    *  Object_a
       p_botype LIKE obl_s_pbor-typeid DEFAULT 'BUS2032',    "SO
       p_bo_id  LIKE obl_s_pbor-instid DEFAULT '0000757830', "example number
    *  Object_b
       p_docty  LIKE obl_s_pbor-typeid DEFAULT 'MESSAGE' NO-DISPLAY,
       p_msgtyp LIKE sofm-doctp        DEFAULT 'EXT'     NO-DISPLAY,
    *  Relationship
       p_reltyp  LIKE mdoblrel-reltype DEFAULT 'ATTA'.
    TYPES: BEGIN OF ty_message_key,
            foltp     TYPE so_fol_tp,
            folyr     TYPE so_fol_yr,
            folno     TYPE so_fol_no,
            doctp     TYPE so_doc_tp,
            docyr     TYPE so_doc_yr,
            docno     TYPE so_doc_no,
            fortp     TYPE so_for_tp,
            foryr     TYPE so_for_yr,
            forno     TYPE so_for_no,
           END OF ty_message_key.
    DATA : lv_message_key TYPE ty_message_key.
    DATA : lo_message TYPE swc_object.
    DATA : lt_doc_content TYPE STANDARD TABLE OF soli-line,
           ls_doc_content TYPE soli-line.
    * Create an initial instance of BO 'MESSAGE' - to call the
    * instance-independent method 'Create'.
    swc_create_object lo_message 'MESSAGE' lv_message_key.
    * Upload the pdf file, for now from the frontend, in the future from
    * the server.
    DATA:
    *  dsn(40) TYPE C VALUE '/usr/sap/trans/convert/1.pdf', "server location
    l_lines TYPE i. "filelenght
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename   = 'c:t1.pdf'
        filetype   = 'BIN'
      IMPORTING
        filelength = l_lines
      TABLES
        data_tab   = lt_doc_content.
    * no exceptions, the file is there in this example
    break brouwersf.
    ** the coding for the server input, for later
    *OPEN DATASET dsn FOR INPUT IN BINARY MODE.
    *IF sy-subrc <> 0.
    *  EXIT.
    *ENDIF.
    *READ DATASET dsn INTO ls_doc_content.
    *WHILE sy-subrc EQ 0.
    *  APPEND ls_doc_content TO lt_doc_content.
    *  READ DATASET dsn INTO ls_doc_content.
    *ENDWHILE.
    *CLEAR ls_doc_content.
    *CLOSE DATASET dsn.
    * define container to pass the parameter values to the method call
    * in next step.
    swc_container lt_message_container.
    * Populate container with parameters for method
    swc_set_element lt_message_container 'DOCUMENTTITLE' 'Title'.
    swc_set_element lt_message_container 'DOCUMENTLANGU' 'E'.
    swc_set_element lt_message_container 'NO_DIALOG'     'X'.
    swc_set_element lt_message_container 'DOCUMENTNAME' p_docty.
    swc_set_element lt_message_container 'DOCUMENTTYPE' p_msgtyp.
    swc_set_element lt_message_container 'DocumentSize'    l_lines.
    swc_set_element lt_message_container 'DocumentContent' lt_doc_content.
    swc_call_method lo_message 'CREATE' lt_message_container.
    * Refresh to get the reference of create 'MESSAGE' object for attachment
    swc_refresh_object lo_message.
    * Get Key of new object
    swc_get_object_key lo_message lv_message_key.
    * Now we have attachment as a business object instance. We can now
    * attach it to our main business object instance.
    * Create main BO object_a
    DATA: lo_is_object_a TYPE sibflporb.
    lo_is_object_a-instid = p_bo_id.
    lo_is_object_a-typeid = p_botype.
    lo_is_object_a-catid  = 'BO'.
    * Create attachment BO object_b
    DATA: lo_is_object_b TYPE sibflporb.
    lo_is_object_b-instid = lv_message_key.
    lo_is_object_b-typeid = p_docty.
    lo_is_object_b-catid  = 'BO'.
    *TRY.
    CALL METHOD cl_binary_relation=>create_link
      EXPORTING
        is_object_a = lo_is_object_a
        is_object_b = lo_is_object_b
        ip_reltype  = p_reltyp.
    * Check if everything OK...who cares!!
    COMMIT WORK.

    Hi,
    Welcome to the SDN Forums!!!
    You need to supply the PC file extension in the container element 'DOCUMENTTYPE'.
    swc_set_element lt_message_container 'DOCUMENTTYPE' p_msgtyp.
    In your case change the above statement as below:
    swc_set_element lt_message_container 'DOCUMENTTYPE' 'pdf'.
    <b>OR</b> change the default value of p_msgtyp to 'PDF'.
    Cheers,
    Ramki Maley.
    Please reward points if the answer is helpful.
    For info on awarding points click on this link: https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm
    Message was edited by: Ramki Maley

  • Program cutting off 1st character in file

    Hi I have this weird problem.
    My problem takes a file read it and places in into a JTable. It seems that during the read, the 1st character gets chopped off.
    public class Main {
        //Variable declarations
        private JFrame f;
        private JPanel p;
        private JLabel lengthLabel, partitionLabel, ladderLabel;
        private JTextField lengthTF, partitionTF;
        private JComboBox ladderLB;
        private JTable table;
        public Main() {
            createTable();
            createPanel();
            createAndShowGUI();
        private void createAndShowGUI() {
            f = new JFrame("Calculate MW");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(p);
            //f.setSize(250, 400);
            f.setSize(400, 400);
            f.setResizable(false);
            f.setVisible(true);
        private void createPanel() {
            p = new JPanel(new BorderLayout());
            p.add(table.getTableHeader(), BorderLayout.PAGE_START); // Set the table header
            p.add(table, BorderLayout.CENTER);
        private void createTable() {
            // Variables
            String[] colNames = {"One", "Two", "Line"};
            String[][] data = new String[3][30];
            data = getLadder(new File("ladder.txt"));
            table = new JTable(data, colNames);
            JScrollPane sp = new JScrollPane(table);
            // Set 1 column uneditable
            JTextField tf = new JTextField();
            tf.setEditable(false);
            TableColumn distCol = table.getColumnModel().getColumn(0);
            distCol.setCellEditor(new DefaultCellEditor(tf));
            distCol.setCellRenderer(null);
            // Setup table
            table.setColumnSelectionAllowed(false);
            table.getTableHeader().setResizingAllowed(false);
            table.getTableHeader().setReorderingAllowed(false);
            table.setRowSelectionAllowed(false);
        private String[][] getLadder(File file) {
            String[][] sa = new String[30][3];
            try {
                BufferedReader reader = new BufferedReader(
                        new FileReader(file));
                reader.read();
                String line;
                String [] temp;
                int x = 0;
                while ((line = reader.readLine()) != null) {
                    if (line.length() > 0) {
                        temp = line.split("\\t");
                        sa[x][0] = temp[0];
                        sa[x][1] = temp[1];
                        sa[x][2] = line;
                        x++;
            catch (IOException e) {
                System.out.println(e.getStackTrace());
                System.out.println(e.getMessage());
            return sa;
        public static void main(String[] args) {
            Main black = new Main();
        }This is the input file:
    220     2.1
    160     2.7
    120     3.4
    100     3.75
    90     3.95
    80     4.35
    70     4.85
    60     5.3
    50     6.15
    40     7.2
    30     8.45
    25     9.25
    20     10.0
    15     11.5
    10     12.95What appears on the 1st row in the JTable is
    20     2.1     20 2.1The 1st character was removed. Anyone can help or know what is wrong?
    Desmond

            try {
                BufferedReader reader = new BufferedReader(
                        new FileReader(file));
                reader.read();   // <----- Your problem is right here.  Why are you doing this?
                String line;
                String [] temp;
                int x = 0;
                while ((line = reader.readLine()) != null) {
                    if (line.length() > 0) {
                        temp = line.split("\\t");
                        sa[x][0] = temp[0];
                        sa[x][1] = temp[1];
                        sa[x][2] = line;
                        x++;
            }

  • Error while accessing a file located in the server from JSP

              Hi
              I am having problem while accessing the file located in the server from a JSP
              page. I am not getting the RealPath from a JSP page using getRealPath(request.getServletpath()).
              The same code is working if the jsp placd under defaultwebApp directory and not
              working if i create a war and deploy the same.
              I am using weblogic server 7.0 trail version.I am setting the context path also.
              Can any help me in this regard.
              Thank And Regards
              Anand Mohan
              

              Hi
              Thank you.Is there a way to read a file which is existing in the war file.
              Regards
              Anand Mohan
              "Wenjin Zhang" <[email protected]> wrote:
              >
              >In Weblogic, if your files are archived in a WAR, you cannot get an entry
              >as individual
              >file since it is only bytes in a large archive file. So getRealPath will
              >give
              >you null result. If you only want the path, try to use other getXXXPath,
              >getURL,
              >or getURI method. If you want to read the content, use getResource.
              >
              >
              >"Anand" <[email protected]> wrote:
              >>
              >>Hi
              >>I am having problem while accessing the file located in the server from
              >>a JSP
              >>page. I am not getting the RealPath from a JSP page using getRealPath(request.getServletpath()).
              >>
              >>The same code is working if the jsp placd under defaultwebApp directory
              >>and not
              >>working if i create a war and deploy the same.
              >>
              >>I am using weblogic server 7.0 trail version.I am setting the context
              >>path also.
              >>
              >>Can any help me in this regard.
              >>
              >>Thank And Regards
              >>
              >>Anand Mohan
              >
              

  • Only two hard drives - optimal file locations?

    Hi,
    Can anyone tell what would be the optimal file location configuration (regarding perfomance) when there are only two physical hard drives available? One is abviously running the OS (Windows XP), but how to locate raw images, ACR cache and catalog-files for optimal performance (and are there any other file locations to consider from LR point of view)? The search did not provide answer to this question, and with google everything pretty much boils down to having (at least) three physical hard drives or RAID-array, which are not an option for me.
    The workstation can have only two internal drives but allows dedicated controllers for both of them, and I would prefer not to have external drive (only USB2 and FW400 connectors available). Memory is already maxed for the current mother board, and disk activity seems to be next place to optimize. The current performance is "ok", but it would not hurt to squeeze a bit more.
    Running Windows XP and LR 2.3.
    Thanks in advance.

    Thank you for your advice. It has been quite a pain to find out credible setup hints for simple two drive setup.
    This slightly differs from original topic, but...
    Have there been more inprovements within 2.4 code than have been mentioned in release notes (e.g. http://thelightroomlab.com/2009/06/lightroom-24-and-adobe-camera-raw-54-available/)? I have currently no need for additional camera support, and the bugs mentiones as "fixed" have not been a problem for me. I have had some cases with inconsistent plug-in behaviour (and few crashes) with export plug-ins, but I have judged those as problems either with SDK or plug-in itself.

  • ITunes keeps changing file locations to something wrong when syncing

    I have my music stored on a Synology DS409 NAS which is mounted using afp as /Volumes/music. I also have another mount from the same NAS as /Volumes/photo. Whenever I try syncing my iPhone or an iPod, I get errors about some files not syncing because they could not be played.
    On looking at some of these files in iTunes using Get Info, the location has been changed from its original (correct) /Volumes/music/xx to some random picture file under /Volumes/photo/xx
    I know the original file was correct because I've checked the iTunes Library xml file for any occurrence of "photo" and found none before syncing. I can manually fix the errors by deleting them items from iTunes and re-adding them, but I then get more errors on different files when syncing next.
    I used to have the iTunes server feature turned on on the Synology DS409, but I've turned that off now. I wondered whether it was down to the /Volumes/music file system disappearing occasionally (another issue!) but it has happened even when the music folder is mounted. Very frustrating!
    As a last resort, I could copy the music on to the local disk in my iMac, but that defeats the point of the NAS really. It should work.
    Hope someone can help.
    Thanks

    Click the icon to start iTunes and immediately press and continue to hold down the SHIFT key. This dialog should appear:
    If iTunes opens normally close it and try again. Use Choose Libraray... to open the copy of your library on the external drive. Check the location of the media folder once opened. You can now remove the iTunes folder on C: without it reappearing.
    tt2

Maybe you are looking for