Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have one jar file with in my project,For that jar file i need to pass
"path of jar file to cmd prompt through my application".........It is not a
problem

But When i am deploying my project in different systems,then i will retriev
path dynamically by using
Application.StartupPath....property
But It will retrieving entire path ..........Here my problem starts
How can I modify that path dynamically by adding my "jar file" path

My Code:
C#
string Applicationpath = Application.StartupPath;
           string[] words = Applicationpath.Split('\\');
           string parm0 = words[0].ToString();
           string parm1 = words[1].ToString();
           string parm2 = words[2].ToString();
             Finalpath = parmo+parm1+jarpath;

It will works for particular system only,Because When client paste my project
in different directories means,It will not Work

for EX:i am retrieving path by using Application.StartupPath
E:\\bill\\Hybrid\\bin\\Debug
i need to modify it as Above
E:\\bill\\Hybrid\\jarfile(jar file folder path)

Thanks
Posted
Updated 30-Nov-11 0:55am
v3

It would be better to use Path.Combine to avoid invalid slashes. For more info:
http://msdn.microsoft.com/en-us/library/fyy7a5kt%28v=vs.71%29.aspx[^]

Good luck!
 
Share this answer
 
I don't know why you need "E:\\bill\\Hybrid\\jarfile(jar file folder path)".Because Application.StartUpPath is better why to set dynamic path.
It always return the path where your application's .Exe file is stored.
So, you save your .jar file where your .exe file is stored and then use following code :
C#
Application.StartupPath + "Report1.rpt";

It will always give you appropriate path does not matter where your application stored. :)
 
Share this answer
 
Comments
vempadu 30-Nov-11 22:49pm    
thanks u ...........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900