Perl in Java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bdan44
    New Member
    • Apr 2007
    • 11

    Perl in Java

    HI,

    I have a perl script that I want to call in java. I can call it, the only problem is that the perl script has <STDIN> and the perl sciprt doesn't work. Other perl scripts(without <STDIN>) do work however. here is my code:

    Code:
    import java.util.*;
    import java.io.*;
    class Rename {
    	public static void main(String args[]) {
    		try {
    			Runtime r = Runtime.getRuntime();
    			r.exec("perl mydir/rename.pl");
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    "doesn't work" is too vague. If it has <STDIN> is the perl programming waiting for some user input?

    Comment

    • bdan44
      New Member
      • Apr 2007
      • 11

      #3
      yes. the perl script needs some user input. however, the java program doesn't provide an oppurtunity for the user to provide said input, or at least it doesn't in its present state.

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        Seems like a JAVA question. There is a perl module called Expect but I don't know if it will work in this situation.

        Comment

        • miller
          Recognized Expert Top Contributor
          • Oct 2006
          • 1086

          #5
          Originally posted by KevinADC
          Seems like a JAVA question. There is a perl module called Expect but I don't know if it will work in this situation.
          Moving thread to the Java Forum.

          - Miller

          Comment

          • bdan44
            New Member
            • Apr 2007
            • 11

            #6
            bumping to top

            Comment

            • bdan44
              New Member
              • Apr 2007
              • 11

              #7
              bumping again. if you have knowledge, please help.

              Comment

              Working...