Link to home
Start Free TrialLog in
Avatar of dkim18
dkim18

asked on

run.bat file

I am having weird error. I am passing two args when I run this program.
args[1] is: http://webdev.apl.jhu.edu/%7Emed/summer03/homework/05LibrarySwing.html
However, when I put this url in run.bat file like this:

java <program>  <path> http://webdev.apl.jhu.edu/%7Emed/summer03/homework/05LibrarySwing.html

args[1] comes into main without "%7", and that is why my program doesn't work.
Another word, System.out.println("args[1] " + args[1] ); just print http://webdev.apl.jhu.edu/Emed/summer03/homework/05LibrarySwing.html
Of course, run.bat file is excutable file.

Why is that?
-----------------

  public static void main(String[] args) throws CrawlerException {

    checkUsage(args);
    //final String LINE_SEPARATOR = System.getProperty("line.separator");
    //StringBuffer buffy = new StringBuffer("");

    try{
      System.out.println("args[1] " + args[1] );
      URL url = new URL(args[1]);
SOLUTION
Avatar of shivsa
shivsa
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vk33
vk33

What platform are you running? For Win it works fine without escaping...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To escape the percent in a batch file, you type %%.  Just the percent character twice.
and thats why i said to escape since windows should not take it as a its own operator and treat it as a special character.
Ah, yeah, well done Breadstick! I launched it directly from command line without batch-file...

Regards!