Using ' and " charachter in a string in java
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   afsar_hussain
Posted On:   Wednesday, April 13, 2005 10:46 PM

hi I am using image magick commonds through java programmes on linux system I am using exec() method of Runtime class.I am giving following line String s="/usr/bin/convert imcar.png -resize 600x500 -draw 'image over 5,10 0,0 tiles_1.jpg' -draw 'image over 100,50 0,0 tiles_2.jpg' /root/drawnimage.jpg"; and i am passing this string in Runtime.getRuntime().exec(s); but i am getting following errors ERROR->convert: Non-conforming drawing primitive definition `image'. ERROR->convert: Non-conforming drawing primitive definition `image'. ERROR->convert: unable to open file `tiles_2.jpg'': No such file or directory. The reasion of thes   More>>

hi

I am using image magick commonds through java programmes on linux system

I am using exec() method of Runtime class.I am giving following line

String s="/usr/bin/convert imcar.png -resize 600x500 -draw 'image over 5,10 0,0 tiles_1.jpg' -draw 'image over 100,50 0,0 tiles_2.jpg' /root/drawnimage.jpg";

and i am passing this string in Runtime.getRuntime().exec(s);


but i am getting following errors

ERROR->convert: Non-conforming drawing primitive definition `image'.
ERROR->convert: Non-conforming drawing primitive definition `image'.
ERROR->convert: unable to open file `tiles_2.jpg'': No such file or directory.


The reasion of these errors that the string is considering by exec() method without ' character.

Now my problem is how can we pass string in exec() method with cotes(') .

Thanks in advance
Afsar Hussain

   <<Less

Re: Using ' and " charachter in a string in java

Posted By:   Anonymous  
Posted On:   Tuesday, June 14, 2005 07:59 AM

try to use escape character before them

for example

--> --> "Hello!",mother said.


String myString = ""Hello"!,mother said.";


also for '


--> --> My sister's car name is "Jigalo"


String myString = "My sister\'s car name is "Jigalo"";

Re: Using ' and " charachter in a string in java

Posted By:   Anonymous  
Posted On:   Tuesday, June 14, 2005 07:57 AM

try to use escape character before them

for example
--> --> "Hello!",mother said.

String myString = ""Hello"!,mother said.";

also for '

--> --> My sister's car name is "Jigalo"

String myString = "My sister\'s car name is "Jigalo"";

Re: Using ' and " charachter in a string in java

Posted By:   Christopher_Koenigsberg  
Posted On:   Thursday, April 14, 2005 07:21 PM

I think you need to break up your string, into separate strings, for the program to run, and each of the args.
About | Sitemap | Contact