absolute-path

Java workspace and file path

笑着哭i 提交于 2019-12-03 16:42:04
I have a probably easy to solve problem. I am having a folder in my project and want to get it using the relative path: new File("/folder") this gives me FileNotFoundException if I try like this new File("d:/workspace/project/folder") it works I suspect that it does not work because of this: new File("").getAbsolutePath() returns : D:\eclipse So not the path of the workspace. Am I doing something wrong or do I need to change some settings in eclipse Just found my answer in Run Cofigurations like djna suggested, but not in the Environment Tab but in the Arguments Tab. There is a working

netbeans : add library permanently

筅森魡賤 提交于 2019-12-03 15:59:13
I work in a group project and after every checkout I have to remove and add the javamail api..(because the path is relative) how can i make it IN the Project folder? This is how i add the library : right click on librarys folder Add/jar Folder.. Choose the mail.jar But when my collegue checks this out... he get's problems. How can i make the path absolute ? A better way to add library to Netbenas would be Tools -> Libraries -> New Library... After it: Project tab -> [your project] -> Properties -> Libraries -> Add Library This would be always "relative" This worked for me: Project Properties -

How to open a file with relative path in C++?

≡放荡痞女 提交于 2019-12-03 14:22:44
I am writing test cases right now and I created some test files which I try to read. The absolute path is: /home/user/code/Project/source/Project/components/Project/test/file.dat but testing with an absolute path is bad for obvious reasons. So I try to convert the absolute path into a relative one and I don't know why it doesn't work. I created a file with the relative path findme.dat and I found it in /home/user/code/Project/build/source/Project/components/Project/test/findme.dat so I created the relative path /../../../../../../source/Project/components/Project/test/file.dat but the file is

Is there a path similar to file:///android_asset/ that points to the apps directory?

你。 提交于 2019-12-03 13:01:40
问题 I'm using a WebView to open some files saved to the app. Is there a way to link to the app's directory where files saved at runtime would be, in a similar way that file:///android_asset/ does? By link I mean loadUrl( *path* ) and also in the HTML markup of the file being opened <img src="*path*" /> As oppose to using an absolute path like file:///data/data/PACKAGENAME/files/ 回答1: Use this for files on the SD card: content://com.android.htmlfileprovider Use this for files in your assets

getting the absolute path of a <img/>

人走茶凉 提交于 2019-12-03 11:42:54
问题 Using Javascript, is there a standard way to get the absolute path of an image? img.getAttribute("src") only returns the src attribute as it was declared in the HTML. 回答1: Just do .src . $('img')[0].src = '/images/foo.gif' "/images/foo.gif" $('img')[0].src "http://stackoverflow.com/images/foo.gif" $('img')[0].getAttribute('src') "/images/foo.gif" 来源: https://stackoverflow.com/questions/3496491/getting-the-absolute-path-of-a-img

Changing C# .dll references from absolute to relative

早过忘川 提交于 2019-12-03 10:43:10
I have compiled my project and some of my project's added .dlls have absolute references. When I try to run my project on another machine, it looks for the .dlls from the original project path. How can I make the project look for the .dlls using a relative path? Edit the .csproj file and change the <HintPath> elements from absolute paths to relative paths. You may also write your handler for resolving assemblies. In the simplest form it may look like this: AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolveHandler; .. static Assembly AssemblyResolveHandler(object sender,

How to determine absolute path (if any) of a loaded Class?

假装没事ソ 提交于 2019-12-03 07:34:35
问题 Is there a (compatible, if possible) way to determine the absolute path of a loaded Class? Of course, this is not always possible (if you think of dynamically created classes), but if the loaded Class is inside a jar how to get the absolute path for this jar? 回答1: MyClass.class.getProtectionDomain().getCodeSource().getLocation().getPath() Fullcode: package org.life.java.so.questions; /** * * @author jigar */ public class GetClassPath { public static void main(String[] args) { System.out

PHP: Find images and links with relative path in output and convert them to absolute path

牧云@^-^@ 提交于 2019-12-03 07:24:01
There are a lot of posts on converting relative to absolute paths in PHP. I'm looking for a specific implementation beyond these posts (hopefully). Could anyone please help me with this specific implementation? I have a PHP variable containing diverse HTML, including href s and img s containing relative urls. Mostly (for example) /en/discover or /img/icons/facebook.png I want to process this PHP variable in such a way that the values of my href s and img s will be converted to http://mydomain.com/en/discover and http://mydomain.com/img/icons/facebook.png I believe the question below covers the

get absolute path to apache webcontents folder from a java class file [duplicate]

爱⌒轻易说出口 提交于 2019-12-03 06:30:22
This question already has an answer here: Recommended way to save uploaded files in a servlet application 2 answers Need to get absolute path in java class file, inside a dynamic web application... Actually i need to get path of apache webapps folder... where the webapps are deployed e.g. /apache-root/webapps/my-deployed-app/WebContent/images/imagetosave.jpg Need to get this in a java class file, not on jsp page or any view page... any ideas? BalusC Actually i need to get path of apache webapps folder... where the webapps are deployed e.g. /apache-root/webapps/my-deployed-app/WebContent/images

Get relative path of the page url using javascript

隐身守侯 提交于 2019-12-03 04:33:54
In javascript, how can I get the relative path of the current url? for example http://www.example.com/test/this?page=2 I want just the /test/this?page=2 Try window.location.pathname+window.location.search location.href holds the url of the page your script is running in. The quickest, most complete way: location.href.replace(/(.+\w\/)(.+)/,"/$2"); Srinivas Ramakrishna You can use the below snippet to get the absolute url of any page. var getAbsoluteUrl = (function() { var a; return function(url) { if(!a) a = document.createElement('a'); a.href = url; return a.href; } })(); // Sample Result