java - Running an .exe based off of a class' location -


i understand line of code runs .exe's based of specific set location

runtime.getruntime().exec("c:/users/username/desktop/javaapp.exe").waitfor(); 

but need run application based off of location of class ran in

i'm gonna go ahead , make answer question.

i believe this you're looking for.


for comment asking removal of 'file' part string

assuming have string called path contains: "file:/c:/users/jon/test/foo/test.class"

you can call path.substring(5), return string containing text "/c:/users/jon/test/foo/test.class". int represents index want start @ new string, can change need.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -