How to get application path in java bean

hi all,
We will be using <%= application.getRealPath("/") %> for getting the application path in jsp. is there any similar way to find the path using a bean. Please do help....
thanx
Message was edited by:
end

I try to use application.getRealPath("/") in my .java file, but gets an error "application can't be resolved". Do you need to include any library in order to use "application.getRealPath("/")"?
Thank you.

Similar Messages

  • How to get Application path? Urgent!!!!

    Hai!
    I have developed one application in Swing. I want take application path in that application. How can I get? Anybody pls help to me.
    Thanks in advance
    Joseph

    You can try this code to get all properties:
    Properties props = System.getProperties();
    Enumeration enum = props.propertyNames();
    while(enum.hasMoreElements()){
         String name = (String)enum.nextElement();
         System.out.println("Prop Name: " + name + "\tValue: " + props.getProperty(name));
    }And to find more about printing you can check this URL:
    http://java.sun.com/j2se/1.4/docs/guide/jps/spec/jpsOverview.fm.html

  • How to get component path in java code

    Hi everybody,
    I have my custom component with custom folders with pictures. My custom component works with pictures. I need to know PATH to this custom component in my java code.
    Thank you
    Martin

    Check out methods in the following classes: LegacyDirectoryLocator and DirectoryLocator.
    Jonathan
    http://jonathanhult.com

  • How to find Application Path

    Hi
    How to get Application Path from form module (Any Built Ins)

    Hi,
    declare
    curform varchar2(100);
    begin
    curform:=get_application_property(current_form);
    end;
    hope it helps u..
    navneet jain
    [email protected]

  • How to get the path of my java dir in java?

    Hi,
    I want to get dir path in java.
    I want to know from where I'm runing in the computer
    somthing like this?
    String osUserName = System.getenv("????????");
    Thanks and have a good day!

    Hi,
    I have "deploy" directory, and I whant to be able to import it to every computer with out to define things in class path.
    in my deploy I have my jar, lib directory, bech file to run (ther I have script with the libs path..), I want to put in deploy the db.properties file.
    then just ask "from where I'm running" -->
    String osWorkDir = System.getProperty("user.dir");then just to add this path "/db.properties"
    The problem with it:
    osWorkDir = C:\MyJava\deploy
    and I need:
    C:/MyJava/deploy
    Thanks :)
    I want to import my

  • How to get application module instance from java bundle?

    Hi!
    I would like to build an application that would get all translations from a database table.
    So I created application module for translations that contains a view object which is selecting translations for specific language from a database table. I exposed a method in application module as client interface which returns HashMap<String, String> for all translations for specific language. When I test my view and client interface method call they work fine.
    Then I created java bundle classes to get translations for specific language. Then I tried to override public Object[][] getContents() method.
    I tried to get my translations application module like this:
    SharedTranslationsAppModuleImpl am = new SharedTranslationsAppModuleImpl();
    Map<String, String> translationsMap = am.getTranslations(this.getLocaleCode); // Client interface method call
    In getTranslations(String LocaleCode) I try to get that view (which would select translations from database) but it returns NULL and I get NPE error message.
    So what is the right way to get application module from java bundle file? Now everytime application wants to get translations, application stops and displays NPE message.
    Regards, Marko
    I use JDeveloper 11.1.2.1.0

    Marko,
    you can't just instantiate an application module. An application module has to be set up, db connections and memory pools have to be initialized and ....
    Can you describe why and when you try to read the resource bundle from the db and where the resource bundle is used?
    This blog may be what you are looking for http://technology.amis.nl/2012/08/10/implement-resource-bundles-for-adf-applications-in-a-database-table/
    Timo

  • 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 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 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)

  • Get Application Path

    Dear All,
    In my Application, i want to save a File where the Application is installed.
    How the get  the Path of the Application ?
     Thanks,
    Ritesh
    Solved!
    Go to Solution.

    Use the Current VI's path function in your main VI. Please read this document.

  • 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 to get absolute path of a form within the Forms

    Aslam o Alikum (Hi)
    How to get absolute path of a form within the Forms 6i or 9i
    For example
    i am running a from "abc.fmx" from C:\myfolder directory
    can i get the form path 'C:\myfolder' by calling any any function from "abc.fmb"

    There is no direct call that will always work. What you need to do is call get_application_property(current_form). This may have the full path in it, depending on if that path was defined when the form was launched. If there is no path, then you need to use TOOL_ENV.GETVAR to read the Forms<nn>PATH and the ORACLEPATH, parse those out into individual directories and then check for the FMX in each.
    I already have some code to do all this for you see:
    http://www.groundside.com/blog/content/DuncanMills/Oracle+Forms/?permalink=4A389E73AE26506826E9BED9155D2097.txt

  • How to get Application Component in RSA1

    Hi Experts,
    I am not find any Application Components (RSA1) all my Data Sources are under the tree of Unsigned Nodes.
    How to get Application Component for my application, I am developing HCM application under that E-Recruiting.
    Can anyone help me regarding this.
    Regards
    Vijay

    Hi
    Whatever you have on infosource,will have same components.
    Goto RSA1 then source systems. double click on source system then right click on ypur R/3 source system then say display datasource tree.
    Chandu.

  • How to get Application Module in JDev 10.13 with own java Methode ?

    Hello,
    I've tried to save a table from my BC4J to file system...
    for this i call my class from a jsp page:
    <%
    try {
    // RESPONSE
    String aktDbName = request.getParameter("aktDbName");
    response.setContentType("text/html");
    ByteArrayOutputStream buffer = Err_alertLogPageController.saveAL(pageContext);
    String filename = "alert_"+aktDbName+".log";
    response.setHeader("Content-Disposition","attachment; filename=\"" + filename + "\"");
    // DOWNLOAD
    DataOutput output = new DataOutputStream(response.getOutputStream());
    byte[] bytes = buffer.toByteArray();
    response.setContentLength(bytes.length);
    for (int i = 0; i < bytes.length; i++) {
    output.writeByte(bytes);
    } catch (Exception ex) {
    %>
    Sorry, error...
    <% } %>
    My Java Methode looks like this:
    public static ByteArrayOutputStream saveAL(PageContext ctx) {
    ByteArrayOutputStream baos = null;
    try {                         
    System.out.println("Get container...");
    DCBindingContainer bindings = (DCBindingContainer)ctx.getRequest().getAttribute("bindings");
    BindingContext bc = bindings.getBindingContext();
    System.out.println("get AM...");
    DCDataControl dc = bc.findDataControl("AppModuleDataControl");
    ApplicationModule am = (ApplicationModule)dc.getDataProvider();
    System.out.println("get View");
    ViewObject voAL = am.findViewObject("DispAlertLogView");
    System.out.println("create streamer...");
    baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    System.out.println("loop...");
    voAL.first();
    ps.println(voAL.getCurrentRow().getAttribute("Line").toString());
    while(voAL.hasNext()){
    voAL.next();
    ps.println(voAL.getCurrentRow().getAttribute("Line").toString());
    } catch (Exception e) {
    System.out.println("Error on FileSave (alert log): " + e);
    return baos;
    in principle it works well, but i get a null Pointer exception at:
    DCBindingContainer bindings = (DCBindingContainer)ctx.getRequest().getAttribute("bindings");
    I already tried to deliver PageLifecycleContext in jsp page, but then an error occur that it is not possible to deliver this variable.
    I hope you know a solution to get AppModul,
    or even deliver the PageLifecycleContext-Variable then i could get AppModul on my own
    Thanks
    Sebastian
    Message was edited by:
    Sebastian_ME

    Note that there is an extension called Simple Java Bean Editor that will give you back a similar tab - get it through help->check for updates

Maybe you are looking for

  • Need to change my password NOW, and where is a DBA when you really need one

    I'm attempting to teach myself SQL using the book "Murach's Oracle SQL and PL/SQL". They recommended downloading Oracle Express Edition. I downloaded Express Edition 11g. The book says it's applicable with all versions through 11g. Anyway, last Sunda

  • IMac 2.93GHz 1TB External Drive Errors

    Hi, I received my new 24", 2.93GHz, 1TB HDD, 4GB RAM, 512MB Nvidia iMac on Wednesday, and have had no end of problems when trying to copy files from external drives. The three results of doing so are as follows: 1. I'm informed that I don't have suff

  • IPhone 4s contacts dissappear and email address on contacts change to numeric

    Hey guys i kept on getting some of my contacts dissappearing and the email address on some of my contacts change to a numeric number. My iphone was running on OS 5.1.1 before i updated to OS 6. My contatcs are synchronising to my email, i cloud and y

  • Handling Planned order created from Demand planning and Sales order in MTO

    Hi all In MTO\ Repetitive we genrate Dependent requirement from demand planning (PIR) after running MRP which finally planned order created but on the other hand in short term we have Sales order which generate planned order after running MRP(In MTO)

  • Ibooks author table of contents

    K.T. the iBOOK is coming along, however the Table of Contents is a tad off. It shows sections as 1.1 and 1.2. See screen shot. Ideally I would like TOC to be formatted as: Ch1, section 1, section 2, etc. Thanks for your help.