To run a executable file

Hi Guys & Gals,
I need a small help I need to know how to write a java program to run a executable file at a specified time? For example I need to start Editplus at 4.00Pm.

Hi You can use this program
For testing purpose, i have calculated scheduled time by adding 1 minute to the current time, see the bold line, you may change this
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
public class ExecuteEXE extends TimerTask {
      * @param args
      public void run() {
              //TODO generate report
                //TODO generate report
                 Runtime r=Runtime.getRuntime();
                Process p=null;
                System.out.println("Executing ");
                try
             String s="c:\\programe files\\editplus\\editplus.exe"; // Change here accodingly
           //     String s="D:\\Timesheet.bat";
                 p=r.exec(s);
              catch(Exception e){
                System.out.println("error==="+e.getMessage());
                e.printStackTrace();
class MainApplication {
       public static void main(String[] args) {
         Timer timer  = new Timer();
       java.util.GregorianCalendar cal = new java.util.GregorianCalendar();
       cal.setTime(new Date());
          //adding a minute with current time for testing
          cal.add(java.util.GregorianCalendar.MINUTE,1);
          Date newd = cal.getTime();
          System.out.println("Current time "+new Date());
          System.out.println("Scheduled time "+newd);
        timer.schedule(new ExecuteEXE(),newd); // newd is the scheduled time
         System.out.println("Timer Started");
     }

Similar Messages

  • Running an Executable file

    Hi,
    Is there a way, using ALBPM 5.7 StandAlone on Windows, to run an executable file (.exe or .cmd or .vbs) from within an automated task?
    If so, how is it done?
    Thanks in advance.

    Hi,
    Sure, you have to use the Java.Lang.Runtime (which is a java standard component)
    You can check javadocs at: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html
    If you are using Java language style, the code would be something like:
    Java.Lang.Runtime.getRuntime().exec("c:\myExecutableFile.exe");
    Hope this helps,
    Ariel

  • How can i run .app executable  file

    Hi,
    While i was searching for my topic on google code, i found one project and i download that.
    But its "MyProject.app" with yellow cplored xcode sumbol and i can not run this file.
    Does any one know that how can i run this type of file. i want to run this project.
    And another question. I want to create executable file from my project like exe on windows. Is there any way to create this type of file????
    Thanks.

    vavdiyaharesh wrote:
    Hey,
    When i double click on .app file it quit and show me message like "The application project140 quit unexpectedly"........."
    So is there any problem in .app file?
    On your machine sure sounds like it.
    How can i create exe file and how can i pass -0 to compiler ..iu don;t see any option in xcode for that.....
    giove me solution...
    I think you'd be better off taking some training, or at least working through some of Apple's tutorials.
    http://developer.apple.com/documentation/developertools/conceptual/XcodeQuickTou r/qtintro/chapter_1_section1.html
    Thanks.
    You're welcome.

  • By user login items to run UNIX executable file

    Hi all,
    Here is a plobem, I couldn't deal with for some days, please help me and give some advises .
    I want run a shell script when special user login the system, not all users.
    as I know and by test, the below methods are do the same work.
    1. System Preferences > Accounts > Login Items, add application and can run when user login.
    2. Two files: ~/Library/Preferences/com.apple.loginitems.plist or loginwindow.plist, and add useful items  to any of them.
    Because shell script can only open, but not run by "Login Items",  so at first I write a UNIX executable file , which is run the SH, and  gone into the System Preferences > Accounts > Login Items, add the UNIX file below, and set "Hide".
    When the user login the system again, it can auto open the terminal window, and run the UNIX exe file, but when the file end of exe, the terminal still open,
    and can't close. Here I have write command "exit" in the SH file, and the terminal show "the process has ended".
    I want the UNIX exe file  had better run in the backstage, if by terminal , how can make terminal hide?  or by what command can close the terminal ? 
    If it is not a good method,  whether there have any other way to  run the Shell Script flie in the backstage when certain  user login ?
    Here my Mac OS X workstation system is 10.5.8.
    please help me ,thank you .

    OK. My previous answer still holds. You don't need Terminal to run ssh, or AppleScript either, for that matter. What you do need is a process on the remote machine that will accept remote requests to run some appliction. It just so happens that sshd is such a program. I'm not sure about AppleScript. You may need to be logged on so that the Finder is running. I'm no AppleScript expert, so don't quote me. Again, I would just use ssh.

  • Running an executable file through servlet

    Hello People,
    I tried searching about this on the Forums, but could not find the right solution.
    Please donot get annoyed if you find this to be a repeted topic, which I am sure is not.
    I want to run a .sh file in Unix environment through servlet.
    Actually i want to do this inorder to schedule a report servet to run a report and generate the output in a particular format on a click of a button.
    I tried using Runtime.getRuntime().exec method, (which I know through forum is unreliable)
    Can anyone suggest me a method through I can achieve this?
    Any suggestion is appreciated.
    Regards,
    Rohan Kamat

    Hi MOD,
    Thanks for the quick reply.
    Heres what I am doing to schedule.
    1) The client selects the necessary parameters from the front end and then saves it in a table.
    2) This he will be doing for as many reports as he wants, on an average there will be 200 reports daily.
    3) Once he has selected all the parameters for all the reports, he will go to the next screen and fire a script to run the reports at a time.
    4) This script will be fired only once. And once it is fired it will generate a PDF files of the reports.
    5) On the front end the screen will be refreshed showing the users the status of the reports that he has scheduled to be run
    I am using Servlets 2.0 version, and jdk.12
    Regards,
    Rohan Kamat

  • My computer is crashed after 3 hours, when am running an Executable file from LabView 6.0.2

    My VI is using DAQ6025e and GPIB cards, it is countiniusly writing data to files and talking with 2 GPIB instruments and one Serial instrument. Sudenly after 3 hours of perfect working it is crash my computer.
    Does any body know why ??? Help? S.O.S?

    Some questions to help us troubleshoot:
    1)How crashed is your computer when it crashes?
    Blue Screen Of Death crashed? If you don't know about BSOD then that
    is when your computer presents a blue screen (white in XP) and tells
    you that the system is halted, gives you a register dump and the
    memory address where it stopped (all of which is useless unless you
    are an assembly language wizard) and then you have to reboot the
    machine.
    Application error that kills LabVIEW.exe? Usually a pop-up MSGBOX
    style dialog box will appear with a such and such error occurred in
    LabVIEW.exe or another application and an OK button.
    VI Slows to a crawl w/hourglass in the app window? Program doesn't
    stop executing, it just stops responding to user inputs.
    LabVIEW error cluster error that causes the VI to quit?
    2) What O/S are you running? Win 3.1, Win 95, Win 98, Win NT 3.1, Win
    NT 3.5, Win NT 4.0, Win2000, WinME, WinXPHome, Win XPPro?, Linux?, Mac
    O/S?
    In the Microsoft family, WinNT and Win2000 are by far the most stable
    and reliable of the various versions of Windows with Win95 and Win98
    having a lot of problems running for long periods of time. Make sure
    that you get WinNT 4.0 updated to service pack 6 if you are still
    using 4.0 but haven't updated the service pack level yet. There were
    quite a number of problems with it when it first came out that have
    since been cured.
    3) Have you run the LabVIEW VI profiler yet? This will point out
    memory leaks that are due to dynamically built arrays using shift
    registers etc. or appending to strings, or improper IMAQ management,
    etc.
    4) Have you brought up the task manager and looked at the memory
    allocated for LabVIEW.exe and for the whole system as well? Is it
    growing? Sometimes there can be memory leaks that don't show in the
    profiler that will show in the task manager when you look. These can
    be due to bugs in LabVIEW itself or some driver for some hardware you
    are using, etc.
    If you are not running NT or a later derivative, then you won't have
    task manager available but you can get diagnostic tools that are very
    similar to task manager from off the web.
    5) How much memory do you have in your PC? How fast is your PC? What
    does the CPU % usage look like under task manager when you first start
    your app? If it is running >40% CPU usage for any significant amount
    of time at the start then perhaps your PC is overloaded with work and
    you need a faster PC or your code needs redesigning. I like data
    acquisition systems to operate <25% generally speaking. This number
    seems to improve the reliability of the code that is running on them.
    6) How much H/D space is available? You say you are writing data to
    files. Your h/d space isn't running out is it?
    7) Is it possible to run one instrument at a time for several hours to
    see if it is a particular instrument that is causing the crash? Make
    sure that your GPIB cards are properly configured so that they don't
    share resources with any other devices(IRQ, DMA, memory addresses,
    etc.) It may be possible that they behave fine most of the time even
    with shared resources but if they ever try to send a command
    simultaneously and they share resources, they could "collide" and
    crash your PC. You can check all this out in the control panel and/or
    MAX.
    8) Is it possible that your serial port is getting hung up after
    running a long period of time? Serial port UARTS are notoriously
    finicky especially over longer line lengths and higher data rates. It
    could be that your serial instrument is locking up your app or your PC
    serial port is locking up your app and causing the crash. Can you put
    a serial port analyzer in between your serial instrument and your PC
    to see what's going on when it crashes?
    9) Are you trying to read or write to the serial port in more than one
    thread or while loop or dynamically launched vi? If you are you MUST
    protect the serial port access with a semaphore or a VISA resource
    lock. You CANNOT use a boolean global to protect access. Regular
    globals aren't atomic and you can have race conditions that result in
    unintended serial port collisions between differen threads. I have
    seen this lock up multi-threaded serial programs before to the point
    of requiring rebooting.
    This problem can be especially frustrating if you haven't done
    multi-threaded before. The port won't necessarily lock up right away
    or at the same time every time. You MUST make sure that serial port
    access is limited to ONLY ONE execution thread at a time.
    10) Is there another application or service running in the background
    with your application that may be trying to access the serial port or
    GPIB cards when you aren't expecting it? This could cause a collision
    that could crash your system as well.
    Douglas De Clue
    LabVIEW developer
    [email protected]
    Yan wrote in message news:<[email protected]>...
    > My VI is using DAQ6025e and GPIB cards, it is countiniusly writing
    > data to files and talking with 2 GPIB instruments and one Serial
    > instrument. Sudenly after 3 hours of perfect working it is crash my
    > computer.
    > Does any body know why ??? Help? S.O.S?

  • Can't run an executable file

    I am on a macbook pro, OSX 10.6.7, and whenever I try to run a name.command file, it says I don't have appropriate access privileges. I am the only admin.
    Also, it's a name.command if that helps.

    I just realized I said name.command twice...

  • I am getting errors that indicate the the licence has expired when running an executable file on another computer

    I am trying to run a compiled program as an exe on another computer. After several days it now comes up and indicates that the licence has expired.
    The code was compiled using labview 2009 sp1 and ran for several years until now. There is no other labview product on the computer.

    What makes you think that a license has expired?  NI provides LabVIEW Run-Time license for free.  The only licenses that may occur is some toolkits require a deployement license.  Some of these tool kits are things like DSC, Vision, and ECU Measurement just to name a few.  It doesn't sound like this is the issue if it was running for years so I don't know what could have happened.  It would help if you showed a screen shot of the license expired dialog, or even the license manager to show what things are installed and what aren't.
    Has the PC had any changes since the issue?  Changing network devices like adding a wireless card, or changeing ethernet devices can cause the PC ID to change, and then the license will need to be reactivated.  This can be done again through the license manager but without more information like what actually happening, I can only guess.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • I have downloaded a new version of Firefox, but can't figure out how to install it. I see the folder with Firefox application in it -- & have tried to run the executable files, but none of them start the installation.

    I have a 3.6.23 Version of Firefox & am trying to upgrade to the latest version

    Hi,
    There's information on that here: [[Installing Firefox on Linux|Installing Firefox on Linux]]
    Jack

  • Error while running executable file through java in WinNT

    I would like to run an executable file with Java.
    - If I try with notepad or paint, i.e. Windows Applications,
      I have no problem.
    - I also can run Non-Windows-Own Applications, except one.
      I get an error message, if I want to run this program through Java.
    I have tried following commands to run an executable file.
    Runtime.getRuntime().exec("cmd.exe /c "+command);
    Runtime.getRuntime().exec("cmd.exe /c start "+command);
    Runtime.getRuntime().exec("cmd.exe /c start /wait "+command);
    Runtime.getRuntime().exec("cmd.exe /k start "+command);
    command : the path to the executable file
    I can run the application directly, if I click the icon on desktop,
    but not through Java.
    here is the error message I get
    screenshot : http://www.aykut.de/error_message.jpg
    Text : "Security Check failure"
            The Logon System has been tampered with.
            The Administrator will need to re-install.
    my Idea :
    The application is "old".
    I think it was written for Win 3.1.
    Therefore I don't know if there is any other
    possibilty to run a "DOS Exe File" through Java.

    I have just figured out how it works,
    if somebody else here in forum have this problem,
    here is the solution :
    String path = "F:\...\...\Application.exe";
    String envDir = path.substring(0, path.lastIndexOf("\\"));
    String[] command = {"cmd.exe", "/c", "start", "/wait", "/D"+envDir, path};
    Process process = Runtime.getRuntime().exec(command);
    "start /Dpath" => path: environment directory F:\...\...\
    "start /wait" => wait until Application.exe terminates
    if you use Win95 or Win98 use command.com instead of cmd.exe
    Aykut

  • Can't run executable file by LV7.1

    Dear all,
    I am surprised I can't build and run executable file by LV7.1.
    I used to write some vi with LV7.1, and built the executable file according to these vi. It was no problem to build and run this executable file that time. Now I can open these vi well with LV7.1, bu I can't run this executable file well, it will prompt a error, please refer to the attachment. I try to build a executable file according to a simple vi, and then I can't run this exe file well any more.
    Can you help me to solve this problem? Thank you in advance.
    Evan
    Solved!
    Go to Solution.
    Attachments:
    Error prompt.jpg ‏2305 KB

    @Christian: That's not correct.
    One reason for this to happen is if LV 7.1.1 is installed and then you install an application including run-time engine built in 7.1. This corrupts the run-time engine.
    See here: http://digital.ni.com/public.nsf/allkb/680E61A4D02158A186256F7A0073C228
    Daniel

  • Can't run executable file

    Hello,
    I'm using a PowerBook G4 with OS 10.3.9. I want to run an executable file. However, whenever I attempt this, I'm denied permission to do so. I'm the administrator. I've reset the permissions on the file I'm trying to run, on Terminal itself and wherever else I can think of. What else do I need to do?

    In addition, if it is a name.exe, see my FAQ*:
    http://www.macmaps.com/macosxnative.html#WINTEL
    - * Links to my pages may give me compensation.

  • Java Applets and Executing Files

    Hi I have written an applet that pops up when accessing a URL. I am trying to run an executable file from a button press in the applet. The executable is stored localy on my machine but I can not seem to acceess the executable.
    Any Ideas??
    Cheers JJ

    http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Robot.html

  • How to run an executable from command-line

    I'm learning how to use the Terminal and I got stuck in a silly thing (I suppose it is). How can I run an executable file from command-line in Terminal?
    For example: I have a file named "Hello" in the folder /sample. If I use the ls command (ls sample), I can see the file Hello. Then I move to the directory (cd /sample) and try to run the file Hello (typing "Hello") but I got "command not found" message.
    If I drag the Hello file from Finder to Terminal and hit Return, it runs perfectly. And if I type the full path to the file (even if I'm already inside its directory), it also runs.
    So, my doubt is if there is any command to run an executable from command-line.
    Thanks

    KJK555 wrote:
    Hi VK:
    Can you enlighten me on why it's neccessary to do the "./" thingy in OS X when in unix/linux
    I never had to resort to doing that?
    Kj
    I took the trouble of reading *man bash* and it explains the issue. to add the current directory to PATH you need to add an empty path to PATH like this
    PATH=$PATH::
    you can add it to ~/.bash_profile so that it's executed automatically when you start bash. I suspect the linux system you are talking about had this set up by default or had it added to PATH in /etc/profile which defines PATH globally.

  • Can't install executable files downloaded in Firefox

    I just got a new computer with Windows 7 (32 bit) and downloaded the most recent version of Firefox. I downloaded a couple of free applications to install (an FTP client and a printer driver). When I try to run the executable file, I get an error that says "Program to big to fit in memory". I have 4 gb of ram on this machine, so I am not sure that this error is representative of what is happening. Interestingly though, if I download the exact file in IE, the executable launches and installs without any problems. Any ideas as to what to do and why this is happening?
    == I got my new machine last week ==
    == User Agent ==
    Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9 (.NET CLR 3.5.30729)

    I want to update what I originally wrote. We have now been able to isolate the problem to .exe or .zip files downloaded through Firefox onto the network server (which is 64 bit). If I download the file to my desktop (32 bit), I can launch the files. Since I work in a small office, I typically download a file to the server so that it can be installed on all of the workstations. This now doesn't work. But, if I download the same file through IE to the network server, the program launches fine.

Maybe you are looking for