[SOLVED]new title: convert relative to absolute paths in bash

So the issue was not MPD, i hadn't noticed my script was creating a bad symlink when i passed it a relative path.  new problem, the simplest way to accept any relative path as argument and return an absolute path for use throughout the script.  i'm off to google...
my current version of the solution as a bashrc function:
rel2abs() {
local file="$(basename "$1")"
local dir="$(dirname "$1")"
pushd "${dir:-./}" &>/dev/null && local dir="$PWD"
echo "$dir/$file"
popd &>/dev/null
:: OP ::
so i have this little script that is supposed to allow me to one-time-play an audio file sitting outside my mpd directory by creating a symlink to the file, updating the db, then playing the symlink.  everything's great accept mpd won't follow the symlink when creating/updating the db.
i've restarted mpd and re-create[d]-db both as myself (mpd runs as me) and as root many, many times.  it never changes.  the symlink file is never added to my database... is the manpage lying?  do i file a bug?  can anyone else reproduce?
i don't think it's a perm issue, mpd runs as me and the symlink's target and destination are both under ~/
┌─[ 13:30 ][ blue:~ ]
└─> pacman -Q mpd
mpd 0.15.1-1
man mpd.conf wrote:
follow_outside_symlinks <yes or no>
       Control if MPD will follow symbolic links pointing  outside  the  music  dir.   You  must
       recreate the database after changing this option.  The default is "yes".
follow_inside_symlinks <yes or no>
       Control  if  MPD  will  follow  symbolic links pointing inside the music dir, potentially
       adding duplicates to the database.  You must recreate the database  after  changing  this
       option.  The default is "yes".
/etc/mpd.conf wrote:######################### OTHER OPTIONS ########################
gapless_mp3_playback                    "yes"
#save_absolute_paths_in_playlists       "no"
#metadata_to_use        "artist,album,title,track,name,genre,date,composer,performer,disc"
follow_outside_symlinks                 "yes"
follow_inside_symlinks                  "yes"
┌─[ 13:33 ][ blue:~ ]
└─> ll Music/temp/
total 0
lrwxrwxrwx 1 patrick patrick 36 2009-08-13 13:30 apocalyptica_beyond_time.mp3 -> Dropbox/apocalyptica_beyond_time.mp3
┌─[ 13:37 ][ blue:~ ]
└─> mpc ls temp
┌─[ 13:37 ][ blue:~ ]
└─>
i guess i can resort to simply copying the file into the temp directory rather than symlinking... but you archers know how it is, it just bothers you when something should work and it doesn't...
comments and pointers always appreciated.
Last edited by brisbin33 (2009-08-17 20:35:21)

Mind posting your script? I've been using the following perl script to play a file outside of the music directory using mpd (found through the mpd wiki, I think). I'm up for a simpler solution if you found one!
#!/usr/bin/perl
# mpc-play
# version 0.2
# by Ilya "Voyager" Schurov (http://comm.noo.ru/iv-en/)
$MUSIC_PREFIX="/home/[username]/music";
$TEMP_DIR="tmp";
$SCRIPT_NAME="mpc-play";
# warning! all symlinks in $MUSIC_PREFIX/$TEMP_DIR will be lost on start!
$DEBUG=0;
$PWD=`pwd`;
chomp $PWD;
if(!@ARGV)
print "Usage:\n$SCRIPT_NAME <files-to-play>\n";
say_and_do("mpc --no-status stop",$DEBUG);
say_and_do("mpc --no-status clear",$DEBUG);
# removing symlinks from $TEMP_DIR
while(<$MUSIC_PREFIX/$TEMP_DIR/*>)
unlink if(-l);
foreach $file (@ARGV)
$link=$file;
# stripping slashes from arguments
$link=~s/\//_/g;
if($file!~/^\//)
$file="$PWD/$file";
symlink("$file","$MUSIC_PREFIX/$TEMP_DIR/$link")
|| die("Can't create symlink from $file to $MUSIC_PREFIX/$TEMP_DIR/$link: $!");
push @links, $link;
say_and_do("mpc update $TEMP_DIR",$DEBUG);
# now we need to wait while mpd updating DB
do
$stat=`mpc`;
sleep(0.1);
}while($stat=~/^Updating DB/m);
# generating playlist
foreach $link(@links)
$link=~s/\`/\\\`/g;
say_and_do("mpc --no-status add \"$TEMP_DIR/$link\"",$DEBUG);
#let's the music begins! :)
say_and_do("mpc play",$DEBUG);
sub say_and_do
my $str=shift;
my $debug=shift;
print "$str\n" if($debug);
system($str);
Thanks!
Scott

Similar Messages

  • Creating an absolute path

    Hi everyone,
    I'm trying to save data points to an excel file and I kept getting the error:
    Possible reason(s):
    LabVIEW:  The path is empty or relative. You must use an absolute path.
    tc_cral(\usfile01)\Common\High Strain Rate\Test.csv
    I'm kind of lost on this issue at the moment and have tried to look up some definition of what a relative and absolute path means.  I must not be fully understanding the definition so if anyone can 'dumb' it down for me I'd appreciate it.  I have also attached the top level vi image of the section where I'm trying to save the data points.
    Solved!
    Go to Solution.
    Attachments:
    TryingtoSave.jpg ‏246 KB

    winehero wrote:
    hello , my question is  what's function of  this module! ,   
    please give me the best answers!
    best kinds!
    This question has nothing to do with the topic.  You really should have started a new thread.
    But that module is the Boolean Crossing PtbyPt.  The help explains it pretty well.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Read BMP File Requires Absolute Path

    I noticed something today regarding the Graphics Formats, Read JPG File, Read PNG File and Read BMP File vi's. It seems that when reading a JPG or PNG file, a relative path is OK, but when reading a BMP file, an absolute path is required. When the path only contains the filename, it returns:
        Error 1430
        "Open/Create/Replace File in Read BMP File Data.vi->Read BMP File.vi->ReadImageFileTest.vi"
    I tried a simple test that uses either the relative or absolute path, trying to read 3 different files in the same directory as the VI. Only the Read BMP File errors. Of course, the simple work around is to always use the full pathname to a file. Is this only on my system? Is this a known bug or feature or expected behavior?
    I'm using LabVIEW 8.2 on Windows XP.
    Thanks!
    B-)
    Message Edited by LabViewGuruWannabe on 11-05-2007 11:06 PM
    Attachments:
    ReadImageFileTest-FPgood.PNG ‏30 KB
    ReadImageFileTest-FPbad.PNG ‏26 KB
    ReadImageFileTest-BD1.PNG ‏48 KB

    Missed this on the first post:
    Message Edited by LabViewGuruWannabe on 11-05-2007 11:10 PM
    Attachments:
    ReadImageFileTest-BD.PNG ‏48 KB

  • Frame 12 converting relative paths to absolute paths

    Hi all,
    We recently upgraded to Frame 12 and now have a persistent issue with relative paths to referenced images becoming absolute.  These paths do not traverse a drive and so I believe Frame should be maintaining a relative path for these. In most cases -- perhaps in all, although I have not done exhaustive testing --  the problem paths are for images on a master page.
    Any idea why this might be occurring and what we can do to fix it?  Our docs team shares files checked out from a server, and each time one of us opens a document, it has an absolute path to a location on another writer's computer.  We each maintain the exact same directory structure for all Frame/image files, and again, the path to the problem images is local and does not traverse the C drive.
    Thanks in advance,
    Shelley

    May or may not be relevant, but do the affected relative paths need to traverse the root directory of the logical drive?
    I seem to recall, in experiments some years ago on FM7.1, that the final /../ needed to be at least one level down.

  • Only Use Absolute Paths, Disable Relative Paths

    Hi All,
    I am trying to work out how to disable Relative Paths in
    Dreamweaver 8. We are wanting to create some eBay templates in
    dreamweaver. Once these are created we want to copy and paste the
    code into the eBay description. However when using relative paths,
    this breaks the page when it is uploaded to eBay. Obviously because
    it is looking for ../../images/logo.gif etc.
    What it saves as currently: src="../../images/logo.gif"
    What I want it to save as: src="
    http://mysitehere.com/images/logo.gif"
    So how can I completely disable relative paths and have
    Absolute Paths in its place.
    Regards,
    Joel

    You can't.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Joel.Theodore" <[email protected]> wrote in
    message
    news:e5po0g$4ec$[email protected]..
    > Hi All,
    >
    > I am trying to work out how to disable Relative Paths in
    Dreamweaver 8.
    > We
    > are wanting to create some eBay templates in
    dreamweaver. Once these are
    > created we want to copy and paste the code into the eBay
    description.
    > However
    > when using relative paths, this breaks the page when it
    is uploaded to
    > eBay.
    > Obviously because it is looking for
    ../../images/logo.gif etc.
    >
    > What it saves as currently: src="../../images/logo.gif"
    > What I want it to save as: src="<a target=_blank
    > class=ftalternatingbarlinklarge
    > href="
    http://mysitehere.com/images/logo.gif"
    >
    > So">
    http://mysitehere.com/images/logo.gif"
    >
    > So</a> how can I completely disable relative paths
    and have Absolute Paths
    > in
    > its place.
    >
    > Regards,
    >
    > Joel
    >

  • How to convert relative url to absolute in URLPortlet?

    Images and links don't work becase they are not getting filtered to absolute urls. <baseHRef> doesn't seem to do it. Isn't URLServices supposed to automatically convert all urls to absolute?

    URL Services internal identifies relative URL and converts them into absolute URL's.
    It uses <BASE HREF="URL"> if available, otherwise the uses <pageUrl> as base URL and constructs the absolute URL's.
    Please post URL to which you facing problem, so that we can find fix this error.

  • Absolute path of a file specified in a relative path

    Hello,
    If I refer to a file using a relative path, what will its absolute path be? How can I change it?
    Thanks.

    File file = ...
    String absPath = file.getAbsolutePath();

  • How can I specify relative SubVI file path in VIs?

    I use LabVIEW 2009 Service Pack 1.
    SubVIs are referenced by absolute paths, so when I move them to a new folder I may need to set their paths again.
    How can I make a SubVI reference a relative path so that I don't have to set its path after moving VIs to a new folder or a new drive?
    Solved!
    Go to Solution.

    altenbach wrote:
    [...]Where did you encounter any problems?
    From my experience, most of those problems occur when moving VI files directly on disk (Windows File Explorer) individually.
    @OP:
    Altenbach brought up a good point: When moving/copying the project, take care that all project related sources are within a single project folder. Move/copy the whole project folder, keeping its internal setup. In most cases, that is doing fine.
    When moving individual files (VIs), make sure that you use the LV Project Explorer to do so. Add all files used in the project into a single lvproj and then swap to the "Files" tab. Rightclick the individual VI you want to move and select "Move on Disk" from the context menu. This will auto-update all (known) callers as well.
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How access an element using getElementById() without absolute path?

    hello,
    Currently I'm working on a JSF woodstock project.
    I'm trying to acceess the different components used the JSF page inside a javascript by using document.getElementById()
    this is a part of code in my JSF file. please have a look on it.
    <webuijsf:form id="form1">
                            <webuijsf:panelGroup id="pnlGrpBankListMainContainer" style="left:2px; top:89px; margin-left:1.5%; margin-top:1%; width:50%; position:absolute;">
                                <webuijsf:table augmentTitle="true" title="#{BankList.screenName}" id="table1" paginateButton="true"
                                    paginationControls="true" clearSortButton="true" extraActionTopHtml="style='height:35px'">
                                    <f:facet name="actionsTop" >
                                        <webuijsf:panelGroup id="grpPnlButtons">
                                            <webuijsf:checkbox binding="#{BankList.chkBoxSelectAllItems}" id="chkBoxSelectAllItems" name="chkBoxSelectAllItems" rendered="#{BankList.renderChkBoxAndImgSeparator}"
                                                selectedValue="selectAllItems" onClick="selectAllTableRows(this,'chkBoxBankListSelectedRowId',5);"/>
                                            <webuijsf:image id="imgSeparator" url="/resources/images/select_image_separator.gif" rendered="#{BankList.renderChkBoxAndImgSeparator}" />
                                            <webuijsf:button id="btnAdd" rendered="#{BankList.renderAddButton}"  text="Add" styleClass="btnStyle" immediate="true"
                                                onClick="return openAdd('#{BankList.requestContextPath}/faces/BankEntry.jsp', 500, 755,'Add  #{BankList.screenIdentifier}', '&action=ADD');"/>
                                            <webuijsf:button id="btnEdit"  rendered="#{BankList.renderEditButton}"  text="Edit" styleClass="btnStyle" disabled="#{BankList.disableEditButton}"
                                                onClick = "return openEdit('#{BankList.requestContextPath}/faces/BankEntry.jsp', 'chkBoxBankListSelectedRowId', 500, 755,'Edit  #{BankList.screenIdentifier}', '&action=EDIT');"/>
                                            <webuijsf:button id="btnDelete"  text="Delete" onClick="return confirmRecordsDelete();"  rendered="#{BankList.renderDeleteButton}"  styleClass="btnStyle" disabled="#{BankList.disableDeleteButton}"/>
                                            <webuijsf:button id="btnExportXls" disabled="#{BankList.disableExcelButton}" rendered="#{BankList.renderXlsButton}"
                                                styleClass="btnStyle #{BankList.excelButtonStyleClass}" style="position:relative; margin-left: 10px"
                                                text="x" onMouseOver="setMouseOverStyle(this);" onMouseOut="setMouseOutStyle(this);"
                                                onClick="return openXlsExport('#{BankList.requestContextPath}/faces/Export.jsp', 'chkBoxBankListSelectedRowId', 'Export  #{BankList.screenName}', '&screenIdentifier=#{BankList.screenIdentifier}');">
                                            </webuijsf:button>
                                        </webuijsf:panelGroup>
                                    </f:facet>when i access button element using absolute path like
    document.getElementById("form1:pnlGrpBankListMainContainer:table1:grpPnlButtons:btnEdit") it works fine.
    But when i try to access it using
    document.getElementById("form1:table1:btnEdit") it returns null.
    I've common javascrpt functions for all the screens.
    so i do not want to change the current javascript functionality nor do i want want to specify complete path for an element.
    So is there any way so that i can access the elements without absolute path or any othet solution?
    Edited by: sonali_amonkar on Apr 1, 2008 11:17 PM

    thanks for your reply mjswallow.
    Do you mean that I'll write a new javascript which will accept all the parent elements and inside this method I'lll call the common javascript methods that are present in our project?
    but this solution would result in changing the already existing javascript methods that i coded for all screens. right?
    that is i do not want to change.
    any other solutions you can think of?

  • URLLoader breaks with an absolute path

    I call a php program from my Flash AS3 movie. So long as I use a relative path it works fine. If I change it to an absolute path, it breaks. This Flash file is destined to be an app, so I know have to use an absolute path. Any thoughts? Here's my code, below with the relative path shown in red. If I change that to a full path it breaks. Full path is http://www.parallaxdesigngroup.com/gg/dictTestDropDown/php/controlpanel.php
    function processLogin ():void
    var phpVars:URLVariables = new URLVariables();
    var phpFileRequest:URLRequest = new URLRequest("php/controlpanel.php");
    phpFileRequest.method = URLRequestMethod.POST;
    phpFileRequest.data = phpVars;
    var phpLoader:URLLoader = new URLLoader();
    phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;  
    phpLoader.addEventListener(Event.COMPLETE, showResult);
    phpVars.systemCall = "checkLogin";
    phpVars.term     = term.text;
    phpLoader.load(phpFileRequest);

    Thanks. Fiddler is great, I didn't know about it. With the relative path I can see the proper data in textview being passed back to Flash from PHP. But with the full path, Fiddler labels the session URL as /crossdomain.xml and in the response textview I can see file not found type of info:
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>302 Found</title>
    </head><body>
    <h1>Found</h1>
    <p>The document has moved <a href="http://parallaxdesigngroup.com/pageNotFound.html">here</a>.</p>
    </body></html>
    Weird that a full path would fail.Here is my full path copied and pasted out of Flash, and if you put it in the browser you can see it doesn't give you file not found. It doesn't do anything in the browser because its purpose in life is just to pass stuff back to Flash.
    http://www.parallaxdesigngroup.com/gg/dictTestDropDown/php/controlpanel.php
    So I now know what is happening, but am not sure what to do to make the full path work. Any further thoughts greatly appreciated!

  • Ora:processXSLT xpath function and absolute paths

    It looks like ora:processXSLT xpath function does not honor absolute paths when specifying the location of the xslt to use in the first parameter. For example, if I call it like this:
    <copy>
    <from expression="ora:processXSLT('/u01/transforms/mytransform.xsl',bpws:getVariableData('xslInput','payload'))"/>
    <to variable="xslOutput"/>
    </copy>
    I get the following error in the bpel logs:
    Error while processing xpath expression, the expression is "ora:processXSLT('/u01/transforms/mytransform.xsl', bpws:getVariableData("xslInput", "payload"))", the reason is javax.xml.transform.TransformerException: java.io.FileNotFoundException: /u01/oracle/bpel/integration/orabpel/domains/test/tmp/.bpel_transformTest_1.0.jar/u01/transforms/mytransform.xsl (No such file or directory).
    Please verify the xpath query.
    It is assuming that the xsl will be relative to the bpel suitcase and just appending the supplied path to the relative path for the bpel process. Why would I want to do this? Well, I have hundreds of these maps and I want to be able to select one at runtime. I'm also adding new ones every day and I don't want to have to redeploy the process that uses them each time I add a new map. Is there any way to force this process to recognize the absolute path? I can work around it for now by using a bunch of ../../../../ stuff but that's a kludge and I'd like to find a better way to do it.
    I get the same error with xdk:processXSLT.
    Any suggestions?
    Thanks!
    Sean

    Hi Sean,
    Did you try to the file path with the file:// prefix and not just the path?
    ~ronen

  • PDX index - how to remove absolute path to it?

    I have a PDF and using File > Properties > Document Properties > Advanced tab have browsed to a Search Index, and added it to the PDF (I've added a big Search button that the user can press to search the entire, large, collection of PDFs).
    The search index path that the Browse form puts in the Search Index: field points to a location on our network e.g. \\Server1\application\PDFs\index.pdx
    This works fine when I'm running it locally, but when the PDF + index gets installed on a PC outside of our network the user gets a error telling them that it can't load the index.
    I want to edit the path in the Search Index: field so that it is relative e.g. PDFs\index.pdx (the same location as the PDFs and the index file + folder), but the Search Index: field is greyed out and uneditable!  I seem to be stuck with a useless absolute path.
    Question: Is there any way of making the path to the PDF relative and not absolute? We need to put the PDF collection onto our software distribution DVD, and the customers will install it to their own PCs/network locations.
    (I'm using Acrobat Pro X ver 10.1.8 on Windows 7 Ultimate SP 1, and the target audience will be using Acrobat Reader)

    I think the problem is kinda fixed.
    I created the library and index on a network drive and created a "start PDF" file at the same location.  I opened the "start" file and used Ctrl-D > Advanced > Search index to add the name of the .pdx file.
    I emailed the "start file" to someone else on the network.  They downloaded it and double clicked it.
    * They happened to be using the new 2015 Pro DC version.  The message about the index associated with this document (...) could not be located. appeared. The path was expecting the .pdx file to be below the download directory.
    * I clicked OK.
    * Pressed Ctrl-Shift-F for advanced search.
    * Clicked Show more options (because that user had never used Advanced Search) - and the index file was displayed in the look in field.
    * Entered a search term and it worked perfectly.
    I retested it using a Dropbox location.  Created the "start PDF" file and emailed another person, not on the same network, but sees the same Dropbox folder.  They use Acrobay XI v.11.0.10.
    * The file was downloaded and double-clicked.
    * Pressed Ctril-Shift-F - same index could not be located message - and again the .pdx file was assumed to below the download directory.  But nothing auto-magically fixed itself. 
    The only solution here is to provide user with a link to the .pdx file on their desktop.  When they double clicked it, Acrobat opens with the index loaded.
    (Depending on the user, the other alternative is to add the index to the index list.)

  • Absolute paths to eclipse project root? Why?

    I am a dedicated follower of the Flex and related technologies since its first appearance (some years back, Flex 1.5)
    Flash Builder (formerly Flex Builder) back then (version 2) seemed to have a problem with paths relative to project location.
    More precisely, parts of generated projects always point to absolute locations either inside or outside the eclipse project workspace.
    Unfortunately, the problem still persists. In the past I had reported this issue (long time to remember/extract details now) but without success as it seems.
    This is very important for projects intended to be developed by more than one persons (different development machines, different paths etc.)
    for an example, with Flash Builder 4, create a new Flex project (Web), activate WTP integration, complete project generation and then check files
    .actionScriptProperties and .flexProperties
    you will observe absolute path references to essential files
    here is an example of my .actionScriptProperties
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <actionScriptProperties mainApplicationPath="Main.mxml" projectUUID="43b42874-f3f0-4b6b-932c-6a1d4e492b56" version="6">
    <compiler additionalCompilerArguments="-services &quot;D:/eclipse-win32/workspace/net.eliasbalasis.flex.web.sample/WebContent/WEB-INF/flex/services-config.xml&quot; -locale en_US" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" sourceFolderPath="flex_src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
    <compilerSourcePath/>
    <libraryPath defaultLinkType="0">
    <libraryPathEntry kind="4" path="">
    <excludedEntries>
    <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flex.swc" useDefaultLinkType="false"/>
    </excludedEntries>
    </libraryPathEntry>
    <libraryPathEntry kind="1" linkType="1" path="flex_libs"/>
    <libraryPathEntry kind="3" linkType="1" path="D:/eclipse-win32/workspace/net.eliasbalasis.flex.web.sample/WebContent/WEB-INF/flex/libs/fds.swc" useDefaultLinkType="false"/>
    <libraryPathEntry kind="3" linkType="1" path="D:/eclipse-win32/workspace/net.eliasbalasis.flex.web.sample/WebContent/WEB-INF/flex/libs/player/playerfds.swc" useDefaultLinkType="false"/>
    <libraryPathEntry kind="1" linkType="1" path="D:/eclipse-win32/workspace/net.eliasbalasis.flex.web.sample/WebContent/WEB-INF/flex/locale/{locale}"/>
    </libraryPath>
    <sourceAttachmentPath/>
    </compiler>
    <applications>
    <application path="Main.mxml"/>
    </applications>
    <modules/>
    <buildCSSFiles/>
    </actionScriptProperties>
    here is a copy of my .flexProperties
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <flexProperties enableServiceManager="false" flexServerFeatures="6" flexServerType="8" flexWarLocation="D:/lcds/lcds.war" serverContextRoot="/WebContent" serverRoot="D:/eclipse-win32/workspace/net.eliasbalasis.flex.web.sample/WebContent" serverRootURL="http://localhost:8400/net.eliasbalasis.flex.web.sample" toolCompile="true" useServerFlexSDK="false" version="2"/>
    D:/lcds/lcds.war i suspect is fine because it is the location of the LiveCycle Data Services WAR used to create the project (it is external anyway)
    However, D:/eclipse-win32/workspace/net.eliasbalasis.flex.web.sample/WebContent is not fine at all. It is a location inside the project workspace. It should be referenced using some kind of variable, similarly to ${PROJECT_FRAMEWORKS} above.
    I observed that there is a variable ${DOCUMENTS} under Eclipse-->Preferences-->Workspace-->Linked Resources which references the Eclipse project workspace root (extremely convenient).
    Unfortunately, it seems that this variable can only be used within the context of other eclipse configuration files like .project and .classpath but not within the context of .actionScriptProperties and .flexProperties
    This is the same exact issue I reported in the past (see above)
    Flex Builder/Flash Builder family of products are the only Eclipse Based tools I have so far worked with that have such a big trouble handling file path locations relative to eclipse workspace root
    OOPS. CORRECT ME IF I AM WRONG PLEASE.
    I just replaced the eclipse workspace root with ${DOCUMENTS} and the project still compiles and generates deployment packages successfully.
    Perhaps the "Linked Resources" variables work in the context of flex configuration files.
    However I am not 100% sure.
    Please verify or otherwise provide a solution, as I am ready to select Flex technology products for the development of a new quite complex, multi developer, large scale system and this will be the only reason making me consider abandoning Flex and use other technology products

    I loooove Eclipse for reason.
    Yes, you are right, use of variables is great thing.
    However, there are 2 ways
    1.
    Use all paths relative to Eclipse workspace root. No absolute paths anywhere and No variables.
    2.
    Use tool-supplied variables (like ${DOCUMENTS} supplied by FB4 plugin pointing to Eclipse document root)
    However, although the variable is supplied by FB4 plugin, when a project is generated its files still contain absolute path references
    I had to manually introduce the ${DOCUMENTS} variable in project files discovering that variables work in the context of FB4 plugin project files.
    In earlier versions of FB plugin variables where not processed.
    Congratulations FB4 team, you saved the day.
    All I am saying is that there shouldn't be absolute paths in generated FB project files. Replacing manually currently works but it is not the easiest thing for all users. I happened to know where to look. Others may not.
    I believe FB team has to consider making actual use of the supplied variables in next version of FB (or alternatively, not use variables at all)
    p.s.
    You will love Eclipse, trust me :-)

  • Could not find agent library in absolute path

    Hi,
    I have a JVMTI agent which works on windows that I am trying to port to linux.
    I have compiled to code on Ubuntu 10.04 using Eclipse and have created shared library .so file.
    When I try to run an application with the agentpath argument, I get the error: "Could not find agent library in absolute path"
    When trying to run the mtrace sample from the java JDK, it works fine.
    My Java version is:
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
    I also tried running nm | grep Agent_OnLoad and got the following:
    00029220 T Agent_OnLoad
    00036230 b ZGVZ12AgentOnLoadE4data
    00030720 r ZZ12AgentOnLoadE19__PRETTY_FUNCTION__
    00036240 b ZZ12AgentOnLoadE4data
    My agent references several libraries such as boost asio and log4cxx could it be related somehow to these?
    I think it might be some sort of compilation issue because on windows it works fine.
    Thanks

    I managed to solve my problem.
    It turned out that the error was caused by missing referenced libraries that were not linked in to my so file.
    Once I added all of the required libraries, the agent started working.

  • 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

Maybe you are looking for