How to detect the path of Temp directory

I am writing a class library which allows users to manipulate a database in the web server java applications/applets. In my logic the Application/Applet communicate with a CGI script/Servlet in the server and that do all the database handling. My objective is to make the Client independant from the Database Drivers, and to some restrictions and possible security threats that can arrice when accessing the database directly.
99% of the work is done and now I am doing the fine tuning.
My Problem:
When the user downloading a blob object from the server database. each time the program read the blob it will get a new copy from the server. This is not good if the blob is large (few 100 megs) . So I am going to implement a cache system. but the problem is If I am caching in the memory it will not support large objects (Memory is a limited factor). So the preferance is use the Temperary files but I do not know how to detect the path to temperary folder.
And my 2nd questions is are the applets allowed to write and read in temperary folder.

The Java default temporary file path can be determined with
System.getProperty("java.io.tmpdir")This is typically the same value as the os environment variable

Similar Messages

  • How to get the path of current directory?

    I have the Java servlet to produce text file, and it produces to C:\hello.txt,
    but I want to output in the current directory as the Java File:
    i.e. C:\jakarta-tomcat-4.1.30\webapps\ExtendedGUI\WEB-INF\classes
    try
         PrintWriter out = new PrintWriter(new FileWriter("hello.txt"));
         out.println("HELLO");
         out.close();
    catch(IOException e)
    any ideas?? Thanks!!

    The current directory is defined as the directory that you started your servlet container from. In your case, it was c:\. If you want it to fall into the same directory as your class files, I would start by finding out what TOMCAT_HOME or whatever container you're using is and adding to the directory until you get to your class directory. Make sense?
    The easiest way is to read the output directory from a properties file as a resource or a hardcoded path.
    HTH

  • How to identify the path of Inventory Directory and credentials

    Hi Experts!
    I have installed Oracle 10g 10.2.0 on a dedicated centos 4.4 Box and everything running fine. The problem is at the time of installation i have given the home directory path /u01/app/oracle/product/10.2.0/db_1 of user ORACLE and in the first step and in the second step i havent noticed the Inventory directory credential path. I just clicked on
    next and completed the installation. Could anybody help me to identify the default path which i forgotton to change at this step.
    Thanks in advance
    Regards
    Kalyan Chandra.M

    Check out /etc/oraInst.loc file.

  • How to know the path of file.

    i am facing a problem,i have prepared a jar file of an application, which should have a path-file in it & that path-file contains loaction from where applicatioin starts, and creates some file there. but i dont know loaction when i prepared the jar file.how to solve this problem.

    but it is not in my hand, My jar file will be used by a vendor to code a Servlet which will access the classes in the jar file. it cannot be solved by My jar file.
    My Question was
    I have to deliver a jar file which contains my classes. This jar file will be used by a vendor to code a Servlet which will access the classes in the jar file.
    One of the classes in this jar file is required to simulate a file-system (we call it "Repository"). Essentially, it creates a certain directory and reads-writes files into it.
    My problem is how to specify the path (i.e. directory location) of the "Repository". Following are the possibilities I could see :
    1. Hardcode the path in the java code - This is not desirable since we do not know it while I am preparing my jar-file.
    2. Create a properties file, put Repository.path=... as an entry and package it with the jar-file - The problem is that sine this properties file is packaged in the jar, it is read-only. Hence, it cannot be changed at runtime.
    I want to know what are the general approaches to this?

  • How to get the path when i select a directory or a file in a JTree

    How to get the path when i select a directory or a file in a JTree

    import java.lang.*;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.HeadlessException;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Iterator;
    * @author Frederic FOURGEOT
    * @version 1.0
    public class JTreeFolder extends JPanel {
    protected DefaultMutableTreeNode racine;
    JTree tree;
    protected JScrollPane scrollpane;
    final static int MAX_LEVEL = 1; // niveau max de descente "direct" dans l'arborescence
    * Sous-classe FSNode
    * @author Frederic FOURGEOT
    * @version 1.0
    private class FSNode extends DefaultMutableTreeNode {
    File file; // contient le fichier li� au noeud
    * Constructeur non visible
    private FSNode() {
    super();
    * Constructeur par initialisation
    * @param userObject Object
    FSNode(Object userObject) {
    super(userObject);
    * Constructeur par initialisation
    * @param userObject Object
    * @param newFile File
    FSNode(Object userObject, File newFile) {
    super(userObject);
    file = newFile;
    * Definit le fichier lie au noeud
    * @param newFile File
    public void setFile(File newFile) {
    file = newFile;
    * Renvoi le fichier lie au noeud
    * @return File
    public File getFile() {
    return file;
    public JTree getJTree(){
         return tree ;
    * Constructeur
    * @throws HeadlessException
    public JTreeFolder() throws HeadlessException {
    File[] drive;
    tree = new JTree();
    // cr�ation du noeud sup�rieur
    racine = new DefaultMutableTreeNode("Poste de travail");
    // cr�ation d'un noeud pour chaque lecteur
    drive = File.listRoots();
    for (int i = 0 ; i < drive.length ; i++) {
    FSNode node = new FSNode(drive, drive[i]);
    addFolder(drive[i], node); // on descend dans l'arborescence du lecteur jusqu'� MAX_LEVEL
    racine.add(node);
    // Gestion d'evenement sur JTree (on �coute les evenements TreeExpansion)
    tree.addTreeExpansionListener(new TreeExpansionListener() {
    public void treeExpanded(TreeExpansionEvent e) {
    // lorsqu'un noeud est ouvert
    // on descend dans l'arborescence du noeud jusqu'� MAX_LEVEL
    TreePath path = e.getPath();
    FSNode node = (FSNode)path.getLastPathComponent();
    addFolder(node);
    ((DefaultTreeModel)tree.getModel()).reload(node); // on recharche uniquement le noeud
    public void treeCollapsed(TreeExpansionEvent e) {
    // lorsqu'un noeud est referm�
    //RIEN
    // alimentation du JTree
    DefaultTreeModel model = new DefaultTreeModel(racine);
    tree.setModel(model);
         setLayout(null);
    // ajout du JTree au formulaire
    tree.setBounds(0, 0, 240, 290);
    scrollpane = new JScrollPane(tree);
         add(scrollpane);
         scrollpane.setBounds(0, 0, 240, 290);
    * Recuperation des sous-elements d'un repertoire
    * @param driveOrDir
    * @param node
    public void addFolder(File driveOrDir, DefaultMutableTreeNode node) {
    setCursor(new Cursor(3)); // WAIT_CURSOR est DEPRECATED
    addFolder(driveOrDir, node, 0);
    setCursor(new Cursor(0)); // DEFAULT_CURSOR est DEPRECATED
    * Recuperation des sous-elements d'un repertoire
    * (avec niveau pour r�cursivit� et arr�t sur MAX_LEVEL)
    * @param driveOrDir File
    * @param node DefaultMutableTreeNode
    * @param level int
    private void addFolder(File driveOrDir, DefaultMutableTreeNode node, int level) {
    File[] fileList;
    fileList = driveOrDir.listFiles();
    if (fileList != null) {
    sortFiles(fileList); // on tri les elements
    // on ne cherche pas plus loin que le niveau maximal d�finit
    if (level > MAX_LEVEL - 1) {return;}
    // pour chaque �l�ment
    try {
    for (int i = 0; i < fileList.length; i++) {
    // en fonction du type d'�l�ment
    if (fileList[i].isDirectory()) {
    // si c'est un r�pertoire on cr�� un nouveau noeud
    FSNode dir = new FSNode(fileList[i].getName(), fileList[i]);
    node.add(dir);
    // on recherche les �l�ments (r�cursivit�)
    addFolder(fileList[i], dir, ++level);
    if (fileList[i].isFile()) {
    // si c'est un fichier on ajoute l'�l�ment au noeud
    node.add(new FSNode(fileList[i].getName(), fileList[i]));
    catch (NullPointerException e) {
    // rien
    * Recuperation des sous-elements d'un noeud
    * @param node
    public void addFolder(FSNode node) {
    setCursor(new Cursor(3)); // WAIT_CURSOR est DEPRECATED
    for (int i = 0 ; i < node.getChildCount() ; i++) {
    addFolder(((FSNode)node.getChildAt(i)).getFile(), (FSNode)node.getChildAt(i));
    setCursor(new Cursor(0)); // DEFAULT_CURSOR est DEPRECATED
    * Tri une liste de fichier
    * @param listFile
    public void sortFiles(File[] listFile) {
    triRapide(listFile, 0, listFile.length - 1);
    * QuickSort : Partition
    * @param listFile
    * @param deb
    * @param fin
    * @return
    private int partition(File[] listFile, int deb, int fin) {
    int compt = deb;
    File pivot = listFile[deb];
    int i = deb - 1;
    int j = fin + 1;
    while (true) {
    do {
    j--;
    } while (listFile[j].getName().compareToIgnoreCase(pivot.getName()) > 0);
    do {
    i++;
    } while (listFile[i].getName().compareToIgnoreCase(pivot.getName()) < 0);
    if (i < j) {
    echanger(listFile, i, j);
    } else {
    return j;
    * Tri rapide : quick sort
    * @param listFile
    * @param deb
    * @param fin
    private void triRapide(File[] listFile, int deb, int fin) {
    if (deb < fin) {
    int positionPivot = partition(listFile, deb, fin);
    triRapide(listFile, deb, positionPivot);
    triRapide(listFile, positionPivot + 1, fin);
    * QuickSort : echanger
    * @param listFile
    * @param posa
    * @param posb
    private void echanger(File[] listFile, int posa, int posb) {
    File tmpFile = listFile[posa];
    listFile[posa] = listFile[posb];
    listFile[posb] = tmpFile;

  • How to save file in users temp directory in java

    How to save file in users temp directory as "<Drive Name>:\Documents and Settings\<User Name\Local Settings\Temp".

    Shouldn't the System property "user.home" reference to that directory on windows? So if you call System.getProperty("user.home");, I think it should return that path at least up to <User Name>. I never really tried it on Windows though.

  • How to change the path of the Transport

    HI all!
    I had the system of portal dev,qas,prd,I want to made the export folder of the dev point to the import folder of the qas.But how to change the path of the transport ?I change the file of the D:\usr\sap\dev\SYS\global\pcd\pcdStartup.properties,But it not useful.I think my type is not correct.Plz tell me the key.thanks very much!!!
    D:\usr\sap\dev\SYS\global\pcd\pcdStartup.properties,I changed:
    Transport Application
    Root directory for exporting transport packages
    #Pcd.TransportApplication.ExportRootDir=
    qas\Import
    Root directory for importing transport packages
    #Pcd.TransportApplication.ImportRootDir=${Pcd.Share}/Import
    Directory for temporary transport files
    #Pcd.TransportApplication.TempDir      =${Pcd.Temp}/transport
    Edited by: joecui on Nov 12, 2008 8:15 AM
    Edited by: joecui on Nov 12, 2008 8:16 AM

    Did you try to remove the "#" character before every line you changed?
    Save the file...
    Reload/Refresh it in the Portal...
    Try if that helps you.
    Cheers,
    Benjamin

  • How to set the PATH in Terminal?

    As a newbie to Bash and the Terminal, in connection with installing a new version of Ruby and various add-ons, I have been messing around with changing the PATH via various methods I've found on the internet, and trying to add a new directory to my PATH. Unfortunately, I cannot figure out how to set the PATH correctly. Here is what I understand so far:
    1. Bash first looks to ".bash_profile" in the home directory for PATH settings.
    2. If none, Bash then looks to ".bash_login" for PATH settings.
    3. If none, Bash then looks to ".profile".
    4. If none, Bash then looks to a system file in "/etc/profile" for default PATH settings.
    5. For a new shell after login, Bash looks for a ".bashrc" file.
    I cannot find any of the above files (I have Finder set to show hidden files already). Somehow, following some instructions from the internet without really knowing what I was doing over the past week I have set my PATH as follows:
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/*****/src:/usr/X11/bin
    but I cannot find the file that is setting this PATH. I have tried creating a new ".bash_profile" shell file and putting it in various places such as "/bin" and "/usr/bin" but the file is not being read.
    * As a temporary workaround I tried using the command "source .bash_profile" upon login to set the PATH using the .bash_profile file that I created, but it does not work.
    * I am able to temporarily alter the path using the command "PATH=/usr/local/bin:$PATH" but this only lasts for an active shell; when I close out and reopen a new shell, it reverts to the default.
    So my questions are:
    Is it correct that there is a "/etc/profile" somewhere that is setting the default PATH? If so where is it? Should I alter it, or create a new ".bash_profile" somewhere to set the PATH? If not, where is my PATH being set? If I should create a new ".bash_profile", what exactly should go in it?
    Thanks in advance for any assistance.

    ... I created a new ".bash_profile" file directly under my home directory and it worked like a charm. Below is the content of the file:
    "PATH=/usr/local/bin:/bin/:/sbin/:/usr/bin/:/usr/sbin/:/Users/******/Ruby:/Users/*******/src:/Users/******/Java Programs/"
    What are the "..."'s? Is that just you, or is the contents of the file actually inside of double quotes?
    is there an 'export PATH' also in the file? As in
    PATH=/usr/local/bin:/bin/:/sbin/:/usr/bin/:/usr/sbin/:/Users/******/Ruby:/Users/*******/src:/Users/******/Java Programs/
    export PATH
    And did you either restart your Terminal session so your .bash_profile was read, or issue a 'source .bash_profile' command to execute the .bash_profile after your change?
    The only remaining problem is that from the home directory, I'm unable to directly run programs in the above-designated subdirectories (without first navigating to the subdirectory containing the file. Is there something wrong with the syntax or order of the directories I put in the path?
    For example: there is a file called "newprogram.rb" in the "Ruby" directory listed above. I should be able to execute it from the home directory using "ruby newprogram.rb" but it does not work. The same command works fine from within the "Ruby" directory.
    Does the 'ruby' command search PATH to find its scripts?
    Have you read the "man ruby" man page to see if it talks about PATH?
    A common Unix feature is that programs and scripts with the executable bit set, and are located in a PATH directory, will be run if you just type their names.
    For example, if the first line of newprogram.rb script starts with
    #!/usr/bin/ruby
    and if the script is executable
    chmod +x newprogram.rb
    And if it is in a directory in PATH, then just typing
    newprogram.rb
    should run your perl script using /usr/bin/ruby. If you want to use a different version of Ruby, then change the #! line so it point to your version of Ruby. Or if your version of Ruby is found earlier in PATH then the /usr/bin/ruby, you can use
    #!/usr/bin/env ruby
    as your script's first line which will search PATH for 'ruby' and use the first one it finds.
    Message was edited by: BobHarris

  • How to determine the mount point for directory /tmp ?

    Folks,
    Hello. I am installing Oracle 11gR2 RAC using 2 Virtual Machines (rac1 and rac2 whose OS are Oracle Linux 5.6) in VMPlayer and according to the tutorial
    http://appsdbaworkshop.blogspot.com/2011/10/11gr2-rac-on-linux-56-using-vmware.html
    I am installing Grid infrastructure. I am on step 7 of 10 (verify Grid installation enviroment) and get this error:
    "Free Space: Rac2: /tmp"
    Cause: Could not determine mount point for location specified.
    Action: Ensure location specified is available.
    Expected value: n/a
    Actual value: n/a
    I have checked the free space using the command:
    [root@Rac2 /]# df -k /tmp
    Output:
    Filesystem     1k-blocks     used     Available     Use%     Mounted on
    /dev/sda1     30470144     7826952     21070432     28%     /
    As you see above, the free space is enough, but could not determine mount point for /tmp.
    Do any folk understand how to determine the mount point for directory /tmp ?
    Thanks.

    I have just checked "/home/oracle/.bash_profile". But in my computer, there is no "oracle" under /home directory.Is this your first time Linux and Oracle installation? I had a brief look at your referenced link. The reason why you do not find a "oracle" user is because the instructions use "ora11g" instead, which, btw, is not standard. The directories of your installation and your installation source can be somewhat different from known standards and you will have to adjust it to your system.
    My best guess is that you have either missed something in the instructions or you need to ask the author of the blog what is wrong. The chance to find someone here who has experience with these custom instructions is probably unlikely.
    I suggest you try to locate the cluster verification tool, which should be in the bin directory of your grid installation. Alternatively you might want to check the RAC, ASM & Clusterware Installation forum: RAC, ASM & Clusterware Installation

  • How to detect the Acrobat Browser Plug-in version installed on a users system for non-IE browsers?

    How to detect the *Acrobat Browser Plug-in version* installed on a users system, on Firefox, Safari, Opera, etc?
    Or one script for detecting Plug-in version for major browsers. Need full example code.

    Wrote an article on this with code samples (Javascript + HTML) - basically there are differences between IE and other browsers. Chrome natively comes with the Chrome PDF Viewer so I've incorporated that in my detection script.
    The script detects the browser type, and the installed acrobat version...
    Have a look here:
    Detect the Adobe Reader Plugin

  • How to get the Path of the WebDynpro page

    Hi All,
    Can any one say how to get the path of the JSPDynPage ina Portlet in Portal Application.
    Becoz i have to display that Page in another JSPDynPagee
    Thanks in Advance....

    Hi,
    You can call your JSPDynPage component by calling the URL as:
    http://localhost:50000/irj/servlet/prt/portal/prtroot/YourApplicationName.YourComponentName
    Check this:
    Calling portal component
    Greetings,
    Praveen Gudapati
    [Points are welcome for helpful answers]

  • How to get the path of the image stored in sap??

    Hi All
    The problem is
    While making an entry in standard there is a field called documents through which we attach our images in sap.
    How to get the path of the image stored with the corresponding order so that the image can be displayed while we are creating a report.
    I know how to upload the image while creating a report using docking control.
    I am not able to get the path of the image stored...
    Please Help
    Thanks in advance..
    Pooja

    I am not aware of exactly which tables are used for storing the attached doc. details, but we have worked in the similar requiremnent.
    What you can do is .... before uploading the image to any order, try swich on the SQL trace ST05 and after upload switch off.
    The log will display what are the tables involved while storing the image. And you can easily find out the image location.

  • How 2 get the path of a file

    how 2 get the path of a file Using jsp
    i have tried getPath...but i'm geting the error
    The method getPath(String) is undefined for the type HttpServletRequest
    any idea how 2 get the path of a file

    You need ServletContext#getRealPath().
    API documentation: http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)

  • How 2 get the path of a file Using jsp

    how 2 get the path of a file Using jsp
    i have tried getPath...but i'm geting the error
    The method getPath(String) is undefined for the type HttpServletRequest
    any idea how 2 get the path of a file

    You need ServletContext#getRealPath().
    API documentation: http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)

  • How to change the path of sysprep files that were copied to reference computer when i capture the image from reference.

    Dears ,,
    how to change the path that sysprep were copied to reference computer when i capture the image from reference.
    Should i modify some codes in LTIAPPLY.wsf? how to modify it?
    Thanks.

    Sysprep and capture has *Three* steps.
    1. Run sysprep on the local machine (easy).
    2. Copy WinPE down to the local machine so we can reboot into winpe for capture.
    3. Capture the drive in an *offline* state from within WinPE.
    What is most likely happening is that you are having problems with step #2. 100MB is *WAY* too small to copy down WinPE. By default MDT will make this System partition much bigger, 499MB. IF you install Windows 7 from the default media. IT will only create
    a 100MB partition.
    By default MDT 2012 Update 1 and greater *should* recover to a fallback drive with the OS on it, however if you are running older versions that might not happen correctly.
    If you are still having problems, copy your BDD.log file to a public share like OneDrive and copy the link here.
    Keith Garner - keithga.wordpress.com

Maybe you are looking for

  • Trying to resolve license issue

    So I am pretty stumped on how to proceed here and hopefully someone can be of some guidance. I purchased Adobe Creative Suite 5.5 for Windows back in early 2012. I've had this installed on two of my computers for the past couple of years and had no p

  • Desktop Software for MAC allows only two way sync

    hi... I want help with the Blackberry desktop software for MAc. I am able to synce my phone, however there is no way in which I can do a one-way sync  - replacing all the data on the mac with the data of the phone... please let me kniw if there is an

  • Mix published and unpublished events in one calendar?

    Just got an iPhone. Is there a way to mix published and unpublished events in one calendar? I've heard that other calendar software have this option. With iCal on a Mac it's possible to choose which calendars to view, so then it's not a problem to ha

  • Images inverted in Safari & IE

    I have some gradient images on my website which are 1px repeats as part of a CSS rule used for the divisions between my sections. These images are somehow being inverted in Safari and older versions of IE, but fine in Firefox and Opera. Any suggestio

  • Need help with class I'm trying to write for school

    Hi,I'm taking my first Java class, and we're learning how to write classes. I've got MOST of the program and class to work, but I'm still having trouble with it. In the class I wrote, if I delete the "getWindTempF(strAlt)" the program runs fine, othe