To write a perl script for running a java program from cgi of web server

I have to write a perl script to call a java program(.exe).I want to run this file through the cgi of the web server.
java myprogram
can anyone help me to write a perl script??

It depends on what the java program does. For example, does it parse HTTP headers from standard input, or what?
Are you sure it wouldn't be easier to turn the class into a servlet? etc.
Take a look at IPC::Open2 and IPC::Open3 though. You may need them. (That's just a guess.)

Similar Messages

  • JSP codes for running a JAVA program

    hello...
    does anyone know the JSP codes for running a Java program from my web page?? i mean i already have my java program compiled... and i just want this java program to run in the background when I click on a button or a link...
    Any idea about this?
    plz advice..
    avi

    yes... u r somewhat right... but this runs on Jakarta Tomcat...
    i'm using the Apache Http Server together with the ServletExec AS which enable the Apache server to run JSP..
    I've created a package where i've put my classes...
    WEB-INF/classes/tbd(package name)/my classes
    and i've added.. package name.. in my java program..
    and then in jsp... i've written..
    <%@ page import="tdb.*"%>
    <jsp:useBean id="exec" class="tdb.textdb" />
    <%exec.convert_data();%>
    but when i run the page it says the package does not exist...
    can anyone tell where to place the folder WEB-INF so that it can run fine?
    thx
    avi

  • URGENT: How to run a Java program from a different directory?

    Hi.
    How do I run a Java program from a directory that the file is not located in? So lets say im in c:\Java. But the file is in c:\Java\abc\efg\.
    What would be the command to run the Java file from c:\Java.
    I can't remember it and I need it asap.
    Cheers.

    If the class you are trying to run is MyApp.class, try
    c:\Java\>java -cp abc\efg MyAppThe actual classpath you specify will depend on whether or not MyApp.class is in a package (I've assumed it isn't) and whether or not any 3rd party jars are involbed (I've assumed not).
    Edited by: pbrockway2 on Apr 1, 2008 6:42 PM
    The command arguments read as "Run the MyApp class using as a classpath abc\efg relative to here (c:\Java)".

  • Panel for running a java program

    Hi,
    can any body guide me how can i create a JPanel for running another java class with main method. just like an IDE.
    Thanks
    paruchuri

    Hi,
    the following works. I don't know if it is an elegant way. I don't use it to start other Java-apps only for starting external Browsers and so on....
    Process p;
    try  {
       p = Runtime.getRuntime().exec("javaw yourApp.java");
    }  catch (Exception e)  {

  • Running a java program from a .asp page

    i'm looking for someone in the community that knows how to run a java program
    on a web server ( not an applet) from a asp page. The server as IIS 5 and the jre1.3.1
    any help or tips would be welcomed

    The following site explains in detail how you have to do it. I have done it and it works fine.
    If u still have problems, contact me at [email protected]
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;q167941

  • Running an External Program from Batch on Windows Server 2008R2 Failing

    Hi,
    I am trying to run an external program from a batch job and it is failing with this error message:
    Ext. prog.: ERROR: Input redirection is not supported, exiting the process immediately.
    Ext. prog.: External program terminated with exit code 1
    The program I am trying to run is:  timeout
    This command works on the OS: timeout -t 30
    I have setup the step to look like this:
    Under External Program:
    -Name: timeout
    -Parameter: -t 30
    I have also tried:
    -Name: timeout -t -30
    -Parameter:
    I am running ECC 6.04 on top of Windows Server 2008R2 with SQL Server 2008R2. 
    When we were running in Server 2003 on ECC 6.0 I was able to use the Sleep program just fine in the same manner.  I have found out that sleep is not available in server 2008.  It was replaced with timeout.
    After an update to EHP4 and moving to Windows Server 2008R2, Is there any pre-work that needs to be done on the SAP or Windows side before we can run external programs?
    Thank you,
    Neil

    > SAPService<SID> and <SID>ADM both have Administrator rights for the server.
    > That means they should have full access.
    No - this is no more true like that since Windows 2008, it's a bit more complex:
    http://en.wikipedia.org/wiki/User_Account_Control
    > Where would you setup the permission/policy to "interact with the desktop"?
    Add the policy using group policy editor (gpedit.msc)
    Markus

  • Running a java program from an icon

    I want to run my program from an icon on my desktop. I have a .bat file that I've built a shortcut to and it works.MY GUI program does display and run when I click on the icon. The problem is that the DOS window also shows up behind my GUI.
    Is there anyway to prevent the DOS window from showing? Or is there another way to run a Java program without resorting to a DOS command line or running it through FORTE or another IDD?

    Chris's solution worked well, with one small problem. Once my GUI starts, it takes up the whole screen. Normally when I run it, it appears as a small window.
    not a big problem, I can reduce it easily after it starts. But does anyone know a way to make it come up in the reduced size it norally comes up in when I run it from my IDE?

  • Using a UNIX shell script to run a Java program (packaged in a JAR)

    Hi,
    I have an application (very small) that connects to our database. It needs to run in our UNIX environment so I've been working on a shell script to set the class path and call the JAR file. I'm not making a lot of progress on my own. I've attached the KSH (korn shell script) file code.
    Thanks in advance to anyone who knows how to set the class path and / or call the JAR file.
    loggedinuser="$(whoami)"
    CFG_DIR="`dirname $0`"
    EXIT_STATUS=${SUCCESS}
    export PATH=/opt/java1.3/bin:$PATH
    OLDDIR="`pwd`"
    cd $PLCS_ROOT_DIR
    java -classpath $
    EXIT_STATUS=$?
    cd $OLDDIR
    echo $EXIT_STATUS
    exit $EXIT_STATUS

    Hi,
    I have an application (very small) that connects to
    our database. It needs to run in our UNIX environment
    so I've been working on a shell script to set the
    class path and call the JAR file.
    #!/bin/sh
    exec /your/path/to/java -cp your:class:paths:here -MoreJvmOptionsHere your.package.and.YourClass "$@"Store this is a file of any name, e.g. yuckiduck, and then change the persmissions to executechmod a+x yuckiduckThe exec makes sure the shell used to run the script does not hang around until that java program finishes. While this is only a minor thing, it is nevertheless infinite waste, because it does use some resources but the return on that investment is 0.
    CFG_DIR="`dirname $0`"You would like to fetch the directory of the installation out of $0. This breaks as soon as someone makes a (soft) link in some other directory to this script and calls it by its soft linked name. Your best bet if you don't know a lot of script programming is to hardcode CFG_DIR.
    OLDDIR="`pwd`"
    cd $PLCS_ROOT_DIRVery bad technique in UNIX. UNIX supports the notion of a "current directory". If your user calls this program in a certain directory, you should assume that (s)he does this on purpose. Making your application dependent on a start in a certain directory ignores the very helpful concept of 'current directory' and is therefore a bug.
    cd $OLDDIRThis has no effect at all because it only affects the next two lines of code and nothing else. These two lines, however, don't depend on the current directory. In particular this (as the cd above) does not change the current directory for the interactive shell your user is working in.
    echo $EXIT_STATUS
    exit $EXIT_STATUSEchoing the exit status is an interesting idea, but if you don't do this for a very specific purpose, I recommend not to do this for the simple reason that no other UNIX program does it.
    Harald.

  • Machine environment for running a java program

    Hi,
    I am thinking about writing a client-server application. The communication between the server and the client and vice versa will be in RMI. My question is regarding the client machine environment - do I need to install JDK on the client machine in order to run the client? Can the client run on any environment?
    Thanks

    Hi,
    I am thinking about writing a client-server
    application. The communication between the server and
    the client and vice versa will be in RMI. My question
    is regarding the client machine environment - do I
    need to install JDK on the client machine in order to
    run the client? Can the client run on any environment?
    ThanksHow do java programs run?
    Compiled Java programs are stored in files as bytecode. As a Java program is running, the Java Virtual Machine (JVM), which is a piece of software, converts the bytecode into machine executable code for the particular platform on which the program is running. This code is what is executed by the processor. Bytecode is not specific to a particular platform, but the machine code generated by the JVM is.
    [url http://www.webopedia.com/TERM/J/JVM.html] definition of JVM as per webopedia[ [/url]
    Hopefully now you have an answer to your question.

  • Help required - running a Java program from the command line

    Hi,
    I have a small non-graphical Java application, packaged into a Jar file. My program relies on classes in another (external) Jar file.
    When I run the application from the IDE, everything works fine. However, when I try to run the application from the command line, I keep getting a NoClassDefFoundError for classes in the external jar.
    Both the application jar file and the external jar file are in my root directory (C:\).
    My command line call is as follows:
    java -cp c:MyExternalLib.jar -jar MyApp.jar
    Any help greatly appreciated.
    Thanks,
    Walter

    hi,
    set classpath=%classpath%;c:\myjar.jar;
    here i have specified myjar.jar file as an example u give ur location.after setting the classpath run ur java application.
    java mypgm
    this will solve ur problem
    regards,
    Ganesh

  • Not able to run the Java Program from jre for the ARM processor

    Hi ,
    I am try to run the jre1.4.2 for the arm core (linux 2.6kernel) which i downloaded from the sun site.
    I am created the class file from the J2SE1.4 development kit. I created the simple HelloWorld Program and complied with J2Se then i copied that class file into my IMX board which has ARM core.
    When i run the commnd java HelloWorld i am getting this error
    dl failure on line 765Error: failed /dev/shm/jvm/j2re1.4.2/lib/arm/client/libjve
    Please give me some suggestion to solve this porblem
    Thanks in Advance
    Narendra

    I JRE i have download from the sun site . But when i am trying to run the simple helloWorld program in that it is giving the below error.
    error:
    dl failure on line 765Error: failed /dev/shm/jvm/j2re1.4.2/lib/arm/client/libjvm.so because /dev/shm/jvm/j2re1.4.2/lib/arm/client/libjvm.so: symbol __divdf3, version GCC_3.0 not defined in file libgcc_s.so.1 with link time reference.
    Can anybody help me in this how to solve this problem . I also searched in the forum but did not get any answer on that problem
    Thanks in advance.
    Narendra

  • Problem with running a java program from the command line

    I have this code:
    package pkg;
    import jxl.*;
    import java.io.File;
    public class TestClass {
         public static void main(String[] args) {
              try{
                   Workbook book = Workbook.getWorkbook(new File("d:/testWorkspace/excFile.xls"));
                   Sheet sheet = book.getSheet(0);
                   String s=sheet.getCell(4, 2).getContents();
                   System.out.println(s);     
              }catch (Exception e){System.err.println(e);}
    }I've wrote it in Eclipse, added jxl.jar to the buildpath, and it works fine.
    Then I tried to run it from the command line and I did it like this:
    D:\testWorkspace\testProject\bin> java -cp \jxl.jar pkg.TestClassThe result was:
    Exception in thread "main" java.lang.NoClassDefFoundError: pkg/TestClass
    Caused by: java.lang.ClassNotFoundException: pkg.TestClass
    ...but the file TestClass.class DOES exist in the folder d:\testWorkspace\testProject\bin\pkg\ and the file jxl.jar IS on the root of drive D (like I already wrote, it worked fine inside the Eclipse).
    So, my question is: How to run this code from the command line?
    I have no idea what went wrong.
    Can someone help me, please?

    The current directory is not implied in the classpath.
    D:\testWorkspace\testProject\bin> java -cp .;d:\ pkg.TestClassor
    D:\testWorkspace\testProject\bin> java -cp .;d:\jxl.jar pkg.TestClassI always forget which is right since I never work with jars...

  • How to run the java program from another directory?

    Hi
    Assumption:
    data.java is in a package suncertify.db and place in a directory c:/code/suncertify/db/ directory
    data.class file: is in c:/code/suncertify/db/ directory
    current directory: c:/
    How can execute the data.class directly in c:/ directory without changing directory to c:/code/ ?
    Thanks in advance,
    Adrian

    Yes. You can use the -classpath and -sourcepath options to specify where to look for source files, and the -d option to specify where to generate the class files. Look up the usage of those options in the javac documentation:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html

  • Execing a java program from a perl script

    Hello,
    I have the following perl script that executes a java program called TestSe. It passes its QUERY_STRING to the java program after printing it.
    #!/usr/bin/perl
    print "Content-type: text/html\n\n";
    $in = $ENV{'QUERY_STRING'};
    print $in;
    exec 'java TestSe '.$in;
    This script in placed in a cgi-bin directory on a server.
    This script works when i run it manually and hardcode a string value in $in by doing
    $in="Acheck";
    It prints 'Acheck' on the screen and invokes the java program with Acheck as the parameter.
    I tested it by typing
    'perl try.cgi' on the shell after logging into the server.
    However when I execute this script via. a browser then it does not exec the java program.
    The QUERY_STRING is the papameter passed to this script by an html form in a browser that invokes it. The script can print the value of $in in the new browser window that it creates but it is not execing the java program.
    Does anyone kow why?
    Thanks

    Also if you invoke this as a CGI, the server is going to say it got a 5xx error (server exception). That's because the first output of the perl script is going to be that query string, which isn't a proper HTTP header. The server is expecting the CGI to start out with HTTP headers (such as Content-type, Location, Status) and then a blank line.

  • Problems running a java program

    Hello,
    I have absolutely no java experience whatsoever, and I need to fix a program that suddenly stopped running properly after several years without problems. Basically, I have a perl script that calls a java program. Everytime I run this perl script from the web browser, the java program returns an internal error:
    # # HotSpot Virtual Machine Error, Internal Error # Please report this error at # http://www.blackdown.org/cgi-bin/jdk # # Error ID: 5649525455414C53504143450E4350500024 # # Problematic Thread: prio=5 tid=0x804e680 nid=0x6d16 runnable #
    However, when I run the perl script command line, it runs fine. I added the -verbose option to the java call, and I discovered that the program stops running after it opens the .jar files but before it loads them .... these files have full read permissions, so I don't think that's the problem. Any ideas?
    Thanks!

    ...fix a program that suddenly stopped running properly after several years without problems.Which means either the program changed or the environment changed. I would guess the environment. The most likely possibilities: new version of the operating system, new version of perl, new version of java. Also possible: new version installed of any of the previous without removing older versions, new software not associated with the first, new mapped drives and/or changed env vars.

Maybe you are looking for

  • How do I transfer all info from one Mac to another?

    A few months ago I bought a new MacBook Pro, and want to use my old one as a backup. How do I transfer all the info on the new one to the old one? Got a firewire, if that helps.  OS 10.8.2 on both. Tom in Texas

  • Third party tool which can create infosets in SAP R/3

    Hi All, Is there any third party tool that could create infosets in ECC for reporting.We integrated crystal reports with ECC and want to create queries using infosets and make use of BAPI's. There are several 100's of reports to be developed and we a

  • Form in a popup window

    Hello I have a button on a page opening a popup window. This popup window includes a page with form and the classical Create Cancel Submit Delete buttons. Of course, when clicking Cancel, Submit or other buttons, the popup does not close and I end up

  • Mophie Juice Pack VS. FastMac IV on the iPod Touch

    So which is better the Mophie JuicePack or the FastMac IV for the iPod Touch?? http://fastmac.com/iv.php http://www.mophie.com/products/juice-pack-ipod-touch-2nd-gen-1 ...Lets see (Mophie VS IV): Price- $99 VS $99 Audio- 24 hours VS *72 Hours* Video-

  • "v" in Mac OS X v10.x.x name ?

    Sorry for my ignorance but what does the "v" stand for? Is it something important or just stands for "version" or something like that and it's the same? I was looking at SL updates and in system requirements and versions there's sometimes a "v", some