473,750 Members | 2,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Perl in Java

11 New Member
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:

Expand|Select|Wrap|Line Numbers
  1. import java.util.*;
  2. import java.io.*;
  3. class Rename {
  4.     public static void main(String args[]) {
  5.         try {
  6.             Runtime r = Runtime.getRuntime();
  7.             r.exec("perl mydir/rename.pl");
  8.         } catch (Exception e) {
  9.             e.printStackTrace();
  10.         }
  11.     }
  12.  
Apr 12 '07 #1
6 1197
KevinADC
4,059 Recognized Expert Specialist
"doesn't work" is too vague. If it has <STDIN> is the perl programming waiting for some user input?
Apr 12 '07 #2
bdan44
11 New Member
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.
Apr 12 '07 #3
KevinADC
4,059 Recognized Expert Specialist
Seems like a JAVA question. There is a perl module called Expect but I don't know if it will work in this situation.
Apr 12 '07 #4
miller
1,089 Recognized Expert Top Contributor
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
Apr 12 '07 #5
bdan44
11 New Member
bumping to top
Apr 15 '07 #6
bdan44
11 New Member
bumping again. if you have knowledge, please help.
Apr 17 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2925
by: Lionel | last post by:
Hi all, I would like having more informations on how we could exchange informations and/or objects between PERL and JAVA. We have a Java programs that open, maintain and close telnet connections, for PERL scripts... Is it possible, to echange the Java telnet session object to PERL programs ? Or thoses two languages could not exchange objects or such
6
5950
by: John Smith | last post by:
Hello, I have a rather odd question. My company is an all java/oracle shop. We do everything is Java... no matter what it is... parsing of text files, messaging, gui you name it. My question is this... is Perl so much better at parsing text files and outputing that we would see a substantial speed increase? We process about 10 million records in flat files a day for reformatting before putting them in a DB. Also, when it comes to...
1
3033
by: bezeee | last post by:
At my work we are in the process of building a tool to test an XML based API. Basically, XML in and XML out over http. Currently, there are two engines that do all of the schema validations, xml diffs, sending/receiving, etc. One of these engines in implemented in C# and the other in Java. Now the choice comes down to which scripting language we choose (Perl, Python or Jython) to tie into one of these engines. The scripting language...
3
8172
by: John Smith | last post by:
Hello, I have a rather odd question. My company is an all java/oracle shop. We do everything is Java... no matter what it is... parsing of text files, messaging, gui you name it. My question is this... is Perl so much better at parsing text files and outputing that we would see a substantial speed increase? We process about 10 million records in flat files a day for reformatting before putting them in a DB. Also, when it comes to...
4
9049
by: Firewalker | last post by:
Hey guys, I am newbie to perl. I am trying to deal with dates ( such trying to find what the date would be after month). Is therea function or date class( I am a java programmer, I couldnt find the right word instead of class) to do the job? Thanks for any help.
0
953
by: bdan44 | last post by:
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: 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"); ...
9
1787
by: peter | last post by:
Hi, this is not stinky bait. If you take it that way, please dont respond.. I have been away from UNIX software for quite awhile and want to get back into it. I liked "C" but Java seems like the way to go for compiled langs, now days so I will learn that. At one time, I did a bit of perl but now I see php alot. I was wondering what you guys thinks of the pros/cons of perl and php.
1
1977
by: houh | last post by:
I have a java app that generates openoffice docs. When I run the java app in a shell script, as: export JAVA_HOME=/opt/corp/projects/metrics/Java/jdk1.5.0_07/bin/java export CONST_LOC=/home/methct/metrics/MGConfig/staging_8103.xml $JAVA_HOME view.main.MetricsMainFrame $CONST_LOC I can close the openoffice doc that are generated by the java app, with no issues. The problem is when I fire the java app from the perl script using the...
3
7195
by: limnath | last post by:
Hello everyone, I am new here and very new to PERL, just reading a book on scripting in PERL. I have a quick need which I hope anyone can kindly help me. I need to invoke a Java program from my PERL script ( I don't care what the Java code does, it could be a hello world for all I care ). All I need to do is read the exit code of the Java program I invoke. 1) How do I invoke the program from perl ?
13
2319
by: Corey G. | last post by:
If Perl 6 ever does get on its feet and get released, how does it compare to Python 3000? Is Perl 6 more like Java now with Parrot? I just want to make sure that Python is staying competitive. If this is the wrong mailing list, just let me know. Thanks!
0
9000
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9577
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9339
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6804
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2225
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.