How can I get the file path which located on webapps/MY_APPS ?

Hi,
I use tomcat as our servlet container.OS is win2k srv
my project was put on x:\tomcat\webapps\MY_APPS
and I could use getServletContext().getRealPath("/") within a servlet to get x:\tomcat\webapps\ROOT\MY_APPS,
  public void doPost(HttpServletRequest request,
                     HttpServletResponse response)
    throws ServletException, IOException
       String myAppsPath = getServletContext().getRealPath("/");
  }but I could not utilize this method within a normal help class
any suggestion will be welcome.
thanks in advance.

try this:
package com.sample;
import java.io.File;
public class SampleClass
  public SampleClass()
   * @param args
  public static void main(String[] args)
    SampleClass sampleClass = new SampleClass();
    File f = new File("SampleClass.class");
    System.out.println(f.getAbsolutePath());
}

Similar Messages

  • How can I get the File, Edit, View, Windows ect to show in Organiser

    While on various tutorials they all show a
    menu of file, edid, view ect in the top left hand corner of the screen, mine shows only a small square box that when clicked give you the option of restore, close minimise ect. How can I get the file edit menu to show. Should have said in Photoshop Elements 9.

    Thanks Barbara that's done the trick

  • I downloaded new Firefox but now can't open Firefox at all. It says it is not supported on my system. How can I get the earlier version which I deleted?

    I downloaded new Firefox but now can't open Firefox at all. It says it is not supported on my system. How can I get the earlier version which I deleted?

    http://www.mozilla.com/en-US/firefox/4.0/system-requirements/ <br />
    Mac
    Operating Systems
    * Mac OS X 10.5
    * Mac OS X 10.6
    Recommended Hardware
    * Macintosh computer with an Intel x86 processor
    * 512 MB of RAM
    * 200 MB hard drive space
    For older Macs that aren't supported in Firefox 4.0, try TenFourFox for PowerPC's running Mac 10.4.11 & 10.5.8 . <br />
    http://www.floodgap.com/software/tenfourfox/

  • How can i find the file to which Session Manager has saved my session ?

    How can I find the file to which Session Manager has saved my session ?
    == This happened ==
    Every time Firefox opened
    == User Agent ==
    Opera/9.80 (Windows NT 6.0; U; en) Presto/2.5.24 Version/10.53

    From
    http://support.apple.com/en-us/HT4946
    Where your backups are stored
    The folder where your backup data is stored depends on your computer's operating system. Make sure the backup folder is included in your data-backup routine. iTunes places the backup files in these places:
        Mac: ~/Library/Application Support/MobileSync/Backup/
        The "~" represents your Home folder. If you don't see Library in your Home folder, hold Option and click the Go menu.
        Windows Vista, Windows 7, and Windows 8: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
        To quickly access the AppData folder, click Start. In the search bar, type %appdata%, then press Return.
        Windows XP: \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
        To quickly access the Application Data folder, click Start, then choose Run. In the search bar, type %appdata%, then click OK.
    See here for how to backup
    Back up and restore your iPhone, iPad, or iPod touch using iCloud or iTunes - Apple Support

  • How can i get the file on my old PC Laptop to my iMac, how can i get the file on my old PC Laptop to my iMac

    how can I get the files on my old PC Laptop to my Imac

    If you want all of them, see OS X Lion: About Windows Migration Assistant

  • How can i get the local path to my cached app in jws

    Hi,
    sorry, i think it is a stupid question of me. but i'm a newbie in java and jws...
    So my question is...
    is it possible to get the absolute path to my downloaded an d cached jarfile? (e.g. c:\program files\java web start\.javaws\cache\http\Dmy.server.com\P80\RMmyapp.jar)
    thanks a lot for any help.

    I just answered this elsewhere, but here it is again.
    This code seems to work. I found it last year in one of the forums.
    I use it to find resources in Jars or to find images when I am in an IDE
    The "SetIcon.class" below should be changed to the class you are running from.
    Note: If you are running a class in a package, this returns the root of your application instead of the "folder" containing your package. This would mean that the "images" folder I refer to below is under the root folder, not the package folder.
    javax.swing.ImageIcon img;
    URL imgPath1;
    String imgPath2;
    imgPath1 = SetIcon.class.getProtectionDomain().getCodeSource().getLocation();
    imgPath2 = imgPath1.toString();
    imgPath2 = imgPath2.substring(6); // strip off the "file:"
    imgPath2 = imgPath2 + "images/sample.gif";
    Hope this helps,
    Hale

  • How can I get  the MDX-statement which is generated in a query?

    Can I somehow get the MDX statement, which is generated when I create a Query via BeX Query Designer? I am using JCo to connect to BW (3.0b) and to execute MDX statements from a standalone JAVA-application. It would be very helpful to have the statements, so that I don't have to create them by myself.
    If this it not possible...is there any reference regarding the MDX statements, I could use?

    Hi Markus,
    The Query Designer generates no MDX, so you can't find any persisted MDX Statements. But you can do a trick, you can use the SAP BW OLE DB Provider in Excel. This Tool generates MDX Statements check this link:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/a06a51f3-0201-0010-8591-b742cfafd267
    I hope this helps.
    best regards
    Kai

  • How can I get a file path element in XML to work in AI javascript?

    Hi all - this is my first post. I'm pretty familiar with javascript, but I'm new to the Adobe scripting environment.
    Our client wants Illustrator at startup to load a certain pattern swatch. It works fine when I hard code the pattern file path, but it needs to be user configurable, so I put the file path info in an XML file to be read in at startup. The XML file is read in and the elements are extracted into varibles. When I concatenate the variables to create the file path string and try to open the pattern file, it says file not found.
    Here is my source code:
    var fileObj = new File("aiConfig.xml");
    fileObj.open("r:");
    var xmlString = new XML(fileObj.read());
    var driveLetter = xmlString.fullPathName.driveLetter.text();
    var filePath = xmlString.fullPathName.filePath.text();
    var fileName = xmlString.fullPathName.fileName.text();
    var fullFilePath = driveLetter + filePath + fileName;
    var styled_ai = app.open(new File(fullFilePath));
    app.activeDocument = styled_ai;
    Here is aiConfig.xml:
    <?xml version="1.0" encoding="windows-1252" ?>
    <aiConfig>
      <fullPathName>
         <driveLetter>C:</driveLetter>
         <filePath>/Program Files/Adobe/Adobe Illustrator CS4/Presets/en_US/Swatches/Patterns/Decorative/</filePath>
         <fileName>Decorative_Modern.ai</fileName>
        </fullPathName>
    </aiConfig>
    Any help would be greatly appreciated - this is driving me a little crazy.
    Thanks,
    Tom

    Hi Tomchag,
    Your script works fine on MAC OS X & illustrator CS4.
    i have change only pathway to aiConfig.xml like this:
    var fileObj = new File("/Volumes/LaCie/aiConfig.xml"); //<- path of my external HDD should be D:/ on windows
    and the contents in aiConfig.xml to :
    <?xml version="1.0" encoding="windows-1252" ?>
    <aiConfig>
      <fullPathName>
         <driveLetter></driveLetter>
         <filePath>/Applications/Adobe Illustrator CS4/Presets.localized/fr_FR/Nuancier/</filePath>
         <fileName>VisiBone2.ai</fileName>
        </fullPathName>
    </aiConfig>
    So.. i notice twice thing:
    1) complete file and path for aiConfig.xml
    2) i didn't use drive letter (but it's specific to windows)
    I hope this post can help you
    Cyao, art.chrome

  • How can I get the file to unlock my mac mini after hacking my Apple ID?

    Once hacked my account, the hacker deleted all my mobile devices and blocked MacBook and MacMini. Mobile devices I unlocked by the phone with customer support Apple. MacMini unlock failed. How do I get a file to unlock if i have a hash tag?

    In my country, offer to drive to a service center. I want to do it myself.

  • How can I get the File Creation Date OR Last modification date of the incoming file in my message?

    I need the Last Modification Date and the File creation date of the consumed file in my message, is it possible to do that using a custom pipeline component in decode stage or any other way? The FILE namespace have File creation time that actually gives
    the time the file was dropped in receive location, not the actual creation time. Also this namespace doesn't have the Last Modification Date.

    Yes,
    As per MSDN, "File.FileCreationTime" - "Defines the time that the file was written to the folder that is monitored by the File receive
    adapter."
    So for File Modified DateTime, only option I can think of is create a custom file adapter (updating the File Adapter code from SDK ..\SDK\Samples\AdaptersDevelopment\File Adapter) and access the received file with the code something like the following, which
    you give you the Last Modified date
    string sLastModifiedDate = File.GetLastWriteTime(path).ToString();
    If there are any business requirements which drives you this, then this the only way I can think of. Because you can access the file properties only in adapter, when it passes through adapter file is handled as stream and you will only have context properties
    to access the file related properties.
    If you're looking for implement this for any audit purpose or for your any technical purpose, then you can suggest some alternate than using File updated datetime.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • After an update, my itunes library was moved to my music file.  I tried moving the file (itunes library.itl) into itunes, it said that the file was locked.  How can I get the file to be unlocked so it can be moved?

    Need help trying to get Itunes library back on my Itunes

    Disabled
    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                         
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up     
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        
    If problem what happens or does not happen and when in the instructions? When you successfully get the iPod in recovery mode and connect to computer iTunes should say it found an iPod in recovery mode.
    If you previously synced to the computer then you may be able to recovery use of the iPod without erasing the iPod by following the instructions here:
    Disabled Recovery-must use syncing computer.

  • How can i get the component value which is in jtable

    hi all,
    i have a JTable and i added JSpinner component in 1st column.
    i want to get the value of the component.
    i tried to get the value using the following code
    for(int i=0;i<5;i++)
    ((JSpinner)tableDisbursals.getEditorComponent().getComponentAt(i,1)).getValue()it throwing NullPointerException
    is that correct? what i did
    thanks in advance
    daya

    hi all,
    thanks for replay
    the following code is demo
    import hivosCommonMain.function.ComProperties;
    import hivosCommonMain.function.FillCompFN;
    import java.awt.Component;
    import java.util.Date;
    import java.util.Vector;
    import javax.swing.AbstractCellEditor;
    import javax.swing.JFrame;
    import javax.swing.JSpinner;
    import javax.swing.JTable;
    import javax.swing.JTextField;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellEditor;
    public class SpinnerDemo extends JFrame{
         DefaultTableModel tableModel;
         JTable table;
         private String[] columnNames = {"First Name",
                "Last Name",
                "Sport",
                "# of Years",
                "Vegetarian"};
         private Object[][] data = {
                   {"Mary", "12/Aug/2005",
                   "Snowboarding", new Integer(5), new Boolean(false)},
                   {"Alison", "12/Aug/2005",
                   "Rowing", new Integer(3), new Boolean(true)},
                   {"Kathy", "12/Aug/2005",
                   "Knitting", new Integer(2), new Boolean(false)},
                   {"Sharon", "12/Aug/2005",
                   "Speed reading", new Integer(20), new Boolean(true)},
                   {"Philip", "12/Aug/2005",
                   "Pool", new Integer(10), new Boolean(false)}
         public SpinnerDemo(){          
            tableModel     = new DefaultTableModel(data, columnNames);
            table   = new JTable(tableModel) {
                 public boolean isCellEditable(int row, int col) {
                      return true;
            table.getColumnModel().getColumn(1).setCellEditor(new MyCellEditor());
            Component c = table.getEditorComponent();
            Component c2 = c.getComponentAt(1, 0);
            JSpinner spinner = (JSpinner)c2;       
            System.out.println(spinner.getValue());
            getContentPane().add(table);
            setVisible(true);
            pack();
         public static void main(String args[]){
              new SpinnerDemo();
         class MyCellEditor extends AbstractCellEditor implements TableCellEditor {
              JSpinner sDate;
              Object value;
              public MyCellEditor() {
                   sDate = new JSpinner(FillCompFN.getJSpinnerModel());
                   sDate.setEditor(new JSpinner.DateEditor(sDate, ComProperties.DATE_FORMAT));
                   ((JSpinner.DefaultEditor)sDate.getEditor())
                                       .getTextField().setHorizontalAlignment(JTextField.RIGHT);
                   sDate.setOpaque(true);
              public Object getCellEditorValue() {
                   return ((JSpinner.DefaultEditor)sDate.getEditor())
                        .getTextField().getText();
              public Component getTableCellEditorComponent(JTable table,
                   Object value,
                   boolean isSelected,
                   int row,
                   int column) {
                   this.value = value;
                   try{
                        if(value.toString().length() > 0)
                             ((JSpinner.DefaultEditor)sDate.getEditor())
                             .getTextField().setText(value.toString());
                        else
                             sDate.setValue(new Date());
                   }catch(Exception e){
                        e.printStackTrace();
                        sDate.setValue(new Date());
                   return sDate;
    }

  • How can I get the file menu NOT to display in the title bar?

    For Firefox I know I can go into about:config and set "browser.draw.tabs.defaultDrawInTitlebar" and "browser.draw.tabs.DrawInTitlebar" to false, but I have no idea about Thunderbird since I don't know how to access the about:config page or if there even is one.

    You can access about:config from Options > Advanced > General > Config Editor.

  • How can I get the position assigned to the user in CRM .

    Hi all ,
    How can we get the positions to which a  user is assigned as a holder in CRM .
    Thanks ,
    Naval bhatt .

    Hi,
         Use the PPM toolkit class CL_CRM_PPM_UM_TOOLKIT. You can use the method You can use the method GET_ASSIGNMENTS_OF_USER which returns positions held by an user(user name).  You may also find the method GET_POSITION_OF_USER useful. It accepts username and the organization ID and will return the positions held by the user under that organization.
      This class always uses the current plan (01). If you want otherwise, you can use the FM RH_STRUC_GET. As to how this FM should be used, look inside the above said methods.
    Regards,
    Arun Prakash
    Edited by: Arun Prakash Karuppanan on May 11, 2010 11:40 AM

  • How can i get the path to config folder placed inside the jar file?

    Hi i have developed an RCP application using eclipse.
    In my application config directory is there.
    When i export my RCP application as JNLP Project the jar file is created which contains config folder inside it.
    When i download the application using java web start , how can i get the path to config folder placed inside the jar file?
    Will the config folder exists in local cache in my system?
    Help needed.
    -Deepak

    -- This works in CS6:
    tell application "Adobe InDesign CS6"
      set myDocument to active document
      set selectedRectangles to selection of myDocument
      set theGraphicsLink to file path of item link of (graphic 1 of (item 1 of selectedRectangles))
    --> "Macintosh HD:folder/folder/filename.tif"
    end tell

Maybe you are looking for

  • Do not understand how to manage multiple libraries in iTunes

    Hope to learn from you! What I am trying to achieved? Using the proper procedures as described in "iTunes for Mac: Moving your iTunes Media folder" - I have succesfully moved my iTunes library to an external hard disk. So, I can play from this HDD wh

  • HP LAser Jet Pro MFP M127fw not Receiving Auto FAX

    I Own two HP All-in-Ones.  First is an Officejet 7500A and second is an HP LaserJet Pro MFP M127fw. I hooked my Phone line to the 7500 and was able to send and receive FAX's, but no matter what I did (Including setting it to Automatically Receive FAX

  • Working on SQL Developer / pl/sql developer without installing Oracle

    HI, I am working on SQL Developer tool without installing oracle into my local machine. I just took server IP as hostname and continuing with the same/ Now, since I donot have tns names, I am not able to use any other user other than my work related.

  • Button to another swf

    Hello, I have a problem. I'm trying to make a button go to a frame of another swf but it doesn't work as I expected because in the flash archive from wich I call the other one there's only 2 frames, and the other one has more than 2. That makes the s

  • REG: Hiding Objects in adobe forms

    Dear Experts, I am working on interactive forms. I have some queries which are as following: - I am designing an adobe template with a subform to be diplayed when required else not. I tried the visibility option but it seems it has to be done using S