A Java program that runs automatically at a given time of day

Okay Iam at the ending stages of a Java Assignment that is a MySql database, Hibernate for Mapping with a Java Server Faces front-end. All I need to do now is send emails at set time every week. Normally I know what to search for but frankly Iam stumped. Iam really just looking for a starting point for something that can run a Java Program at a set time of the week. PS my OS is Ubuntu if that is relevant but I was hoping for something that isn't platform specific so that it is portable.
Cheers in advance.

You can use the possibilities of your operating system, in this case Ubuntu.
Just drop a shell script that runs your java program in the /etc/cron.weekly directory.
--janeiros                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Java thread that start executing everyday on given time

    Hello
    I need to write an java file using thread
    that can start executing everyday on given time say everyday 14:00.
    Can any one have any example..?

    If on a Windows platform, you could run your Java class via a [Task Scheduler|http://support.microsoft.com/kb/308569].

  • Could someone please write a download manager program that allows me to set what time of day downloads can be scheduled.?

    I have a iMac, iPhone & iPad. I am using "Hughes Satilite Internet". We have a very limited download of 425MB. But between 1:am till 5:am I can download freely any amount. Some updates have been well over 1 gig & combination of different updates have been more. Also iCloud syncs with all devises. I would like a program on Apple products that allow me to specify a time to download updates & iCloud syncing, to allow me to schedule updates & music downloads at specific times. This is a needed program for all Apple products. It needs to be built in to the iOS.
    Thank you,
    Glenn

    This is an enhancement of the OS, we are just users and have no influence on that, send your feedback here:
    http://www.apple.com/feedback/

  • I have a program that runs in Java Console. I need to run multiple copies of the program. I can't do this with tabs. Can I do it with separate windows/processes

    The program in question was implemented as a Java applet that runs in a browser. The developer says it must run under the Java Console and that I cannot run more than one copy of it in a given browser technology (e.g., Firefox); but I can run multiple copies if I use, eg, Firefox for one, IE 32 bit for another, Chrome for a 3rd and IE 64 bit for a 4th. I have tested this, and this does work.
    Why would it not be the case if I spawned a completely different Firefox instance/process? When asked this question, the developer said, no, you have to run a different browser implementation to get a distinct Java Console for each one.
    Does this make sense in general, or, more importantly, is it true for Firefox?
    Thanks,
    Dennis

    It is working for me if I open a second Firefox instance with its own profile by starting Firefox with the -no-remote command line switch.
    * http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
    * http://kb.mozillazine.org/Shortcut_to_a_specific_profile
    * http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox
    * http://kb.mozillazine.org/Bypassing_the_Profile_Manager
    Use the -no-remote command line switch to open another Firefox instance with its own profile and to run different Firefox instances simultaneously.
    * http://kb.mozillazine.org/Opening_a_new_instance_of_Firefox_with_another_profile

  • Can a java program be run in the background?

    Hi all,
    Can a java program be run in the background without the user being aware of it? I need to make a program that continuosly monitors a pc at regular intervals and runs at all time. It should be hidden(shouldn't display on the screen while running) from the user, and also, can it be run as a system file so that even if a user checks he/she would think of it as a system file?

    I'm the administrator of all the computers. Then as I said there are commercial applications that do that.
    Presumably you expect a problem now. And implementing an acceptable solution is going to take you months. Because not only need to 'hide' the application, you also need to set up all the monitoring and logging capability. And the first will require quite a bit of JNI work along with testing (in particular as it could interfer with existing applications on the users computers.)
    I need to
    install the software in all the machines and i want
    that the users who use the machine should not be able
    to close the program through the task manager. If the users have admin rights then they can terminate a windows service.
    And if they don't have admin rights then you can simply turn off the ability to install anything.
    I want
    to know what the resources of the computers are and
    that if anyone has added a resource to it or
    not(attaching a flash usb thumbdrive etc). Lots of JNI.

  • Java Program Not Running

    Hi,
    I have a small Java program that imports Oracle.sql.* and Oracle.jdbc.*.
    It establishes a default connection and converts a String[ ] to Oracle.sql.ARRAY type.
    As per Oracle documentation, I have added paths of required .zip files in CLASSPATH variable.
    Though I am able to compile the code, but when I try to run it thru java, it gives me error:
    Exception in Thread "main" java.lang.NoClassDefFoundError: TestInstallJDBC
    The .java and .class files are in current directory and I'm using
    java TestInstallJDBC.
    What can be the problem?
    Any help is appreciated.
    Thanks

    Ah, I re-read your first post - you said you added paths to the Classpath. So you need to add . to your Classpath as well. For Windows .;<existing_classpath> or for Unix .:<existing_classpath>

  • Java program that create a graphic interface of the WGET program

    Hello,
    How can I make a Java program that create a graphic interface of the WGET program.
    Please post something already developed.
    No Applet.
    Thank you.

    You can use java.lang.Runtime.exec or java.lang.ProcessBuilder to execute external programs like wget. Generally you pass one of those methods an array of Strings; the first String is the name of the executable, and the rest are arguments. You get a Process object that represents the running process that you've started; you can get standard input and output streams from that Process to read output. This is probably stuff your teacher already told you...but if not, hope it helps.
    You should read this article about pitfalls around Runtime.exec:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    Much of the information there also applies to ProcessBuilder.
    Good luck on your homework.

  • Java program stopped running when using JVMPI

    Hi!
    I'm writting a very simple profiler using JVMPI. I intended to pause/continue it by sending signal, like kill -SIGUSR2 PID, to it, but whenever I did this, the java program that ran with the profiler stopped running, however the profiler kept running properly.
    Here's the code of the simple profiler and the testing java program.
    //myprofiler.cc
    #include <jvmpi.h>
    #include <pthread.h>
    #include <stdio.h>
    #include <signal.h>
    void sig_handler_pause(int);
    static JVMPI_Interface *jvmpi_interface;
    void notifyEvent(JVMPI_Event *event) {
    switch(event->event_type) {
    case JVMPI_EVENT_CLASS_LOAD:
    fprintf(stderr, "myprofiler> Class Load : %s\n", event->u.class_load.class_name);
    break;
    case JVMPI_EVENT_OBJECT_ALLOC:
    fprintf(stderr, "myprofiler>object alloc \n");
    break;
    extern "C" {
    JNIEXPORT jint JNICALL JVM_OnLoad(JavaVM jvm, char options, void *reserved) {
    fprintf(stderr, "myprofiler> initializing ..... \n");
    // get jvmpi interface pointer
    if ((jvm->GetEnv((void **)&jvmpi_interface, JVMPI_VERSION_1)) < 0) {
    fprintf(stderr, "myprofiler> error in obtaining jvmpi interface pointer\n");
    return JNI_ERR;
    // initialize jvmpi interface
    jvmpi_interface->NotifyEvent = notifyEvent;
    // enabling class load event notification
    jvmpi_interface->EnableEvent(JVMPI_EVENT_CLASS_LOAD, NULL);
    fprintf(stderr, "myprofiler> .... ok \n\n");
    signal(SIGUSR2,sig_handler_pause);
    return JNI_OK;
    void start(){
              fprintf(stderr,"start...\n");
         jvmpi_interface->EnableEvent(JVMPI_EVENT_OBJECT_ALLOC, NULL);
    jvmpi_interface->EnableEvent(JVMPI_EVENT_CLASS_LOAD,NULL);
    void pause(){
              fprintf(stderr,"pause...\n");
              jvmpi_interface->DisableEvent(JVMPI_EVENT_OBJECT_ALLOC, NULL);
    jvmpi_interface->DisableEvent(JVMPI_EVENT_CLASS_LOAD,NULL);
    int status=0;
    void sig_handler_pause(int sig){
         if(status == 0){
              start();
              status = 1;
         else if(status == 1){
              pause();
              status = 0;
    //Test.java
    public class Test {
    public static void main(String[] args) {
         try {
                        int i = 0;
    while(true)
                             Thread.sleep(1000);
                        System.out.println(i++);
              catch (Exception e) {
                        e.printStackTrace();
    Here're some notes:
    1)If I didn't call
    jvmpi_interface->EnableEvent(JVMPI_EVENT_OBJECT_ALLOC, NULL);
    in "start()" function, the java program Test ran properly after I sent signal to the process by using kill command in an command line;
    or
    2) If I delete "Thread.sleep(1000)" in Test.java, then whether I call
    jvmpi_interface->EnableEvent(JVMPI_EVENT_OBJECT_ALLOC, NULL);
    in "start()" or not, the Test program ran properly after I sent signal to the process.
    It seems to be a thread dead lock, but I'm not sure. Can any body help?Thanks very much.

    I should strongly recommend moving from JVMPI to JVM TI if you can. The reason is that JVMPI has been deprecated since 5.0 and can not be used with Java SE 6 and newer.
    Anyway, the issue you have may be due to the signal you are using. I'm not sure which operating system this is but on Linux the USR2 signal is used for the suspend/resume implementation. Have you looked at the Troubleshooting Guide or the Signal Chaining page for details on how signals are used and how to chain handlers? Another idea is to remove the signal handling code implementation and to use the data dump event. This is supported by both JVMPI and JVM TI so that you get an event (via the QUIT signal).

  • HT4410 If I install Windows 7 on my MacBook Pro using Bootcamp, now having 2 start up drives, do I select the Windows drive, then I can install a software program that runs only on a PC?

    If I install Windows 7 on my MacBook Pro using Bootcamp, now having 2 start up drives, do I select the Windows drive, then I can install a software program that runs only on a PC?

    Thank you

  • How to make a Java program that recognises a function of two variables...

    How to make a Java program that recognises a function of two variables to assign values to that?
    First I will give an example and then do the question.
    Ex1.
    We have any function, eg.y = x ^ 2 + 1 (read 'y' equals 'x' high to the square), a function of the second degree.
    To build the graph of this function attach values to 'x' to find the values of 'y'
    And thus mount the pair ordered (x, y) which represents a point on the Cartesian plane.
    Assigning values to 'x' 'we can build up a table that gives us the pairs ordered:
    We can use any numbers, but arfer interval [-3.3]
    X | y = x ^ 2 + 1
    -3 | Y = (-3) ^ 2 +1 = 10
    -2 | Y = (-2) ^ 2 +1 = 5
    -1 | Y = (-1) ^ 2 +1 = 2
    0 | y = (0) ^ 2 +1 = 1
    1 | y = (1) ^ 2 +1 = 2
    2 | y = (2) ^ 2 +1 = 5
    3 | y = (3) ^ 2 +1 = 10
    We then ordered the pairs:
    (-3.10), (-2.5); (-1.2), (0,1), (1,2), (2,5), (3,10)
    Tabem that can be represented by a table:
    X | y
    -3 | Y = 10
    -2 | Y = 5
    -1 | Y = 2
    0 | y = 1
    1 | y = 2
    2 | y = 5
    3 | y = 10
    Now I begin to explain my doubts.
    See this program:
    Ex2
    * To change this template, choose Tools | Templates
    * And open the template in the editor.
    Encontrando_o_valor_de_y package;
    * @ Author des Soldat Gottes
    Import javax.swing.JOptionPane;
    Public class (Main
    * @ Param args the command line arguments
    Public static void main (String [] args) (
    Int x, y;
    String x1;
    X1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',"); / / receives a value for the function y = x + 1
    X = Integer.parseInt (x1); / / tranforma String in int
    Y = x + 1; / / receives the value of 'x' and calculates' y '
    JOptionPane.showMessageDialog (null, "The value of 'y' is: \ t \ t" + y);
    / / Displays the value of 'y'
    System.exit (0);
    We see that the program receives above a value for 'x' and replaces the function contained in the program, y = x + 1, and so is the value of the variable 'y'.
    In: x1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',");
    The entry is a number and that number is assigned aa ja existing function in the (y = x + 1).
    The question is: would it be possible to come to a function?
    Ex: the program ask: DIGITE THE FUNCTION?
    The USUARIO DIGITARIA A FUNCTION ANY, TYPE: y = x ^ 2 +1
    The program would recognize the function and give numerical values to that function as Ex1, at the beginning of this text.
    And then to find the values of the x and y launch a table.
    It would be possible that?
    By invez of entering with a number so that the program sustitua a function ja existing as Ex2, seen above, entering with a function quaquer (type: y = x ^ 2 +1) for the program atribuisse values to that function and then create a table of values as Ex1.
    I hope it has been easier to understand my doubts now.
    Thank you for your attention!
    God bless!

    rafaelmenezes wrote:
    Thanks for the explanation, could understand what fly said.
    But as it applied to a program?
    How to create a program that recognizes that the entry coefficients?Are you asking about how to parse out the coefficients from the string "3x^4 + 4x^3 - 8x^2 + 5x^1 + 2x^0"? If you define the format to strictly follow that example, this should get you started:
    Strip out the spaces
    Split the String on "x^"
    That should give you [3, 4+4, 3-8, 2+5, 1+2, 0]
    Split each resulting String on "+ | -", preserving the operator as a token so you can apply the correct sign to the coeff.
    That should leave you with [3, 4, +, 4, 3, -, 8, 2, +, 5, 1, +, 2, 0]. Every other number is a coeff, the rest are the degrees.
    You can strip out the +, since those coeffs are already positive, and strip out the - after negating the following number. This is all assuming that you have to write this yourself. There is no doubt already a library or 5 out there that does this for you.

  • Creating java program that orders 3 numbers in ascending order using if els

    Does anyone know what code to use for creating a java program that uses the if else operators to order 3 variables in ascending order?

    nar0122 wrote:
    correct on the homework assumption...you have a good nose...the thing is...i know i need to make an if statement saying if a is less than b, and a is less than c...print a first...but how do i get it to "print a" first? if a is less than c and b...and so on for b and c? sorry if that was confusing...
    int a = ..., b = ..., c = ...;
    if(a > b AND a > c) {
      print a
      if(b > c) {
        print b, print c
      } else {
        print c, print b
    etc.

  • I want to write a java program that can add a user to a role or sub role to the Profile Database in iPlanet Portal Server 3.0. Does anyone has any idea or a sample program do such thing. Thanks, Tommy

    I want to write a java program that can add a user to a role or sub role to the Profile Database in iPlanet Portal Server 3.0. Does anyone has any idea or a sample program do such thing? Thanks, Tommy

    // create the user profile, get the handle back,
    // and set the membership profile attributes.
    ProfileAdmin newProfile = null;
    try {
    // the users profile name is the domain      
    // he belongs to plus their userName
    // you will request.domain if your doing this from a servlet, domain_name is the domain_name the user belongs too
    String profileName = domain_name + "/" + user;
         if (debug.messageEnabled()) {
    debug.message("creating profile for " + profileName);
    // create the user profile object
    newProfile = ProfileManager.createProfile(
    getSession(), profileName ,Profile.USER);
    UserProfile userProfile = (UserProfile)newProfile;
         // set the role the user is a member of. Default is to set
         // the users to the default role of the domain they surfed to
         StringBuffer roleName = new StringBuffer(64);
    // request.domain instead of domain_name if your doing this from a servlet ..
    Profile dp = getDomainProfile(domain_name);
    roleName.append(dp.getAttributeString("iwtAuth-defaultRole"));
         if (debug.messageEnabled()) {
    debug.message("setting role for " + user + " = " + roleName);
    userProfile.setRole(roleName.toString());
    newProfile.store(false);
    } catch (ProfileException pe) {
         debug.error("profile exception occured: ",pe);
    return;
    } catch (ProfileException pe) {
         debug.error("login exception occured: ",le);
    return;
    HTH ..

  • Writing java program that uses UMTS service

    Hi
    I wonder if it is possible to write java programs that use UMTS services. Is there any class-package in java related with UMTS services?

    you can call a batch file using NT service. the batch file executes the java program. and you can also send an email thru that java program.

  • How to find that a java program is running for the first time on daily basi

    it is like this
    1. i will ran a java program every day and i have to find that it is running for the first time(as i may stop that program and may run again the same day )
    Pls share ur ideas

    san.kumar wrote:
    it is like this
    1. i will ran a java program every day and i have to find that it is running for the first time(as i may stop that program and may run again the same day )
    Pls share ur ideasAs kajbj said - you need to store a token / file with a run date on the file system. Each time the application runs, have it compare with the date from this file with the current date. If different, it's the first run of the day. If not, it is not the first run of the day. Each time have it update the date on the file.

  • Java program to run a C compiled file in SHELL unix

    hi,
    i have two queries,
    1) i have a c program which i compile to get a new file,{a exe file i suppose}, i need to execute it for 2000 times. for that i need to write a java program which can run the file in SHELL unix.
    can you suggest me how to write,
    2) also my file name starts with 0001.mnp to 1989.mnp, how to get 0001 as a number and during increment it should generate as 0002 ..0038 and so on. till 1989.
    the above java program which am goin to write should just take file 0001.mnp and convert it into 0001.bns,
    and get incremented automatically till the file 1989.

    hi,
    i have two queries,
    1) i have a c program which i compile to get a new
    file,{a exe file i suppose}, i need to execute it for
    2000 times. for that i need to write a java program
    which can run the file in SHELL unix.
    can you suggest me how to write,Read this: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    However, you could do this all in a shell script.
    >
    2) also my file name starts with 0001.mnp to
    1989.mnp, how to get 0001 as a number and during
    increment it should generate as 0002 ..0038 and so
    on. till 1989.
    the above java program which am goin to write should
    just take file 0001.mnp and convert it into
    0001.bns,
    and get incremented automatically till the file 1989.A loop? What are you having difficulty with?
    Again, this could all be done in a shell script.

Maybe you are looking for

  • Rejection of PO item with reason 06 - IDoc failure

    Hi, There is an IDoc failure with message: Rejection of PO item with reason 06. The user(supplier) wants to reject first line item of the Subcontracting PO and add a new line item instead with the right data. Please suggest. Regards, Akash Prekar

  • BO Enterprise 3.1 SR3 Installation with existing MS SQL database

    HI Gurus, I'm completely new to Business Objects and have been reviewing the installation & planning guides for the installation. I'm hoping to use an existing MS SQL 2008 database as the location for the CMS / Audit. The guides don't really explain

  • Re: Internal Order

    Dear Sap Experts, We created as one Internal order, after that we are comparing the values in T.Code MB51(Material document List)Here in T.code selecting criteria Order,Posting date and executing then I compared with internal order posting valued & M

  • Adding Two more Wireless bridges - Etherchannel

    Two facilites are connected via wireless bridge(AIR-BR1410A-E-K9). we wanted to add wireless bridge at each facility to increase the bandwidth. So we will have two wireless bridge at each facility connected wirelessly. and we wanted to achieve it by

  • Want to share Adobe Digital Editions 3.0 (ADE) on home network

    Hello, I have two computers running windows 7 home premium and windows 8.1 respectively.  I have ADE on the W7 computer and would like to share with W8.1 computer.  Both computers are in a HomeGroup.  W8.1 sees the W7 desktop, but not ADE.  How to sh