Run PHP script in Java app.

Hi,
I have a PHP application that opens up a template (MS Word) invoice file, inserts some information in the file (eg. today's date, customer name) and then saves it as a new Word file. My questions are as follows.
1- How can I call this script from my Java application. Please note that I want to be able to pass parameters (eg. custome name read from a DB) from my Java app. to this script.
2- Is it possible to print already saved MS Word documents from Java? If so, how?
3- Is it possible to do what my PHP script is doing in pure Java? I couldn't find a simple way of doing this, that's why I used PHP but I would like to do this in Java if I can.
thanks in advance,
Mete

I have a PHP application that opens up a template (MS
Word) invoice file, inserts some information in the
file (eg. today's date, customer name) and then saves
it as a new Word file. My questions are as follows.
1- How can I call this script from my Java
application. Please note that I want to be able to
pass parameters (eg. custome name read from a DB) from
my Java app. to this script.You would have to call the PHP interpreter through Runtime.exec(), I believe. I haven't done anything with it, but you would have to build the command that would normally be typed on the command line as a string and pass it to Runtime.exec().
2- Is it possible to print already saved MS Word
documents from Java? If so, how?Try looking at the Jakarta POI project.
3- Is it possible to do what my PHP script is doing in
pure Java? I couldn't find a simple way of doing this,
that's why I used PHP but I would like to do this in
Java if I can.Same as 2.

Similar Messages

  • Running PHP script from Java apps

    Hi,
    I have a PHP application that opens up a template (MS Word) invoice file, inserts some information in the file (eg. today's date, customer name) and then saves it as a new Word file. My questions are as follows.
    1- How can I call this script from my Java application. Please not that I want to be able to pass parameters (eg. custome name read from a DB) from my Java app. to this script.
    2- Is it possible to print already saved MS Word documents from Java? If so, how?
    3- Is it possible to do what my PHP script is doing in pure Java? I couldn't find a simple way of doing this, that's why I used PHP but I would like to do this in Java if I can.
    thanks in advance,
    Mete

    Don't reply here. Go here instead.
    http://forum.java.sun.com/thread.jsp?forum=54&thread=479160&tstart=0&trange=15
    Cross-listed
    Sorry, I thought this didn't post before.

  • How to run Perl script in Java program?

    Some say that the following statement can run Perl script in Java program:
    Runtime.getRuntime().exec("C:\\runPerl.pl");
    But when I run it, it'll throw IOException:
    java.io.IOException: CreateProcess: C:\runPerl.pl error=193
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Win32Process.java:63)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:566)
    at java.lang.Runtime.exec(Runtime.java:428)
    at java.lang.Runtime.exec(Runtime.java:364)
    at java.lang.Runtime.exec(Runtime.java:326)
    at test.runPerl.main(runPerl.java:16)
    Exception in thread "main"
    Where is the problem? In fact, I do have a Perl script named "runPerl.pl" in my C:/ directory. Could anybody tell me why it can't be run? Thanks in advance.

    Hello sabre,
    First of all thanks for your reply.
    I have tried like what you mentioned.
    Eventhough, i could get the exact error message.
    I could get the Exception
    "Exception:java.lang.IllegalThreadStateException: process hasn't exited"
    <code>
    import java.io.*;
    public class Sample{
    public static void main(String args[]) {
    String s = null;
    Process p;
    try
         p = Runtime.getRuntime().exec("tar -vf sample.tar");
         //p.waitFor();
         if(p.exitValue() == 0)
              System.out.println("CommandSuccessful");
         else
              System.out.println("CommandFailure");
    catch(Exception ex)
         System.out.println("Exception:"+ex.toString());
    </code>
    In this code, i tried to run the "tar command". In this command i have given -vf instead -xvf.
    But it is throwing
    "Error opening message catalog 'Logging.cat': No such file or directory
    Exception:java.lang.IllegalThreadStateException: process hasn't exited
    CommandFailure"
    "Error opening message catalog 'Logging.cat'" what this line means ie,
    I dont know what is Logging.cat could you explain me its urgent.
    Thanks in advance.
    Rgds
    tskarthikeyan

  • Run Perl script in JAVA

    Can we run perl scripts in java, still supporting perl API?
    Thanks a lot for help!

    I haven't tried it but I think 6.0 supports some
    scripting.But NOT perl!Sorry, I didn't mean some Perl Scripting. I meant some scripting and I wasn't sure what languages.

  • Running sqlplus scripts from Java code?

    hi
    I need to programmatically run sqlplus scripts from Java code on a machine that doesn't have sqlplus installed.
    Is there any Java class library available for doing this?

    The Ant approach could probably work for me, thanks for the tip.
    The setup seems rather complex however, given the simplicity of the task. I would prefer just running a Java based SQL*Plus from in a separate process or doing this via an API that would allow me to run SQL*Plus scripts (parse script, substitute variables, run statements).
    Oracle SQL Developer v1.1 appears to include an API that does exactly this.
    The ScriptParser, Substitution and SQLPLUS classes in the oracle.dbtools.raptor.scriptrunner package (oracle.sqldeveloper.jar) seem to do just what I need based on my tests.
    Can I use these classes for this purpose in my application? Is repackaging allowed?
    Does Oracle have any plans for releasing this sort of functionality separately e.g. as part of the Instant Client?

  • Which MAC OS can run 1.5 compiled java app?

    from the apple website, the latest version of jre is Java 2 SE 5.0 Release 3
    but it's only limited to Mac OS X 10.4.2 or later.
    can any other earlier version of MAC OS run 1.5 compiled java app?
    would apple develop 1.5 for the earlier MAC OS system?
    thank you.

    No. If you don't see it available in the Software Updates, it's not possible.
    -Alexis

  • Run PHP script

    Hello, everybody. I'm wondering if it's possible to run a HTML PHP script in a report region which type is HTML format? Something like:
    <?php
    echo phpinfo();
    ?>
    As I can imagine, this code could not be handled to PHP compiler although as I know, the ORACLE appication server has been compiled together with PHP 5. So is there any tricks to make this work, or does APEX have some plan to make similar things work in the later version?
    Thanks!

    I have a PHP application that opens up a template (MS
    Word) invoice file, inserts some information in the
    file (eg. today's date, customer name) and then saves
    it as a new Word file. My questions are as follows.
    1- How can I call this script from my Java
    application. Please note that I want to be able to
    pass parameters (eg. custome name read from a DB) from
    my Java app. to this script.You would have to call the PHP interpreter through Runtime.exec(), I believe. I haven't done anything with it, but you would have to build the command that would normally be typed on the command line as a string and pass it to Runtime.exec().
    2- Is it possible to print already saved MS Word
    documents from Java? If so, how?Try looking at the Jakarta POI project.
    3- Is it possible to do what my PHP script is doing in
    pure Java? I couldn't find a simple way of doing this,
    that's why I used PHP but I would like to do this in
    Java if I can.Same as 2.

  • How to run a makefile from java app?

    Hi,
    I want to run a make command the first time my java swing application is run. The makefile is in a directory that the application is using for input files. Do I need to write a script to house the make command or is there another way to run make?
    Thanks

    Thanks for that but I'm not actually trying to build a makefile for my java app - I just want to be able to run one that is going to generate a bunch of html files for my application to access. The make command works great from the command line but I can't just put a directory followed by "make html" in a string and run it using runtime.exec in my application.

  • RUNNING PHP SCRIPT WITH ZEND FRMWRK IN WINDOWS TASK SCHEDULER

    I have a PHP script which includes the Zend framework Mail.php for sending mails.
    I am running a WAMP server and i used DW to create it.
    I want to run my script in every 5 mins, How i can schedule it in Windows task scheduler.
    I tried running a bat which contains the php.exe path and arguments as php file but it gives an error that zend/mail.php not found.
    Please help its really urgent.

    Thanks for your response.
    bat file has:
    path of the php.exe -f path of php file.
    But when it runs it gives an error that the zend framework file not found.
    I have a seperate PHP includes folder under which zend FW is stored.
    That folder is marked in includes_paths in php.ini.

  • Need to run php script before the Flash component kicks in

    I have a slide show component in Flash which uses an xml file to load images. The xml file, however, is created dynamically when the user selects which slide show they want to see. How do I run the php script BEFORE the slide show component has a chance to look for it? Usually it begins as soon as the .swf is run.
    thanks,
    chop

    thank you for responding.
    I'm still new at as3 so forgive me for needing details.
    I searched adobe for help and came up with the following to import the component. However, it seemed too easy to be true and so it was. I received errors when I ran it. The component is a commercial one called SlideshowBox and is in my library with that exact name.
    //add a component to the stage
    import fl.controls.SlideshowBox;
    var aSlideshowBox:Button = new Button();
    addChild(aSlideshowBox);
    errors:
    Scene 1, Layer 'Actions', Frame 1, Line 3    1172: Definition fl.controls:SlideshowBox could not be found.
    Scene 1, Layer 'Actions', Frame 1, Line 3    1172: Definition fl.controls:SlideshowBox could not be found.
    Scene 1, Layer 'Actions', Frame 1, Line 4    1180: Call to a possibly undefined method Button.
    thank you, k

  • Is it Possible to Run SQL Script from Java prog

    Hello
    Is there any API by which we can run SQl Script file ,
    Just by giving database configration parameters and SQL Script file Path ,it will execute that script automatically

    You can excute SQL statemetns throught JDBC, but that doesn't have a facility to read those statements from a file. You'd have to write code to read the file and create and execute statements through JDBC. That should be pretty straightforward though.
    It's conceivable that there's a third party library out there that does it, if you know what to look for.
    If you're not familiar with JDBC, check out http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/

  • Launchd not running php script in background

    Hi there,
    I am trying to run a php script repeatedly after every 2 minutes using launchd. I am using mac 10.9.2.
    Here is my plist file-->
    com.mycompanyname.mydepartment.mytaskname.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.mycompanyname.mydepartment.mytaskname</string>
        <key>ProgramArguments</key>
        <array>
              <string>/Applications/XAMPP/xamppfiles/htdocs/oauth/job.php</string>
        </array>
        <key>StartInterval</key>
        <integer>50</integer>
    </dict>
    </plist>
    /Applications/XAMPP/xamppfiles/htdocs/oauth/job.php --->
    #!/usr/bin/php
    <?php 
    $File = "YourFile.txt"; 
    $Handle = fopen($File, 'a');
    $Data = "Jane Doe\n"; 
    fwrite($Handle, $Data); 
    $Data = "Bilbo Jones\n"; 
    fwrite($Handle, $Data); 
    print "Data Added"; 
    fclose($Handle); 
    ?>
    My command line for your reference-->
    studio-film1:oauth MetricFilm$ sudo chmod a+x job.php
    studio-film1:oauth MetricFilm$ sudo cp com.mycompanyname.mydepartment.mytaskname.plist /Library/LaunchDaemons
    studio-film1:oauth MetricFilm$ sudo launchctl load -w /Library/LaunchDaemons/com.mycompanyname.mydepartment.mytaskname.plist
    studio-film1:oauth MetricFilm$ sudo launchctl load -w /Library/LaunchDaemons/com.mycompanyname.mydepartment.mytaskname.plist
    com.mycompanyname.mydepartment.mytaskname: Already loaded
    When i drag and drop my job.php script on terminal, it shows its path and when i enter.... It is not giving me any error & it is running on command line too & creating "YourFile.txt" if it does not exists & if it exists then it writes two lines into it.
    Problem is---->
    "YourFile.txt"  is not getting generated neither if it is there is getting written by php script. Which means it is not running into memory even a once.
    What should i do to make launchd run this script repeatedly.
    Thanking you

    Thanks dear,
    Should i change relative path mentioned into PLIST file
    <string>/Applications/XAMPP/xamppfiles/htdocs/oauth/job.php</string>
    to Absolute...?
    And is there any other command to start a plist task running after we have loaded it with launchctl??
    Thank you

  • Running php scripts on development server

    Hi,
    I have Coldfusion development server and Apache running on my local host. CF is on port 8500 and Apache is running on port 80.
    On my remote host in plesk I can add support for Coldfusion and PHP, is there a way to run PHP files on localhost:8500?
    Thanks

    Sweet. I run this setup on Mac 10.5.7 and it's great (PHP & CFML on port 80, that is).
    The easiest solution is to reinstall CF as a multi-server and run the connectors for Apache. The most recent CF (8.0.1) Mac installer is 'built' for Leopard, so it works well.
    Mark Drew has a good post:
    http://www.markdrew.co.uk/blog/post.cfm/running-coldfusion-8-on-leopard
    Aaron West also has an excellent post on CF 8 & Leopard:
    http://www.trajiklyhip.com/blog/index.cfm/2008/1/14/ColdFusion-8-Apache-22x-and-OS-X-105-L eopard
    If you run into a snag, PM me & I can help more (I've freaking installed this $%&@ thing so many times )!

  • Running PHP Script

    I've enabled the Apache server on my mac, and when I access my local IP address I can see the web page I've created. However, it appears that the server doesn't process PHP scripts, and just returns the source code of the PHP script when I try to open the script in Safari 4. How do I get the built-in Apache server to process PHP scripts and return the desired result?

    PHP is disabled by default. To enable it, you must edit Apache's configuration file. To do this, open up /private/etc/apache2/httpd.conf with a text editor. The file is owned by root, so you'll need appropriate access to modify the file. Text editors like BBEdit or TextWrangler can make this step much easier.
    Fairly early on in the configuration file is the section for the Dynamic Shared Object support - these are the modules that Apache loads to enable it to perform various tasks. In this section are a whole bunch of "LoadModule" statements - one for each module that Apache is loading. One of these is for PHP support. In the httpd.conf file on my machine, the built-in PHP module's statement is on line 114, the next to last item in this section. It reads: "#LoadModule php5_module libexec/apache2/libphp5.so" Remove the "#" from the beginning of the line, save the file, and restart Apache.
    If you plan on using PHP files as the default page for a directory (index.php, for example), you'll need to add index.php to the Directory Index section (line 225 in my file). Apache looks for them in the order listed, so if you list index.php after the index.html that's already there, Apache will look for index.html when asked for the directory before looking for index.php. If you're going to have index.php for most of your directories, you may want to list it first, before index.html.
    With regard to PHP itself, Apple's included PHP isn't any more official that the one I mentioned from Marc Liyanage. They're both compiled from the same source code. And, as far as updating goes, I'd argue that it's easier to update Marc's version, as you simply download an updated version and the installer will overwrite the old version. And, you don't have to wait for Apple to release a new version of OS X or a security update to see if you get a more current version. His versions will almost always be more current than the one Apple provides.
    In any event, Marc's version does not remove Apple's version from your system. His installs in /usr/local/ and leaves Apple's version intact. So, you can always go back to Apple's version by changing a few lines in a configuration file.

  • Auto run a script in a .app build?

    I have an applescript studio project that has two scripts. I want one of the scripts to autorun when the .app is opened, is there anyway to accomplish this easily?
    TIA
    Dave

    Where to I enter the
    All you need to is adding run script "so:and:so"
    inside the handler.
    Yup, inside the on awake from nib handler
    BTW.... when I click "edit" the inspector goes away?
    Yup, it switches to XCode, so you can edit the script.
    Now, it can be pretty simple, but it's depend on how you structure you project, to be more exact, on where you keep your scripts. Because you need to get the path to script in order to run it. Here is my example:
    tell me to (run script alias (POSIX file (path for script "base64_unicode" extension "scpt") as string))
    path for script return the path, but your script has to be in the Scripts folder of your XCode project.

Maybe you are looking for

  • Acrobat Pro 9 shutdown on Mac

    My Acrobat Pro 9 is shutting down every time I open the program. A dialog box says, that the program is a part of a Creative Suite and it needs an activation by open a CS-program such as Photoshop. I have tried the troubleshoot on this page http://he

  • Why do I have to type alle accountnames and passwords again in ff 29.

    I have to reenter my acount name and password the first time access a site after (being forced to) upgrading to ff29. Why is that? I have scores of sites I access and this is a pain in the ass! I used the remember function just to avoid remembering a

  • In facetime and i message do not have on/off button on ipad

    In facetime and i message do not have on/off button on ipad

  • Is there a way to query like this in Oracle 9i?

    Hi! Before starting, some constraints: I can't use store procedures for this task, and should use ANSI99 wherever possible. Let's suppose a table like this: CREATE TABLE ELEMENTS (REG_NAME VARCHAR2(10) NOT NULL, --PK ELM_ORDER NUMBER(3,0) NOT NULL, -

  • Oracle Forms Event in Finland

    http://www.oracle.com/technology/products/forms/htdocs/finland/invitation_f2soa.html If you are using Forms and based in this region, I think it would be a good idea to get along. Regards Grant