Query JVM for executing JAR absolute path

Good morning
In order to use resources in an executed JAR file, I use the following :
URL url = JARFILENAME.class.getResource(myResourceRelativePath);But, JARFILENAME is the name of the JAR file which is being executed and I would not like it to be hard coded. Is there anyway to query the JVM the absolute path of the executed JAR file ?
Thanks a lot
Christophe

Good Afternoon everybody,
Thank you very much Owen ! Your words were very helpful to me.
In order to help other people who would like to process text files embedded in an executable JAR file, here all my sources for this example.
HOW TO PROCESS TEXT FILES EMBEDDED IN AN EXECUTABLE JAR FILE WITH PACKAGED CLASS FILES
File list for the project (after executing the makefile) :
.\build
.\docs
.\src
.\makefile.bat
.\JarTextResourcesReaderDemo.jar
.\sources.txt
.\JarTextResourcesReaderDemo(Sources).zip
.\build\cbismuth
.\build\txt
.\build\manifest.mf
.\build\cbismuth\demos
.\build\cbismuth\utils
.\build\cbismuth\demos\JarTextResourcesReaderDemo.class
.\build\cbismuth\utils\jar
.\build\cbismuth\utils\jar\textreader
.\build\cbismuth\utils\jar\textreader\JarTextResourcesReader.class
.\build\txt\myTextFile.csv
.\docs\cbismuth
.\docs\package-list
.\docs\resources
.\docs\stylesheet.css
.\docs\allclasses-frame.html
.\docs\allclasses-noframe.html
.\docs\constant-values.html
.\docs\deprecated-list.html
.\docs\help-doc.html
.\docs\index.html
.\docs\index-all.html
.\docs\JarTextResourcesReader.html
.\docs\JarTextResourcesReaderDemo.html
.\docs\overview-frame.html
.\docs\overview-summary.html
.\docs\overview-tree.html
.\docs\package-frame.html
.\docs\package-summary.html
.\docs\package-tree.html
.\docs\cbismuth\demos
.\docs\cbismuth\utils
.\docs\cbismuth\demos\JarTextResourcesReaderDemo.html
.\docs\cbismuth\demos\package-frame.html
.\docs\cbismuth\demos\package-summary.html
.\docs\cbismuth\demos\package-tree.html
.\docs\cbismuth\utils\jar
.\docs\cbismuth\utils\jar\textreader
.\docs\cbismuth\utils\jar\textreader\JarTextResourcesReader.html
.\docs\cbismuth\utils\jar\textreader\package-frame.html
.\docs\cbismuth\utils\jar\textreader\package-summary.html
.\docs\cbismuth\utils\jar\textreader\package-tree.html
.\docs\resources\inherit.gif
.\src\cbismuth
.\src\cbismuth\demos
.\src\cbismuth\utils
.\src\cbismuth\demos\JarTextResourcesReaderDemo.java
.\src\cbismuth\utils\jar
.\src\cbismuth\utils\jar\textreader
.\src\cbismuth\utils\jar\textreader\JarTextResourcesReader.java[b]File .\sources.txt :
.\src\cbismuth\utils\jar\textreader\JarTextResourcesReader.java
.\src\cbismuth\demos\JarTextResourcesReaderDemo.java[b]File .\makefile.bat :
@title Java Project Compilation
@echo off
echo ------------------
echo Old Files Deletion
echo ------------------
del /f /q *.zip
del /f /q *.jar
del /f /q build\cbismuth
echo -----------
echo Compilation
echo -----------
javac -O -deprecation -d build @sources.txt
echo -------------------
echo Java Doc Generation
echo -------------------
javadoc -author -version -private -windowtitle JarTextResourcesReaderDemo -d docs @sources.txt
echo -------------------------
echo Executable JAR Generation
echo -------------------------
cd build
jar -cvfm JarTextResourcesReaderDemo.jar .\manifest.mf *
move JarTextResourcesReaderDemo.jar ..
cd ..
echo ----------------------
echo ZIP Project Generation
echo ----------------------
jar -cvf JarTextResourcesReaderDemo(Sources).zip *[b]File .\src\cbismuth\utils\jar\textreader\JarTextResourcesReader.java :
package cbismuth.utils.jar.textreader;
import java.io.IOException;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.NullPointerException;
import java.lang.IndexOutOfBoundsException;
public class JarTextResourcesReader {
  protected BufferedReader[] readers = null;
  public JarTextResourcesReader(String[] paths) throws NullPointerException {
    int nbFiles = paths.length;
    readers = new BufferedReader[nbFiles];
    for (int i = 0; i < nbFiles; i++) {
      InputStream inputStream = this.getClass().getResourceAsStream(paths);
this.readers[i] = new BufferedReader(new InputStreamReader(inputStream));
if (readers[i] == null) {
throw(new NullPointerException());
public void print() {
for (int i = 0; i < readers.length; i++) {
String line = null;
try {
while((line = readers[i].readLine()) != null) {
System.out.println(line);
catch(IOException e) {
// exception managment
public BufferedReader getReaderAt(int i) throws IndexOutOfBoundsException {
if (i > this.readers.length) {
throw(new IndexOutOfBoundsException());
else {
return(this.readers[i]);
public BufferedReader[] getReaders() {
return(this.readers);
public void close() {
for (int i = 0; i < this.readers.length; i++) {
try {
readers[i].close();
catch(IOException e) {
// exception managment
File .\src\cbismuth\demos\JarTextResourcesReaderDemo.java :
package cbismuth.demos;
import cbismuth.utils.jar.textreader.JarTextResourcesReader;
public class JarTextResourcesReaderDemo {
  public static void main(String[] args) {
    String[] paths = new String[1];
    paths[0] = "/txt/myTextFile.csv";
    JarTextResourcesReader jtrr = new JarTextResourcesReader(paths);
    jtrr.print();
    jtrr.close();
}[b]File .\build\txt\myTextFile.csv :
Line 1 Column 1;Line 1 Column 2;Line 1 Column 3
Line 2 Column 1;Line 2 Column 2;Line 2 Column 3[b]File .\build\manifest.mf :
Main-Class: cbismuth.demos.JarTextResourcesReaderDemo
[BLANK LINE !]NOTE : a blank line MUST be left at the end of the MANIFEST file !
[b]Command line to execute the JAR file in the root directory :
java -jar JarTextResourcesReaderDemo.jar[b]Output :
Line 1 Column 1;Line 1 Column 2;Line 1 Column 3
Line 2 Column 1;Line 2 Column 2;Line 2 Column 3[b]Special thanks to Owen !
See you soon,
Christophe

Similar Messages

  • Classpath is not working for executable jar file

    I have created executable jar file using following command where manifest file contains Main-Class and Class-Path entries.
    jar cvfm app.jar META-INF/* lib/* *.class
    So here app.jar contains my external jar's in lib directory
    but when I move app.jar to another directory, it's doesn't get my external files.
    I'm not getting this problem as these jar's are in app.jar
    class-path entry in manifest file:
    Class-Path: lib/abc.jar lib/xyz.jar
    Pls help me where it is getting fail?
    Thanks in advance,
    Vikas

    Java doesn't handle jars within jars. Your library jars need to be outside of the executable jar as in
    dist - main.jar
          - lib  -  lib1.jar
                 -  lib2.jar

  • Increase memory for executable JAR (not -mx)

    My app runs out of memory, but I can't use the -mx flag because I want the Windows user to be able to double click the .jar file to execute it. Is there a way to either specifiy in the jar file, in the manifest, or programmatically to increase the max memory available? Surely there must be a way because it's pretty sad that the user has to fall back to typing in -mx themselves on the command line.

    >
    My app runs out of memory, but I can't use the -mx
    flag because I want the Windows user to be able to
    double click the .jar file to execute it. Is there a
    way to either specifiy in the jar file, in the
    manifest, No.
    or programmatically to increase the max
    memory available? The registry key. Or change it under FileTypes in explorer under Tools->'folder options'
    Or create a batch file.
    Surely there must be a way because
    it's pretty sad that the user has to fall back to
    typing in -mx themselves on the command line.Java is cross platform compatible.
    The JVM is not.
    InstallShield provides a multitude of ways to handle problems like that along with providing a familar installation method for the user.
    You might also look at "Java Web Start".

  • CodeSecurity in executable jar.............

    AOA
    I have a code security concern for executable jar distribution.
    Any one could unzip the jar and get the classes decompiled.
    So tell me that what are means to secure the code in jar.

    So tell me that what are means to secure the code in jar.Make it a web-based app and never distribute your code.

  • Embedding fonts in AS3 with absolute paths

    I'm having difficulty embedding fonts in AS3. For instance,
    using absolute paths:
    [Embed(source="C:\WINDOWS\Fonts\CONSOLA.TTF",
    fontName="Consolas", mimeType="application/x-font-truetype")]
    ... I get the error message: "Error: unable to resolve
    'C:WINDOWSFontsCONSOLA.TTF' for transcoding.
    I'm hoping the backslashes are missing from the error just
    because the compiler doesn't return them, and not that it's losing
    them. I've tried various TTFs with the same result. Even tried
    copying code from the AS3 Cookbook letter for letter. :)
    Thoughts?

    I have a similar issue happening. I am using AS3 and have
    this code in my file:
    // package, import statements etc...
    // the line below is the problematic line
    [Embed(systemFont="..\\..\\..\\fonts\\arial.ttf",
    fontName="Arial (True Type)",
    mimeType="application/x-font-truetype")]
    // now declare my class
    public class ImageRotator extends UIComponent
    // etc.
    The class compiles fine but when I try to run it I get the
    following runtime error:
    "Error: Error #2136: The SWF file
    file:///C:/projects/photogallery_screensaver/bin/photogallery_screensaver.swf
    contains invalid data."
    I've tried several things including changing the location of
    the font file, using a different font file, embedding a systemFont.
    But I always get the same error.
    Help please!
    Thanks,
    Dan

  • How to pass -Hotspot or -Xingc to the jvm when using an executable Jar?

    Hi, my problem is that when i start my application with the jar-File ("Main-Class: " in the Manifest), it 's very slow.
    When i start it with
    java -hotspot -Xincgcit works fine.
    So my question is: how do I have to set these options in the Manifest of the Jar-File?
    Thanks a lot in advance.
    Michael

    So my question is: how do I have to set these options in the Manifest of the Jar-File?You don't.
    An executable jar supplies information on running it to whatever runs it. The parameters "-hotspot -Xincgc" are parameters to a specific jvm and as such belong to the jvm not the jar.
    If you want your stuff to run with that then do one of the following:
    -Provide an install that sets the computer up that way.
    -Provide a script for each OS that you support that runs it with the required options (forget the executable jar.)

  • Packaging executable jars for my Swings based Desktop application

    I have developed a swings based desktop application for which we used third party JDIC jar inorder to incorporate the tray icon functionality for our application.
    The problem is i need to provide a distributable for this application and the application's executable jar file gets automatically created as a part of build from IDE [Am using NetBeans6.0]. The Application's exec.jar is not able to locate the jdic.jar and hence am unable to get the tray icon functionality, when i run the application's exec jar.
    i.I tried packaging the jdic lib jar with in the application's jar but got to know that tht can't solve the issue.
    ii.I also tried editing the manifest file to provide the class path to the thrid party jar [jdic] ... but of no use
    Any Help regarding this would be thoroughly appreciated.

    can anyone pls let me know how would i be able to package my application as distributable so that others can deploy and run.

  • Executable Jar? - Googled for hours, tried many solns, still doesn't work!

    I am fairly new to Java, and I'm just simply trying to create an executable jar that will run when I double-click on the icon.
    I have created my very basic program that uses java swing on Netbeans. I have right-clicked on the project, selected properties, and checked the packaging section to make sure that it creates a jar file. I also selected compress jar file, which some tutorial told me to do as well. (I've also tried not checking compress jar file to see if it made a difference... it didn't).
    I then went to folder options to make an association with the jar file to javaw.exe so that when I clicked on the icon, it would know to use javaw.exe to open it. When I double click on the jar file, it now just makes the error noise and nothing happens. Before I made the assocation, it would open up ultimatezip which would show me the original source code, the class file, and the manifest.mf file.
    In any event, I'm just playing around with creating an executable jar file and any advice on how to make it so that the GUI launches when I double click on it would be extremely helpful.
    Edited by: bigbamboo on Oct 13, 2009 8:41 AM

    bigbamboo wrote:
    Thanks for your prompt response. I just tried your suggestions. 1 & 2 both worked for me. I have fiddled around some more with my file association and have looked at several sites that go through it step-by-step and I have tried them all. I went to tools, folder options, and I have changed the association to javaw.exe
    I just can't figure out what's wrong.Good. So at least you know that it is the file type association that is not working correctly.
    On my Windows PC, when I edit the open Action for .jar files, the command string is
    "C:\Program Files\Java\jre6\bin\javaw.exe" -jar "%1" %*Maybe that will help. Of course, the path to your javaw.exe may be different.

  • Cannot make executable jar file for swt application

    hi to all!!! i have started learning swt library and it seems nice to me, but i have one problem, i cannot run my application. The problem is that i cannot make executable jar for it.
    i'm using ecilpse_3.1.2 and have pluggined the visual editor for swt! yesterday i found one topic where was described the process of making the swt executable jar, i followed the instructions in the topic, but didn't resolve my problem, so if anybody knows how to achieve this , please help!!!!!!
    the instructions in the mentioned topic are :
    1. Make sure the SWT jar file is included in the Eclipse project build path
    a. Download the standalone SWT jar file from eclipse.org even if you already have the ones that come with Eclipse. It is called ?swt.jar? and you will package it with the executable JAR. Make sure it is the same version of SWT that you used to make your program.
    b. In Eclipse, import swt.jar via Project Properties::Java Build Path::Libraries::Add External JARs. (Make sure to include the source .zip file). Also make sure to select the swt package in the ?Order and Export? tab.
    c. At this point, you should be able to compile and run your SWT application in the Eclipse SDK.
    2. Do a standard Eclipse jar file export
    a. Right click on the main .java project file and select ?Export??.
    b. Choose ?JAR File? from the list.
    c. Select the relevant packages and .classpath and .project resource files
    d. Make sure ?Export generated class files and resources? is selected and browse to the location where you want the JAR file to be created.
    e. Specify ?Generate the manifest file? and don?t seal the JAR or any packages. Choose the class containing the main method as the ?Main class?.
    3. Change the manifest file
    a. Navigate to the JAR file you created and open it with WinZip.
    b. Open the MANIFEST.MF file inside and copy the contents.
    c. Create a new file called ?MANIFEST.MF? and paste in the contents of the old manifest file.
    d. Add the line ?Class-Path: <swt jar file path>?. For simplicity, you can just keep a copy of the swt.jar file in the same folder as the executable jar, in which case, the line is ?Class-Path: swt.jar?. Make sure there is a carriage return after the last line in the manifest file, or that line will not be parsed.
    4. Replace the manifest file
    a. Make sure the manifest file and the executable jar are in the same folder.
    b. Open the command prompt and navigate to the containing folder.
    c. Enter the command ?jar umf MANIFEST.MF <executable jar name>? to update the manifest file with the class path information.
    5. Package the JAR with SWT files
    a. Put the updated executable JAR file, swt.jar, and the associate DLL in the same folder. The DLL can be pulled out of swt.jar and should have a name like ?swt-win32-####.dll? on Windows.
    b. The JAR file should now successfully execute. On Windows, you can usually just double click the JAR file in explorer and it will open. If that does not work, the command ?java ?jar <executable jar name>? on the command line has the same effect.
    but a few steps aren't exact for me , for example : first, which jar i have to include in build path : downloaded or from plugins folder, second
    i have to incude source.zip too??? but it is only in downloaded zip file which includes both swt.jar and src.zip, and finally can anyone clarify next :
    "5. Package the JAR with SWT files
    a. Put the updated executable JAR file, swt.jar, and the associate DLL in the same folder. The DLL can be pulled out of swt.jar and should have a name like ?swt-win32-####.dll? on Windows."
    what does this mean, put these in folder or make jar from them????

    wolve634 wrote:
    but a few steps aren't exact for me , for example : first, which jar i have to include in build path : downloaded or from plugins folder, secondTry it both ways. If neither works, then ask again. In a suitable forum, though. An Eclipse forum or an SWT forum or something related to where you got those instructions would make a lot more sense than asking here.
    i have to incude source.zip too???No, of course you don't have to distribute the source code.
    a. Put the updated executable JAR file, swt.jar, and the associate DLL in the same folder. The DLL can be pulled out of swt.jar and should have a name like ?swt-win32-####.dll? on Windows."
    what does this mean, put these in folder or make jar from them????It says "Put (them) in the same folder". You're asking whether that means to put them in a folder? Yes, it does.

  • Execute executable jars without jar.exe in system path???

    Hello all,
    I could run an executable jar file on my workstation once I configured its MANIFEST.MF file with its Main and class-path attributes. But, the execution failed when I tried to copy this executable jar file alongwith other required jar files to a workstation not having jar.exe in the path! However, the same programme executes successfully when I run it using a batch file where I set jar.exe in the path. is it possible to configure MANIFEST.MF file with system path?
    thanks in advance.

    Actually you don't need Jar.exe to run jars.yes, you are right! actually, I need another dll file in the system path to execute the application. how can I add this dll file to the path when running the application using executable jar.
    BTW, thanks for the reply!!
    note: the dll file required in the path is bundled alongwith other jar files.

  • Getting the absolute path of the current executing file

    I have a file which will be placed in window and linux environment. It is not good to change the source code in that way:
    String path = "D:\\java\file1.txt"; (Window)
    String path = "/java/file1.txt"; (Linux)
    So I would like to ask how to get the absolute path based on that executing file?
    I referred to the reference in jsp, but I don't know what class and the coding syntax in console environment.
    Thx for any help.

    If you are looking to "get" a file that is located in a directory with (or somewhere under) the class file than use
    myClass.getClass().getResource(<relativePathWithFileFromClass>);  //URL
    myClass.getClass().getResourceAsStream(<relativePathWithFileFromClass>);  //InputStreamAs far as determining which Operating System you are on, there are a number of environment variables that will tell you that, and you can then format your file path accordingly.
    You can use "/" in your path regardless of which OS you are using. You do not have to use "\\" on Windows (excpet maybe inside of a Runtime.exec command string).
    Here is a very small program you can compile and run if you wish to see the list of System Properties available:
    public class ShowProperties {
      public static void main(String[] args) {
        System.getProperties().list(System.out);
    }Just save that to a file (named ShowProperties.java of course) and compile and run it, and you will get a list of your available System Properties and their current values

  • Retrieve current executable jar path?

    I have several classes put together into an executable jar, which is working fine.
    I would like to obtain the path to the location in which the jar is located at runtime in order to check for the existence of a text file in the same directory as the executable jar. For example, if my jar was started from c:\temp\aa.jar I would like to be able to retrieve c:\temp\aa.txt at runtime - how do I tell the program to look for aa.txt in c:\temp as opposed to some other directory?
    I have experimented with java.lang.System.getProperty("user.dir"), but this directory is not the same as the one in which the jar is located.
    Any ideas? THANKS!

    I still would like a way to retrieve the path to the location of the jar file that was executed, if possible.
    This may be partly an IDE issue. I'm using Sun ONE Studio 4 update 1, Community Edition. When I execute the jar outside of the IDE (double-clicking it in File Explorer) my program is able to find preferences.txt properly in the same directory as the jar. However, when using the IDE java searches for the text file in the Sun ONE studio's bin directory.
    section of program that is looking for the text file:
    File filePref = new File("preferences.txt");
    System.out.println("preferences.txt path: " + filePref.getAbsolutePath());
    standard output when run from within the IDE:
    preferences.txt path: C:\Program Files\s1studio_jdk\s1studio\bin\preferences.txt
    standard output when run from outside the IDE:
    preferences.txt path: directory in which jar is located\preferences.txt
    What I would like to do is retrieve the path to the directory in which the jar is located automatically, so that I could write code like the following:
    String strPath = path to jar;
    File filePref = new File(strPath + "preferences.txt");
    I can work around this by pulling the path to the jar from the file object (.getAbsolutePath()) and always testing my jar from outside of the IDE, but this seems like an awkward solution.

  • How to optimize the select query that is executed in a cursor for loop?

    Hi Friends,
    I have executed the code below and clocked the times for every line of the code using DBMS_PROFILER.
    CREATE OR REPLACE PROCEDURE TEST
    AS
       p_file_id              NUMBER                                   := 151;
       v_shipper_ind          ah_item.shipper_ind%TYPE;
       v_sales_reserve_ind    ah_item.special_sales_reserve_ind%TYPE;
       v_location_indicator   ah_item.exe_location_ind%TYPE;
       CURSOR activity_c
       IS
          SELECT *
            FROM ah_activity_internal
           WHERE status_id = 30
             AND file_id = p_file_id;
    BEGIN
       DBMS_PROFILER.start_profiler ('TEST');
       FOR rec IN activity_c
       LOOP
          SELECT DISTINCT shipper_ind, special_sales_reserve_ind, exe_location_ind
                     INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
                     FROM ah_item --464000 rows in this table
                    WHERE item_id_edw IN (
                             SELECT item_id_edw
                               FROM ah_item_xref --700000 rows in this table
                              WHERE item_code_cust = rec.item_code_cust
                                AND facility_num IN (
                                       SELECT facility_code
                                         FROM ah_chain_div_facility --17 rows in this table
                                        WHERE chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
                                          AND div_id = (SELECT div_id
                                                          FROM ah_div --8 rows in this table
                                                         WHERE division = rec.division)));
       END LOOP;
       DBMS_PROFILER.stop_profiler;
    EXCEPTION
       WHEN NO_DATA_FOUND
       THEN
          NULL;
       WHEN TOO_MANY_ROWS
       THEN
          NULL;
    END TEST;The SELECT query inside the cursor FOR LOOP took 773 seconds.
    I have tried using BULK COLLECT instead of cursor for loop but it did not help.
    When I took out the select query separately and executed with a sample value then it gave the results in a flash of second.
    All the tables have primary key indexes.
    Any ideas what can be done to make this code perform better?
    Thanks,
    Raj.

    As suggested I'd try merging the queries into a single SQL. You could also rewrite your IN clauses as JOINs and see if that helps, e.g.
    SELECT DISTINCT ai.shipper_ind, ai.special_sales_reserve_ind, ai.exe_location_ind
               INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
               FROM ah_item ai, ah_item_xref aix, ah_chain_div_facility acdf, ah_div ad
              WHERE ai.item_id_edw = aix.item_id_edw
                AND aix.item_code_cust = rec.item_code_cust
                AND aix.facility_num = acdf.facility_code
                AND acdf.chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
                AND acdf.div_id = ad.div_id
                AND ad.division = rec.division;ALSO: You are calling ah_internal_data_pkg.get_chain_id (p_file_id) every time. Why not do it outside the loop and just use a variable in the inner query? That will prevent context switching and improve speed.
    Edited by: Dave Hemming on Dec 3, 2008 9:34 AM

  • What are the reasons for using absolute paths to embedded objects in word?

    Hello,
    hopefully someone can answer me the question why word always stores the absolute paths to linked objects? We use Word for documentation and these documents are stored in a version control system and sometimes several persons are working on a document. Because
    of the absolute paths stored in the document all users would need to have the same directory structure so that the links would work for every person.
    For linked objects it's not even possible to change the absolute paths to relative paths.
    Additionally I would like to know what the difference between a "Graphic" and "Picture" object is. A graphic can be inserted by selecting "INSERT" -> "Pictures" and a "Graphic" doesn't seem to have a field
    function and always uses absolute paths. "Graphics" can be inserted by selecting "INSERT" -> "Quick Parts" -> "Field..." -> "IncludePicture" and it's possible to use relative paths for "IncludePicture"
    objects and it's possible to show the field function of a "Picture" object.
    Regards
    Martin

    This seems to be by design, not too much information about this. The thread below should be helpful for you to understand it:
    https://social.technet.microsoft.com/Forums/office/en-US/6d4445e1-cdc5-4b3b-9355-9081c963fdd9/unable-to-use-relative-object-links-in-word-office-2010-sp1
    Also, from the thread below, you will find some workarounds for this issue:
    http://windowssecrets.com/forums/showthread.php/102080-Relative-Paths-in-Word-Fields-(All)?p=584769&viewfull=1#post584769
    Aravindhan Battepati

  • X-Path like Query option for XMLModel?

    Hi,
    is there an option to use x-path-like queries in the XMLModel?
    E.g.
    <?xml version="1.0" encoding="UTF-8"?>   
    <main> 
                             <config> 
                                        <mode>1</mode>  
                                        <ext> 
                                            <item date="January 2009">                                         
                                            <unit>900</unit> 
                                            <current>1</current>  
                                            <interactive>1</interactive> 
                                            </item> 
                                       </ext> 
                             </config>  
                              <config> 
                                         <mode>2</mode>   
                                        <ext> 
                                               <item date="February 2009">                                      
                                            <unit>400</unit>   
                                            <current>2</current>  
                                            <interactive>5</interactive>   
                                             </item> 
                                       </ext> 
                           </config>  
    </main> 
    and
    var oTable2 = new sap.ui.table.Table();   
    oTable2.bindRows("/config['mode='1'']/ext"); 
    to select a node directly?
    The source is from an old Post [SAPUI5 - XMLModel]  Xpath filter ? where the solution was to loop through the result.
    Does SAPUI support X-Path like queries in the meantime?
    Thanks,
    Oliver

    I'm not sure about an xpath query (which was deprecated in JCR 2.0), but here's how you could use the JCR API to retrieve all of the versions from a path:
         * Returns all of the versions at the specified path as a List of Versions.
         * @param session
         *            the currect JCR session, must not be null
         * @param path
         *            the absolute path of the node to retrieve
         * @return the list of versions at the specified path
         * @throws UnsupportedRepositoryOperationException
         *             thrown if the node at the specified path is not versionable
         * @throws RepositoryException
         *             an unexpected exception occurs interacting with the JCR
         *             repository
        public List<javax.jcr.version.Version> getVersions(final Session session,
            final String path) throws UnsupportedRepositoryOperationException,
            RepositoryException {
        final List<Version> versions = new ArrayList<Version>();
        final VersionManager versionMgr = session.getWorkspace()
            .getVersionManager();
        final VersionHistory versionHistory = versionMgr
            .getVersionHistory(path);
        final VersionIterator versionIterator = versionHistory.getAllVersions();
        while (versionIterator.hasNext()) {
            versions.add(versionIterator.nextVersion());
        return versions;

Maybe you are looking for

  • Home sharing works on primary wifi but not via Access Point

    I have two wifi routers set up at either ends of the house.  The primary router (Netgear DGN2000) is connected to an Access Point (Edimax EW-7416APN) via a D-link Powerline ethernet connection.  Both are configured with identical SSID names/passwords

  • Sendmail broken from Solaris 10 11/06 to Solaris 10 8/07 - port 25 broken

    I am in the process of building a new solaris 10 8/07 server to replace a solaris 10 11/06 server. Both are running. Sendmail on both has changes limited to: correcting /etc/hosts to include mailhost entry dns server pointing to localhost as mailhost

  • Compatibility between CRM 4.0 and IS-U 4.64

    Hi, My company is using SAP IS-U 4.64 and is studying the use of SAP CRM. Does there is any problem of processus compatibility between these two versions ? I don't find any document on the market place or in sdn. Does there is a document that shows t

  • Date Variable

    I have a detail object : =[L01 Sales document Cust. PO. Date (Key)] which gives data like thsi: #, #, #, 25.10.2010, 23.10.2011, 22,10,2010 etc... I am creating a variable like this: =If Not([L01 Sales document Cust. PO. Date (Key)]="#") Then FormatD

  • OSD with SP1 CU1 captured Win7 failed to deploy after R2 CU1 Update

    Hi guys, quick question. We currently trying to deploy an Image as i said in the title. The Win7 has been captured with SP1 CU1 an we tried to install the R2 Client during OSD TS. This steps seems is the last that is executed in the TS after that, th