How to access a physical file of a java class DataModel?

Hello

I have a ViewObjectImpl file needs access to a physical file.

for example, my VOImpl located in the oracle.web.datamodel.queries package (directory of window: C:\JDeveloper\jdev\mywork\WEB\DataModel\classes\oracle\web\datamodel\queries), if I put the file in the directory of "C:\JDeveloper\jdev\mywork\WEB\DataModel\public_html\fileABC.txt", how can I write the relative path for the VOImpl java class to access the fileABC.txt?

The absolute path to the file works fine, but I want to know the relative path to make it work if I deploy it on the server.

Thank you very much!

OK, one more time:
If you use the file, you must specify the absolute path that you shouldn't do it because you don't know the path on a server that you deploy the application to.
I recommend to use getResourceAsStream instead, because it allows you to specify the path to the file from the path of the class of applications:

    public String getABCFile()
    {
        String path = "oracle/web/datamodel/queries/fileABC.txt";
        InputStream is = this.getClass().getClassLoader().getResourceAsStream(path);
        if (is == null)
        {
            System.out.println("ABC NOT FOUND!");
        }
        else
        {
            System.out.println("BINGO ABC FOUND");
            byte[] data = new byte[500];
            try
            {
                is.read(data);
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            String res = new String(data);
            System.out.println(res);
            return res;
        }
        return null;
    }

Code assunes that the fileABC.txt file is in the location/web/datamodel/applications oracle. All you have to do is to make sure that the file is deployed to this place (in the classpath).

Timo

Tags: Java

Similar Questions

  • How to access a shared file on my RN212 NAS remotely from another program?

    I've looked everywhere trying to find how to access a shared file on my RN212 NAS remotely from another program (kodi) on my iPhone 6 more remotely, away from home. I tried to FTP, UPnP, HTTP, etc. anything and it's driving me crazy! I run the program kodi from my phone for watching videos stored on my SIN, I have a router NightHawkR7000 and believe that I am fairly warned to get this figured out, but apparently not lol I have all the correct ports forwarded, but perhaps I'm missing a step somewhere. Any help on this would be much appreciated!

  • How to access to the file printing in LR CC?

    How to access to the file printing in LR CC?

    There are no print queue in LR. The print queue is managed by the operating system.

    What is your operating system? What exactly is your problem?

  • Can someone help me understand how to access such RW2 files saved by my Lumix LX100 in Lightroom 4.4?

    Can someone help me understand how to access such RW2 files saved by my Lumix LX100 in Lightroom 4.4?

    Hi Edward,.

    4.4 Lightroom does not support files of Lumix LX100 RW2. You need at least 5.7 version of Lightroom to access these raw files.

    Or, you can use free Adobe DNG Converter to convert raw to DNG files, and then import the DNG in Lightroom.

    For Mac: http://www.adobe.com/support/downloads/detail.jsp?ftpID=5854

    For Windows: http://www.adobe.com/support/downloads/detail.jsp?ftpID=5864

  • How to access the textedit files in Icloud on time machine

    Hi all

    Bad, I need your help! I'm trying to access all my text edit files, which I had saved on ICloud.
    My laptop does not run successfully. I was proposed to restore and re - install the op system. So I run a Machine back up full time and I restored my laptop. I should all have backed up, right?
    Problem is: I'm trying to get all my work on Tex Edit, but I can't find it on Time Machine. Does anyone know how can I recover these files? I have two important years of drafting work there!
    It would be good to have your suggestion.

    Thanks in advance for your help

    Did you you save the files in the correct format - OS X Server: how to modify the configuration files - Apple support?

  • How my access application may file on the SD card

    Hello to the developers, please how my access application on the SD card/media files

    [reformatted in subject line]

    check the fileexplorerdemo of shipment with the jde/ejde.

    and the problem with your capslock.

  • How to access the PHP files

    Need to access PHP (.ctp) files with Dreamweaver and SEO attributes.  For example, wanting to "Insert" Meta Keywords.  The files accesses I have these fields 'greyed out', they are not available.  Is there a particular configuration in Dreamweaver to access download to a Web site with shirts programmed into the cake (.) PHP)


    Using DreamWeaver on Mac OSX 10.9.4

    You do not have my point. Dreamweaver can work with PHP, but files not files of CAKE.

  • How to pass an argument to a standalone java class JDeveloper

    For the experienced:

    In JDeveloper when you write a java class with a main() method that takes no arguments, you just click with the right button on the java file and choose run to run the program. But suppose the main() method takes arguments, how to move your arguments to the program? This is especially a problem I use the studio version of JDeveloper (10.1.3.4 and 11.1.1.3 Versions) that each uses the version of the JDK included with, rather the JDK (which is yet another different version) installed at the level of the OS on the PC.

    Thanks a lot for your help!


    Newman

    Hello

    If you mean how to pass arguments in JDeveloper:
    Tools > Project Properties > run/debug > change the default run Configuration (or create a new) > settings start > program Arguments - here you can set arguments

    Kind regards
    Branislav

  • Satellite A200-23Z - HARD drive as external drive USB - how to access all the files?

    Hello!

    After losing the motherboard of my Satellite A200-23Z I need save some important files to hdd satellite. With external USB enclosure, I can only access some... Can't see program files, filesystem - really nothing disk system, a large number of files was on the desk...

    How to get full access to all the hard drive? -to all logical drives?

    Please - help... :(
    Ivars

    I put t understand what is happening here. I have old P200 (similar to yours but with 17 inch screen) and when I connect the HARD drive as external HARD drive to my new P500 I have full access to all stored data.
    There is no limitation at all.

    > was a lot of files on the desktop...
    Do you know how to find the right location for desktop?

  • How to access the photo files in the Finder?

    I just updated my system to the picture and I can't access my images in the Finder - the show in Finder option file is not available. What should I do?

    The new Photos.app does not reveal the photos managed in the Finder, like iPhoto does.

    You can only reveal image referenced in the Finder, you manage yourself and have not been copied to the photo library.

    If you want to access the original image files that you have imported, use "file > export" save a copy on your desktop.

    The management of the files of origin in the Photos is much more complicated than in iPhoto, so it make much sense to reveal the originals. Photos can simultaneously have several copies of them--in the masters, in iCloud folder or in a folder with temporary items. And if you use "Optimize Mac Storage", there may be no files to reveal to all, because the only copy will be in iCloud and not on your Mac.

  • How to access the CSS files for the plugin Enkitec-database file directory navigation bar

    Apex 4.2.3.00.08

    Enkitec-NavBar-1-2-0-for-4-2

    Hi I am faced with the same question that: https://community.oracle.com/thread/2563229

    Enkitec vertical list Navbar appears momentarily until it is formatted by CSS and it seems OK.

    It is really annoying and makes pages look stupid. This problem is identified as a performance problem and can be solved by putting the support of Plugin files in directories of files instead of the database.

    I created a directory on the database server: D:\102175\Kav\Plugin

    I created a Directory pointing to the file directory database:

    CREATE or REPLACE directory PLUGIN AS "D:\102175\Kav\Plugin".

    GRANT READ THE PLUGIN DIRECTORY TO THE PUBLIC;

    GRANT READ THE PLUGIN DIRECTORY TO ANONYMOUS.

    GRANT READ THE PLUGIN DIRECTORY FOR UTVIKLING.

    I also copied the CSS etc support plugin files in the files directory.

    In the Apex plugin I changed the prefix 'file' #PLUGIN_PREFIX # D:\102175\Kav\Plugin

    Now all the Navbar formatting disappeared and now the navigation bar appears only in form of vertical list.

    I also tried to use the PLUGIN as 'File prefix' same thing.

    I'm not Apex or Web expert so I'm sure there is something that I misunderstood.

    Hope some of you are able to help out me.

    Sincerely

    Arild

    Hmmm, well it does not matter if you do the mapping. The embedded PL/SQL gateway is well integrated in the database in PL/SQL.  All your resources (images, CSS, javascript, etc.) are still be extracted from the base in order to be served to the client. Those in the file system are not in use after installation.

    This is going to be heavy.

    I think you may still be able to make some optimizations by moving the assets of plugin for a name that is mapped by the gateway.

    In your apex installation, take a look at apxldimg.sql see how records and assets are added.  You can then add the plugin files.

    See if that helps.

    In addition, you can follow the comments of Patrick on the post you are referencing and move the inclusion of files to the top of the page AND change the plugin so it does ' t add any more files.  Now in theory, you can skip the download folder and the image and add the plugin assets as standard apex post and reference them with #WORKSPACE_IMAGES # #APP_IMAGES, or # (if you add specifically for an application). But you still want to include them at the top of the page.

    Sorry... I know it's a lot of things to take and much heavier than expected.

    Thank you

    -Jorge

  • How to access a PDF file imported inside a rectangle and move

    Hi, I have the following code which puts a PDF file inside a rectangle var f = new File ("C:/pdf.pdf");    var doc = app.activeDocument;  var thepdf = doc.pages [0] .rectangles [0] .place (f, false);  doc.pages [0] .rectangles [0] .fit (FitOptions.FILL_PROPORTIONALLY);  Now I want to spend "thepdf" (which is the type of PDF object), but I can only find a way to move the rectangle around it. I need to move the inner rectangle (PDF), as I would with the direct Selection tool. is this possible?

    Yes. It is possible.
    The PDF file placed inside the rectangle is the graphics object [0] of the rectangle.
    Or, if search you the collection of links, the parent of this link. The parent of the parent that is the container, the rectangle object.

    myRectangle.graphics[0].move(/*insert your arguments here*/)
    

    Move the PDF file inside. When the move() method could have different arguments:

    Adobe InDesign CS6 (8,0) object model JS: graph

    Uwe

  • How to access all the files in a directory.

    I want to get the path for all files exist in a directory.

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:439619916584

  • How to access a text file located above web root?

    For security, I would like to place a text file with the login above the web root. Currently the file not above the root and is accessible like this:

    < cffile
    action = "read".
    file = "path/file.txt"
    variable = "userList" >

    followed by

    < cfset variables.userList.userArray = listToArray (userList, Chr (10)) >.




    If you know the correct path to the file, you should be able to reference simply in the attribute line of CFFILE:

    If you need to dynamically determine the path, you can explore CF ExpandPath supplier and similar functions in the category of the functions of the system of online for CF 8 documentation:
    http://livedocs.Adobe.com/ColdFusion/8/htmldocs/index.html

  • How to access data in an instance of a class?

    I have a class LoadXML, that charge and extracts data from an XML file. I use these data to my main class by creating a new class of LoadXML. I now want to use these data for my other classes but without having to create another instance of LoadXML. As global variables do not exist in A3, I tried creating LoadXML methods get and back then these values into variables in the desired classes. This is how I have tried:

    public class ProductSummaryLabel extends Sprite
    {  
       public var loadXML : LoadXML; 
      private var xmlData: XML = loadXML.getXMLData(); // BRINGS BACK ERROR
      private var uebersicht : Array;
      private var website : Array;
      private var numOfProducts : int;  
      private var numOfCategories : int;
       
      //____________________________________________________________________________Constructor
      
      public function ProductSummaryLabel() : void
      { 
         numOfCategories = loadXML.getNumOfCategories(); // THIS BRINGS BACK AN ERROR
         trace("number of categories" + numOfCategories);
      }
    

    That's what my LoadXML class looks like:

    public class LoadXML extends EventDispatcher 
    {
      //__________________________________________________________________________XML vars
     
      private var loader : URLLoader = new URLLoader();
      private var productPath : URLRequest = new URLRequest("produkte1.xml");
      public var xmlData : XML = new XML();
      public var maxProducts : int;
      public var numOfProducts : int;
      public var numOfCategories : int;
      //____________________________________________________________________________Arrays
          
       public var kategorie : Array = new Array();
       public var hintergrund : Array = new Array(); 
       public var titel : Array = new Array(); 
       public var pfad : Array = new Array(); 
       public var website : Array = new Array();
       public var uebersicht : Array = new Array();
       
      //__________________________________________________________________________Constructor
      
      
      // Load XML text data
      public function LoadXML() : void
      { 
       loader.addEventListener(Event.COMPLETE, extractXMLdata);  // Specifies which data to load
       loader.addEventListener(IOErrorEvent.IO_ERROR, handleXMLError);
       
       try 
       {
        loader.load(productPath);
        trace("Step 1: Product path loaded correctly.");
        trace("Product path: " + productPath);
       }
       catch(e : Error)
       {
        trace("Error loading file");
       }
      }
      
      //__________________________________________________________________________Methods
      
      private function extractXMLdata(e:Event) : void
      { 
       // Extract data
       trace("Step 2: Data extracted");
       
       // The reference to e.target below refers to the object that loaded the XML file. 
              xmlData = new XML(e.target.data);
       trace("XML Data assigned as target data.");
       ParseData(xmlData);
      }
      
      private function ParseData(dat : XML) : void
           {
       numOfProducts = xmlData.*.length();
       trace("Number of Products (LoadXML class): " + numOfProducts);
    
      trace("Step 3: Parsing data.");
      
       for (var i: uint = 0; i < numOfProducts; i++)
       {
        // This was in the wrong format: kategorie[i] = xmlData.produkte.produkt.kategorie.attributes()[i];
        kategorie[i] = xmlData.produkt[i].kategorie;
        website[i] = xmlData.produkt[i].website;
        uebersicht[i] = xmlData.produkt[i].uebersicht;
        hintergrund[i] = xmlData.produkt[i].bild.hintergrund;
        titel[i] = xmlData.produkt[i].bild.titel;
        pfad[i] = xmlData.produkt[i].bild.pfad;
        trace("\n Data Parsed for Array " + i);
       }
    
     // When LoadXML class loaded, load onBackgr() from Main class
        dispatchEvent(new Event(Event.COMPLETE));
    
      }
      
      
      //__________________________________________________________________________________ Getters
      
      public function getXMLData(): XML
      {
       return xmlData;
      }
        public function getCategory(): Array
      {
       return kategorie;
      }
      
    (... rest of get methods)
    
      
      //____________________________________________________________________________Error catching
      
      private function handleXMLError( event:IOErrorEvent ):void 
           {
             trace("Fehler beim Aufrufen von XML.");
           }
     }
    }
    

    Instead of Globals, you can use a class with the static member variable

    class GlobalVars

    {

    public static var MyVar: VarType.

    }

    and you can get and set the value of MyVar where each at any time like this

    GlobalVars.MyVar

Maybe you are looking for

  • Migrate to El Capitan in a dual boot Situation

    I have a Mac Book Pro 2011 with two internal hard drives.  (I got the optical drive, replaced by the second hard drive).  A reader has installed El Capitan.  The other disc has Snow Leopard.  I want to finish my transition to El Capitan while being a

  • Lauch a shortcut to my .exe with parameters

    Hi guys,. I would like to know if it is possible to set the parameters after the path 'target' in the shortcut of my .exe to launch my application. That is to say: shortcut key 1: Like 'C:\labview\MyAppli.exe' /File_Config_1 2 shortcut key: /File_Con

  • Received several times updated security

    Receipt on several occasions to security for Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package; even after having been installed four times.

  • BlackBerry smartphones removing an app?

    I downloaded WeatherBerry.  The application icon is on my screen, however, I can't get the app to work.  A kind of java script error ' eception exception: java.lang.error.»  I've been round and round with this question, no luck.  In any case, no, I w

  • Parent Directory only

    Have a quick question that I can't find to get aid into the ESTB.  I'm trying to get the parent folder name to a file without the full directory.DesktopFile - need this nameFileI tried ($..) Parent SourceFile);  It only returns the "Desktop", but not