Reputation: 417
I'm creating a epubchecker gui using c#
there is a free epubchecker written in java.
its call epubcheck
to run using command line
java -jar epubcheck.jar file.epub
and my c# code is
System.Diagnostics.Process clientProcess = new Process();
clientProcess.StartInfo.FileName = "java";
clientProcess.StartInfo.Arguments = @" -jar " + @"C:\Users\User\Documents\Visual Studio 2015\Projects\epubcheck-4.0.1\epubcheck.jar" + " " + @"C:\Users\User\Desktop\v3.epub";
clientProcess.Start();
clientProcess.WaitForExit();
and the error is
The system cannot find the path specified
but i checked the location of the jar file and epub
i copied the string on my program and pasted the string on file explorer. and the file and folder exist.
so what am i doing wrong?
Upvotes: 0
Views: 152
Reputation: 46
try this
clientProcess.StartInfo.Arguments = @" -jar " + @"C:\\Users\\User\\Documents\Visual Studio 2015\\Projects\\epubcheck-4.0.1\\epubcheck.jar" + " " + @"C:\\Users\\User\\Desktop\\v3.epub";
Upvotes: 0
Reputation: 560
Since you have spaces in your file path, you need to surround them in quotes:
clientProcess.StartInfo.Arguments = @" -jar " + @"""C:\Users\User\Documents\Visual Studio 2015\Projects\epubcheck-4.0.1\epubcheck.jar""" + " " + @"""C:\Users\User\Desktop\v3.epub""";
Upvotes: 0