I'm creating a Perl script that will compile java code and create a jar file from it. The script resides in

c:\Files\

My souce resides in:

c:\Files\splatt\src\

The hitch is that the class files are compiled to a different directory than the one the script resides in. For example:

$MakeGistMain = "javac $java_opt $class_dir splatt\\src\\.java"; system ($MakeGistMain);

compiles to $class_dir. When it's time to create the jar I need to chage to the directory that contains the class files and jar them up:

$cd_class_dir = "cd $class_dir"; system($cd_class_dir); system("jar -cvf splatt.jar splatt");

What this does is create a jar file containing the .java files, not the .class files, suggesting that the cd isn't actually executed properly. Is there something I'm not doing?


In reply to How do I change directories from within a script? by Splatt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.