Displaying page
of
pages;
Items to
Title |
Test
Details
Path from jar
|
Expression |
jar:file:/(([A-Z]:)?/([A-Z 0-9 * ( ) + \- & $ # @ _ . ! ~ /])+)(/[A-Z 0-9 _ ( ) \[ \] - = + _ ~]+\.jar!)
|
Description |
In java using this.getClass().getResource(""); will result in a jar:file:/ etc url ending with yourjarfile.jar!/internal/package/path/ this regular expression matches the directory before the internal jar path declaration returning the physical directory the file resides in. should work in both posix and windows machines (untested for posix*)
|
Matches |
jar:file:/C:/installation/path/jarfile.jar!/com/regexlib/example
|
Non-Matches |
Any text not using internal jar file url
|
Author |
Rating:
Alex Ries
|
Title |
Test
Details
Java Get Path
|
Expression |
(jar:)?file:/(([A-Z]:)?/([A-Z0-9\*\()\+\-\&$#@_.!~\[\]/])+)((/[A-Z0-9_()\[\]\-=\+_~]+\.jar!)|([^!])(/com/regexlib/example/))
|
Description |
More advanced regular expression to get the full path to the directory from which your program is running. You may use this to detect the program installation dir whether you are just debugging or having a deployed program. Using the second group combined with the 7th group you'll have a full path to your program. Very useful if you use resources outside of the java package.
|
Matches |
jar:file:/C:/installation/dir/program.jar!/com/regexlib/example/ | file:/install/dir/development/workspace/com/regexlib/example/
|
Non-Matches |
Does not match non-java url | http:/www.regexlib.com/applet.jar!/com/regexlib/example/
|
Author |
Rating:
Alex Ries
|
Displaying page
of
pages;
Items to