Simple one - set servlets file I/O destination

Hi,
I'm running J2SDKEE1.3 with deploytool and what I simply want to know is this, that if I use the following code in a servlet:
ObjectOutputStream out_ = new ObjectOutputStream(
new FileOutputStream("messagehr.txt"));
out_.writeObject(new String("whats the fequency Kenneth?"));
out_.close();
how could I control where the file messagehr.txt is put by default? At the moment files end up on my desktop in win2000.
Thanks.

What is the exact access permission giving the problem? Catch this exception and do the following:
catch( AccessControlException ace )
Permission perm = ace.getPermission();
System.out.println( "The following permission denied: " + perm.getName() );
System.out.println( "Permission error: " + perm.toString() );
System.out.println( "Action available on object: " + perm.getActions() );

Similar Messages

  • One set of files, multiple users

    I've seen a lot of posts on this, but I can't tell if any of the suggestions will give me what I want. Or if what I want is possible. So I thought I'd try to describe what I want to do in detail and see if someone can point me to the right solution.
    I'm using iTunes 5. My wife and I each have laptops where our iTunes libraries used to live, but now we have a G5 (i.e. effectively infinite disk space) and have moved our libraries to it, and feed our iPods from it. So, we have two libraries on one computer, and probably 60-80% of the files are duplicates.
    What I would like to do is merge these file libraries (by hand if needed, since in some cases we have different quality scans of the same songs) so that there is only one set of music files. But I want to keep our two separate sets of playlists, ratings, etc.
    I would also like it if either of us could add to the library, although I understand this might involve resetting file permissions and/or reimporting the library occasionally. We could probably live with only one person being able to add music as long as we could each have our own ratings, but it would be annoying.
    So how much of this is possible? And has anyone made anything like iPhoto Buddy for iTunes? Thanks.

    Thanks,
    I've started looking down that road a bit myself. It's been a while since I tried to solve something like this and have found a few other alternatives similar to your suggestion. I like the looks of the Linksys Network attached Storage
    http://www.linksys.com/servlet/Satellite?childpagename=US%2FLayout&packedargs=c% 3DLProductC2%26cid%3D1119460470527&pagename=Linksys%2FCommon%2FVisitorWrapper
    It's about $700-800 us and has a gigabit connection.

  • Can I copy Keywords from one set of files to another?

    I added Keywords to many jpg files when I should have added them to their scanned source files (tifs). Is there an efficient way to copy them from the jpg versions to their tif “originals?” Except for their suffixes, they are identically named. Obviously the keywords assigned to any one jpg can be dragged to its tif version (or to any any other image file). But I have about nine thousand of them, each with its own set of keywords, and each with its own tif source file (with no keywords). Is there a way to automate this? Is there a way to tell the jpgs to transfer their metadata to other files with the same names (minus prefix) or to any other files?
    I’m working in Bridge3 MacOSX.

    The link was for the Photoshop Scripting Forum where you can search the existing threads or ask for help in a new one.
    Seems like this should be a simple procedure expecially with so many people making books from photoshop documents.
    It is not that complicated if you know a little JavaScript and the Photoshop Document Object Model.
    But if you are willing to start from scratch instead of transferring existing guides an Action might also work.

  • How to set file name and destination folder without user interaction

    how can I set the file name and destination folder to generate a pdf file like "c:\myfolder\document.pdf" in this folder automatically.
    Is there a tag in .joboptions ?
    Goal: User click print button. In the background a pdf will be generated in e.g. "C:\myfolder\document.pdf".
    that`s it.
    I know that the query dialog for save as can be turned off. But the file name depends on the application.
    Thanks for your help.
    TK

    Hello,
    Please post this  in  PI forums
    Regards, Anil

  • Adding one setting to multiple files?

    I am new to Compressor.  Is there a way to add one setting to multiple files in the batch area without having to go into each file seperately?  Thanks

    Select all the files and drop or paste the setting into  the files. That will the setting to all the files...

  • How does one set databse parameters in Tomcat to run a servlet?

    Hi, I am trying to run a applet-servlet code, downloaded from the web. According to the installation instructions, the following is stated:
    Database Parameters. You can provide different database parameters to the servlet. These parameters are set during the administration of the servlet.
    dbDriver - name of the database driver class name (default = sun.jdbc.odbc.JdbcOdbcDriver)
    dbURL - complete database URL (default = jdbc:odbc:StudentDatabase)
    userid - user id (default = <none>)
    passwd - password (default = <none>)
    I am running TOMCAT on a Windows2000 machine. My question is how to does one set the parameters in TOMCAT. What is the default userid and password for TOMCAT.
    Any help/advise is appreciated in advance. Thanks.Regards.

    May be parameters must be set in web.xml in your war

  • Text file will only print one set of input and puts in end for name.

    Okay, I have this more or less straightened out. Only thing is, it creates the text file, and will only enter one set of data. It will not print the other students information to the text file. The other thing it does is puts in the student name as end. I think that has something to do with the fact that I need to compare the student name field (SName) to end, so the program can be ended. Anyone have some ideas? I have been working on this for almost 2 weeks, and am about ready to throw the computer off a cliff..
    Thanks.
    import java.io.*;
    import java.lang.*;
    import java.text.*;
    import java.util.*;
    import java.text.DecimalFormat;
    import java.lang.Comparable;
    class my_main
         public static void main (String [] args) throws IOException
         gradebook pt= new gradebook();
         pt.compare();
    class gradebook
         char LG;
         double gr1;
         double gr2;
         double gr3;
         double avg;
         String SName;
         String IDNO;
         String nameupper;
         int compareTo;
         void compare()throws IOException
         FileWriter file= new FileWriter("Grades.txt");
         BufferedWriter bw= new BufferedWriter(file);
         PrintWriter outfile= new PrintWriter(bw);
    BufferedReader stdin;
    stdin= new BufferedReader (new InputStreamReader (System.in));
    System.out.println("Enter Student Name or End to Quit: ");
    SName= stdin.readLine();
    nameupper= SName.toUpperCase();
    DecimalFormat fmt= new DecimalFormat ("##.##");
    outfile.println ("");
    outfile.println (" STUDENT GRADES ");
    outfile.println ("");
    outfile.println ("SName ID # GRADE 1 GRADE 2 GRADE 3 AVERAGE LETTER");
    while(nameupper.compareTo("END")!=0)
    if (nameupper.equalsIgnoreCase("END"))
    break;
         System.out.print ("Student ID: ");
         IDNO= stdin.readLine();
         System.out.print ("Grade One: ");
         gr1= Double.parseDouble(stdin.readLine());
         System.out.print ("Grade Two: ");
         gr2= Double.parseDouble(stdin.readLine());
         System.out.print ("Grade Three: ");
         gr3=Double.parseDouble(stdin.readLine());
         System.out.println ("");
         avg=(gr1+gr2+gr3)/3.0;
         if (avg >= 90) LG = 'A';
    else if (avg >=80 && avg <90) LG = 'B';
    else if (avg >=70 && avg <80) LG = 'C';
    else if (avg >=60 && avg <70) LG = 'D';
    else LG = 'F';
    System.out.println("Enter Student Name or End to Quit: ");
    SName= stdin.readLine();
    nameupper= SName.toUpperCase();
    outfile.print (""+SName);
    outfile.print (" "+IDNO);
    outfile.print (" "+fmt.format(gr1));
    outfile.print (" "+fmt.format(gr2));
    outfile.print (" "+fmt.format(gr3));
    outfile.print (" "+fmt.format(avg));
    outfile.print (" "+LG);
    outfile.println("");
    outfile.close();
         

    Not 100% sure this is what you're after, but it seems to work OK
    import java.io.*;
    import java.lang.*;
    import java.text.*;
    import java.util.*;
    import java.text.DecimalFormat;
    import java.lang.Comparable;
    class my_main
      public static void main (String [] args) throws IOException
        gradebook pt= new gradebook();
        pt.compare();
    class gradebook
      char LG;
      double gr1;
      double gr2;
      double gr3;
      double avg;
      String SName;
      String IDNO;
      String nameupper;
      int compareTo;
      void compare()throws IOException
        FileWriter file= new FileWriter("Grades.txt");
        BufferedWriter bw= new BufferedWriter(file);
        PrintWriter outfile= new PrintWriter(bw);
        BufferedReader stdin;
        stdin= new BufferedReader (new InputStreamReader (System.in));
        System.out.println("Enter Student Name or End to Quit: ");
        SName= stdin.readLine();
        nameupper= SName.toUpperCase();
        DecimalFormat fmt= new DecimalFormat ("##.##");
        outfile.println ("");
        outfile.println ("STUDENT GRADES ");
        outfile.println ("");
        outfile.println ("SName ID # GRADE 1 GRADE 2 GRADE 3 AVERAGE LETTER");
        while(nameupper.compareTo("END")!=0)
          if (nameupper.equalsIgnoreCase("END"))
          break;
          System.out.print ("Student ID: ");
          IDNO= stdin.readLine();
          System.out.print ("Grade One: ");
          gr1= Double.parseDouble(stdin.readLine());
          System.out.print ("Grade Two: ");
          gr2= Double.parseDouble(stdin.readLine());
          System.out.print ("Grade Three: ");
          gr3=Double.parseDouble(stdin.readLine());
          System.out.println ("");
          avg=(gr1+gr2+gr3)/3.0;
          if (avg >= 90) LG = 'A';
          else if (avg >=80 && avg <90) LG = 'B';
          else if (avg >=70 && avg <80) LG = 'C';
          else if (avg >=60 && avg <70) LG = 'D';
          else LG = 'F';
          outfile.print (SName+" "+IDNO+" "+fmt.format(gr1)+" "+fmt.format(gr2)+
                          " "+fmt.format(gr3)+" "+fmt.format(avg)+" "+LG+"\r\n");
          System.out.println("Enter Student Name or End to Quit: ");
          SName= stdin.readLine();
          nameupper= SName.toUpperCase();
        outfile.close();
    }

  • How does one set up a file sharing password?

    Hi,
    My wife and I use the same Airport Extreme station to access the Internet and each other’s machine. Every time one of us wants to connect to the other machine via AFP, a dialog box springs up that has radio buttons, giving the choice of ‘Registered User’ or ‘Guest.’
    Where, on the serving computer, can one set up a ‘registered user’ with a password? Would doing so allow the registered user a wider access than only the ‘Drop Box?’
    Thanks,
    Klaus

    "Registered user", in effect, means "OS X user on the machine being shared". So, you could, right now, click on "registered user" and log in to your wife's Mac using her login details (and vice versa). If you log in as a user, as opposed to a guest, you get access to that user's entire home folder. If that user is also an administrator, you get access to the whole system drive.
    Guests actually have access to the "Public" folders in the system (which includes the Drop Box).
    Matt

  • Servlet File Not running on Server

    Hi All,
    I have a servlet file named "TestServlet", when I run this file(http://mydomain.com/TestServlet) on server it won't run, but its running on my local machine. Am using Tomcat 5.5.9 and jdk1.5.0_05 and Server configuration also same as my local machine configuration. Please! let me know any suggestion that why its not running on server machine.
    *1. web.xml is:*
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
        <display-name>My Servlet</display-name>
        <description>
          My Test Servlet
        </description>
        <servlet>
            <servlet-name>TestServlet</servlet-name>
            <servlet-class>com.test.TestServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>TestServlet</servlet-name>
            <url-pattern>/TestServlet</url-pattern>
        </servlet-mapping>
         <welcome-file-list>
              <welcome-file>index.html</welcome-file>
              <welcome-file>index.htm</welcome-file>
              <welcome-file>index.jsp</welcome-file>
         </welcome-file-list>
    </web-app>*2. TestServlet.java file is:*
    package com.test;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class TestServlet extends HttpServlet
         public void doPost (HttpServletRequest req, HttpServletResponse response)throws ServletException, IOException
              * Set the content type(MIME Type) of the response.
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              * Write the HTML to the response
              out.println("<html>");
              out.println("<head>");
              out.println("<title> A very simple servlet example</title>");
              out.println("</head>");
              out.println("<body>");
              out.println("<h1>Welcome To TestServlet</h1>");
              out.println("</body>");
              out.println("</html>");
              out.close();
        public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
            doPost(request, response);
    }Thanks in Advance,
    Prasath Arjunan.

    PrasathArjunan wrote:
    Yes, I can run my JSPs on my server without any error,
    I don't know which port it has listening in my Server(Tomcat),
    My server also have installed Apache HTTP server and my application is under ROOT directory only.If you don't know then it is most likely the default 8080 port.
    I ask because in your url example you do not provide a port number, so requests are going to port 80. If you have Apache HTTP running there then you must have a connector installed in Apache HTTP that forwards requests to Tomcat? Because then I'd say the mappings are not entirely correct and servlet requests do not reach Tomcat. Post the connector configuration if you are using one.

  • Simple value set

    Hello Friends,
    I am extending one view, on this view there are two inputfields are defined with f4 help. I have added another input field, and have to add f4 help button ( i tried to do the same as other two fields are defined )
    I looked into the wdinit method, and found something like this:
              IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute("FileName");
              ISimpleTypeModifiable fileNameType = attributeInfo.getModifiableSimpleType();
              IWDAttributeInfo attributeInfo1 = wdContext.getNodeInfo().getAttribute("ReportType");
              ISimpleTypeModifiable reportTypeType = attributeInfo1.getModifiableSimpleType();
              IWDMessageManager msgMgr = this.wdThis.wdGetAPI().getComponent().getMessageManager();
              Zport_Get_Tables_Input input = new Zport_Get_Tables_Input();
    fileNameType.setFieldLabel("File");
                   IModifiableSimpleValueSet valueSet = fileNameType.getSVServices().getModifiableSimpleValueSet();
                   for (int i = 0; i < wdContext.nodeZrpt_Table().size(); i++)
                        valueSet.put(wdContext.nodeZrpt_Table().getZrpt_TableElementAt(i).getTabname(), wdContext.nodeZrpt_Table().getZrpt_TableElementAt(i).getDdtext());
                   valueSet.sort(true, true, true);
                   wdContext.currentContextElement().setFileName(wdContext.nodeZrpt_Table().currentZrpt_TableElement().getTabname());
                   // Set field label and populate valueset
                   reportTypeType.setFieldLabel("Type");
                   IModifiableSimpleValueSet valueSet1 = reportTypeType.getSVServices().getModifiableSimpleValueSet();
                   for (int i = 0; i < wdContext.nodeZrpt_Type().size(); i++)
                        valueSet1.put(wdContext.nodeZrpt_Type().getZrpt_TypeElementAt(i).getDomvalue_L(), wdContext.nodeZrpt_Type().getZrpt_TypeElementAt(i).getDdtext());
                   valueSet1.sort(true, true, true);
                   wdContext.currentContextElement().setReportType(wdContext.nodeZrpt_Type().currentZrpt_TypeElement().getDomvalue_L());
    Can any one pls make me sure, if this is simple value set, if yes, I want to read and understand this svs, is there any good documentation, which describes svs ( so that first I can make the concepts and then try to implement the input fields )
    Thanks and kind regard,

    Hi,
       Follow this <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/value%20help%20in%20web%20dynpro%20applications.pdf">Link</a>.
       If you are using Backend Data. Get the data, and place them in valueset, as done in the above code.
      i.e. in this part...
    for (int i = 0; i < wdContext.nodeZrpt_Type().size(); i++)
    valueSet1.put(wdContext.nodeZrpt_Type().getZrpt_TypeElementAt(i).getDomvalue_L(), wdContext.nodeZrpt_Type().getZrpt_TypeElementAt(i).getDdtext());
    Prabhakar.

  • [File Upload] Multiple Destination ??

    Hi all friends,
    Iam facing problem with Uploading of one file in multiple destination means user can select multiple remote destination from client interface(swing) and my application should send that file in all remote destination from local hot folder.For that I have used Jlist Box with Multiple selection mode in swing client interface.Presently my application is working fine with one destination and multiple files.Iam little bit confused about the way of proceed Can any one plz guide me how I should proceed, I want only logic or some suggestion.Iam using Tomcat4.1.24 and servlet.
    Thanks & Regards
    Bikash

    why are u using servlets? servlets/JSP are for HTTP. you should write another standalone network server program which correspond to the client instead.
    network server program
    -sockets?
    -JMS?
    -CORBA/RMI?

  • Why one group of files takes so long to copy

    Hi...  I have two different folders full of files that I occasionally backup to another location.  Both sets contain approximately 3000 files each.  However, what I will call set 1's 3000 files represent about 700 MBytes of data while the 3000 files in set 2 are about half that size at about 350 MBytes. 
    The vast majority of those files are never changed.  Instead, each week perhaps a few kilobytes and maybe 10-20 files might change.  When I copy set 2 to its backup location, the copy might take 15 seconds tops.  When I copy set 1 to its backup location on the same drive as set 2, the backup takes at least a factor of 10 longer...  Maybe more...  I could imagine a factor of 2 since there are twice as many MBytes of data in that set 1 but why might it be taking so, so much longer???  I've looked at the file attributes between the two sets and they appear to all be the same.
    Even more interesting, if I do the backup for set 2 (the faster one) that I said maybe takes 15 seconds tops, if I immediately do the same thing again, it now takes less than a second meaning that the system seems to know those files have not changed since the previous copy.  However, if I do the same with set 1, the second immediate copy takes every bit as long as the first copy just took moments before...  It's as if something is telling the Finder to go ahead and recopy ALL of those files every time whether they have changed or not. 
    Any input on why I might be seeing that???  I care because I also backup these files via an online backup service and that set 1 group of files always takes a ton longer on that service as well.  What might cause this???
    thanks... bob..

    Well, maybe more detail would help but I was trying to keep it simple.  There are certain files that I now and then copy into encrypted, sparse disk images and I then backup those encrypted disk images elsewhere.  Currently I open the disk images which then shows the files/folders but those might be a few weeks old.  I then open the same folders that exist elsewhere on my computer and that's when I use the drag and drop to update what will soon be relocked up into the encrypted disk images.
    Sets 1 and 2 as I described them above are just natural groupings of files/folders I once chose those these encrypted disk images wouldn't be incredibly large. 
    I do have Disk Warrior as somone asked above...
    And I don't have Carbon Copy Cloner but I do have its cousin, SuperDuper which I used to backup the entire computer to a backup drive now and then. 
    And I doubt I'm running into memory problems as this is a new rMBP with 16 GBytes of RAM
    I could use SuperDuper to copy these files for me...  Might be worth a try...  But it's just so curious that one group of files copies in an instant when you copy and then immediately copy again while the second group seems to want to redo the copy every time you request it...  It might just be a few funny files in that one group...  Interesting...

  • Using Automator to Copy Only New Files to a Destination Folder

    Hello,
    I need an AppleScript to copy a source directory (including all subfolders and files) to a destination folder, but one that checks for duplicate files and only copies files across from the source directory if they aren't already contained in the destination directory.
    I have a script that checks the files, but it only copies files from the source directory and ignores all subfolders and the files within those.
    Can anyone help?
    Thanks
    Reynell79

    red_menace wrote:
    You can create a Service workflow to get the folder(s).  The workflow would consist of actions to save the input items to a vatiable (so they can be refiltered), then get the input items, apply a filter, and move the resulting items - for example:
    Service receives selected folders in Finder
    Get Folder Contents
    Set Value of Variable { Variable: Original Items }
    Filter Finder Items { Find files where: kind is music }
    Move Finder Items { To: Automatically Add to iTunes }
    Get Value of Variable { Variable: Original Items } ( Ignore Input )
    Filter Finder Items { Find files where: kind is image }
    Move Finder Items { To: Album Artwork }
    ...repeat the Get/Filter/Move actions as needed for other filters
    Thanks, the "Set Value of Variable" concept is what I was missing. It almost works. The music files get moved, but then it says the workflow encounters a problem and the image files aren't being moved. I'm assuming it's an issue with steps 5-7. Thoughts?

  • Upload a set of files from presentation server to app server.

    Hello,
    I need an urgent help.
    I know how to use GUI_UPLOAD fm for simple file uploading.
    However, my requirement is that in my report program(on selection screen) I give the source directory(presentation server) and the target directory
    (application server). The report has to get all the files from the presentation server (from this source directory) and has to upload each file to the application server in the target directory.
    Could anyone please help me in this?
    It would be very helpful if anyone can put the code / standard example if there is any mechanism in ABAP to get the set of files from the presentation server, given the directory name.
    THanks a lot for your help,
    Best Regards,
    Pramod S.

    HI Pramod,
      After you get the data into the internal table, you need to pass the internal table, record by record into the application server.
    data: wa_file type string.
    data: tab_file like table of wa_file,
    pcount type i.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
    exporting
    DIRECTORY = 'C:\test'
    FILTER = '.'
    FILES_ONLY = 'X'
    DIRECTORIES_ONLY
    changing
    FILE_TABLE = tab_file
    count = pcount.
    loop at tab_file into wa_file.
    clear it_data.
    refresh it_data.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    exporting
    FILENAME = wa_file
    changing
    data_tab = it_data.
    open dataset <filename> for output in text mode encoding default.
    if sy-subrc = 0.
    loop at it_data.
    transfer it_data to <filename>.
    endloop.
    close dataset.
    endif.
    endloop.
    Thanks,
    Ravi Kanth

  • How to place a servlet file in Tomcat 5.0?

    Hi,
    i'm using Apache Tomcat 5.0 as myweb server.i don't know how to set the class path and where to place my servlet and html files,and how to run my servlet file.if anybody knows plz give me a detailed description abt this topic.

    Look at the directory structure of your Tomcat installation directory. You will see a webapps directory under that. The Tomcat installation comes with samples ready to run. Look at those and create a similar directory structure under webapps for your application. I don't think you need to worry about classpath. Tomcat should be taking care of all that if you create the proper directory structure.
    You run your servlet by specifying a url like:
    localhost:8080/servlets-examples/from a browser. This assumes that your installation is using port 8080 which I think is the norm for Tomcat. Here "servlets-examples" is the name of the directory you created. Actually Tomcat 5.0 comes with a "servlets-examples" application. This would be a good directory to look at. You could also run their examples to get a feel for it.
    If you are new to servlets, you'll probably have to get a book that explains how things need to be set up. You'll need to create a web.xml for your application. If you look at the servlets-examples directory under webapps, you'll see that it has a WEB-INF directory under it and that directory contains a file called web.xml as well as a sub-directory called classes. This structure is standard accross all application servers because it corresponds to the war (wars are specialized types of jars for web apps) file standard.

Maybe you are looking for

  • Mac OS Mavericks is crashing on my macbook Pro

    I have a Macbook Pro Processor: 2.66Ghz Intel Core i7 Memory: 8GB DDR3i recently upgraded to mavericks after that my laptop got very slow, also now it has started to crash a lot of times. while running the screen just becomes white and there is this

  • Another CS6 build questions thread

    Hi guys, My first post here, I've been reading lots on here today thanks for all the info!, I'm building a new edit of, mainly for pp & ae cs6. I think I'm there with components but would love to hear your opinions and experiences before I click the

  • Apple pay could not set up  iOS 8.3

    I've already have two cards in my Apple pay. When I updated iOS 8.3 just now and tried to create another new card, it says AN ERROR OCCURRED WHILE SETTING UP APPLE PAY. I am using the iPhone 6 Plus

  • Order Recommendation with Quantity zero.

    Hi Experts, I have an issue and I would need to understand to avoid mayor problems. They use the MRP and in one of the scenarios there are a lot of lines of recommendations with Quantity equal to zero!! This should be impossible as far as I can see,

  • Variance analysis

    Hi, Can someone suggest a good report for variance analysis in cost object controlling. Thank you Message was edited by:         Ram R