How to issue an OS command?

Hello,
Does anyone know if there is a way to issue an OS command from within an application made in Application Express? Actually, I need to start an outside application, but even just issuing an OS command would be a start.
Best regards,
Milos

Re: execute OS command

Similar Messages

  • How to set role which can issue only one command

    I am thinking about setting role, which will be allowed to issue olny one command. I have created role test. Which has the following entries in the following files:
    /etc/user_attr
    test::::profiles=OneCommand;type=role
    /etc/security/exec_attr
    OneCommand:solaris:cmd:::/tmp/data.sh:euid=0
    After this I sill could issue all comands, not only test command /tmp/data.sh.
    When I issued comand profiles on test role I received the following:
    bash-3.00$ profiles test
    OneCommand
    Basic Solaris User
    All
    So I commented line in the /etc/policy.conf to read:
    #PROFS_GRANTED=Basic Solaris User
    After that, when I try to issue /tmp/data.sh command as a test role I receive the following error:
    $ /tmp/data.sh
    pfexec: Exec format error
    Does anybody know how to set up the role which can issue only one command ? Maybe there is a way to do this in the way which wil not affect another roles (ie, not to touch /etc/policy.conf).
    Best regards

    RadekW wrote:
    I am thinking about setting role, which will be allowed to issue olny one command. I have created role test. Which has the following entries in the following files:They will need the ability to run at least a profile shell otherwise all bets are off. So now you're down to two commands. :-)
    bash-3.00$ profiles test
    OneCommand
    Basic Solaris User
    AllFirst you need to define what already exists by default. (policy.conf)
    Then you get to change those defaults or create a new default list just for test.
    Then you get to add a role or profile for test that allows the execution of a profile shell and one command.
    Then you should test all of the user accounts to ensure that something didn't break. This step might be a little overkill.
    alan

  • How to issue iCommand Commands in code?

    I understand how to bind iCommand commands to UI elements.
    I would like to know how to issue Commands in C# code.
    I need to do this so that I can issue commands in the Click event code behind for UI elements that don't support commands, such as App Bar Buttons.
    Any examples would be greatly appreciated.
    Thanks!

    Your example would work, except that I don't have a button on my page to reference. I want the code behind for an AppBarButton, which does not support the "Command" parameter, to be able to raise/issue/fire (proper term?) a command.
    I could put a hidden button on the page and then reference it's Command, but that just seems like a really ugly way to do it.
    Any suggestions?
    Hi Pfredd,
    >>I want the code behind for an AppBarButton, which does not support the "Command" parameter, to be able to raise/issue/fire (proper term?) a command.
    Generally, this will break MVVM pattern if you want to invoke Command from code behind, I would suggest you customizing AppBarButton like this and set Command binding:
    <AppBarButton x:Name="WeekButton" Label="SomeText" >
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
    <Button Command="{Binding OkCommand}" >
    </Button>
    </StackPanel>
    </AppBarButton>
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to issue commands c shell

    hi buddy.....
    i need help again.....
    how to issue commands c shell in Linux(Ubuntu 9.10) for example:
    *% source ./.login*

    how to issue commands c shell in Linux(Ubuntu 9.10) for example:by default C shell is not included in Ubuntu (see below)
    bcm@bcm-laptop:~$ csh
    The program 'csh' can be found in the following packages:
    * csh
    * tcsh
    Try: sudo apt-get install <selected package>
    csh: command not found
    bcm@bcm-laptop:~$ uname -a
    Linux bcm-laptop 2.6.31-19-generic #56-Ubuntu SMP Thu Jan 28 01:26:53 UTC 2010 i686 GNU/Linuxpost results of following commands
    env | sort

  • When I use the shortcut to open a new window in safari (command N), I get a 404 error message from Google. How do I change where 'Command N' routes to?

    When I use the shortcut to open a new window in safari (command N) on my Macbook Pro, I get a 404 error message from Google. How do I change where 'Command N' routes to? 

    It's not necessary to change the Command N keystroke..
    From your Safari menu bar click Safari > Preferences then select the Privacy tab.
    Click:   Remove All Website Data
    Then delete the cache.
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.
    If that didn't help, troubleshoot Safari extensions.
    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test.
    If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.

  • How to access GSM AT Commands in J2ME?

    My aim is to check the signal strength of the GSM modem in any mobile(Nokia/sony). We have AT commands for the same 'AT+CSQ' which will give you the signal strength.
    Did any one knows how to send this AT command and get the responce in J2ME application.

    Not possible on most devices.

  • How to execute a shell command in java?

    here, my environment is redhat 7, jdk 1.5.
    i don't know how to use the shell command in java.
    i want to use this function:
    #include <stdlib.h>
    int system(const char * string);
    please give me some ideas. and Thank you so much if coming with a little demo.

    i know i should use JNI. because i have to use C lib.
    but i have already use JNI to wrapper the original code the cpp code and java code is :
    //: appendixb:UseObjImpl.cpp
    //# Tested with VC++ & BC++. Include path must
    //# be adjusted to find the JNI headers. See
    //# the makefile for this chapter (in the
    //# downloadable source code) for an example.
    #include <jni.h>
    #include <stdlib.h>
    extern "C" JNIEXPORT void JNICALL
    Java_UseObjects_changeObject(
    JNIEnv* env, jobject, jobject obj) {
    jclass cls = env->GetObjectClass(obj);
    jfieldID fid = env->GetFieldID(
    cls, "aValue", "I");
    jmethodID mid = env->GetMethodID(
    cls, "divByTwo", "()V");
    int value = env->GetIntField(obj, fid);
    printf("Native: %d\n", value);
    env->SetIntField(obj, fid, 6);
    env->CallVoidMethod(obj, mid);
    value = env->GetIntField(obj, fid);
    system("preprocess -path sha.c");
    printf("Native: %d\n", value);
    } ///:~
    //: appendixb:UseObjects.java
    // From 'Thinking in Java, 2nd ed.' by Bruce Eckel
    // www.BruceEckel.com. See copyright notice in CopyRight.txt.
    class MyJavaClass {
    public int aValue;
    public void divByTwo() { aValue /= 2; }
    public class UseObjects {
    private native void
    changeObject(MyJavaClass obj);
    static {
    // System.loadLibrary("UseObjImpl");
    // Linux hack, if you can't get your library
    // path set in your environment:
    System.load(
    "/root/jproj/UseObjImpl.so");
    public static void main(String[] args) {
    UseObjects app = new UseObjects();
    MyJavaClass anObj = new MyJavaClass();
    anObj.aValue = 2;
    app.changeObject(anObj);
    System.out.println("Java: " + anObj.aValue);
    } ///:~
    i modify this two file which is from TIJ-2edition.
    the output is
    Native: 2
    Native: 3
    Java: 3
    but what i want to be executed "preprocess -path sha.c" does not work.
    i have change the command to, such as "df", "ls" etc. but none of them works
    please help me.

  • How do I use the commands to start and restart the jmqbroker normally?

    How do I use the commands to start and restart the jmqbroker normally?
    Because I have tried to use "jmqcmd shutdown bkr" and then tried to type
    "jmqbroker" to start up. My screen hangs up and seems that the process
    hangs up. The message is
    [28/Jun/2002:18:29:07 GMT+08:00] [B1060]: Loading persistent data...
    [28/Jun/2002:18:29:08 GMT+08:00] [B1039]: Broker "jmqbroker" ready.
    The prompt is hanged until I press CTRL-C.
    Then I got the following message:
    [28/Jun/2002:18:32:07 GMT+08:00] [B1047]: Shutting down broker...
    [28/Jun/2002:18:32:07 GMT+08:00] [B1077]: Broadcast good-bye to all
    connections ....
    [28/Jun/2002:18:32:07 GMT+08:00] [B1078] Flushing good-bye messages
    [28/Jun/2002:18:32:07 GMT+08:00] [B1056] Cleaning up persistent
    store...
    [28/Jun/2002:18:32:07 GMT+08:00] proceessing 0 messages and cleaning
    up 0 files...
    [28/Jun/2002:18:32:07 GMT+08:00] [B1063] Done
    [28/Jun/2002:18:32:07 GMT+08:00] [B1048]: Shutdown of broker complete.
    Then, I use jmqadmin to invoke the console, I can start the broker
    again, it gives me
    Error encountered while connecting to the broker: "MyBroker":
    Broker Host: 'localhost'
    Primary Port: '7676'
    [C4003]: Error occurred on connection creation, - caught
    javax.jms.JMSException
    Please verify that there is a broker running on the specified host and
    port.
    I used ps -def | grep jmq there is no process anymore.
    Is it a bug? Would somebody have any idea on what went wrong?

    'jmqbroker' is the command to start a broker.
    When you type 'jmqbroker' in a command window,
    unless you put it in the background, the shell
    prompt won't return until the broker is shutdown.
    So when you see 'Broker "jmqbroker" ready.', it tells
    you that the broker is running and is ready.
    When you CTRL-C the process, it has the same effect
    as using jmqcmd to shutdown the broker. And so after that,
    there's no jmq processes running since you have just
    shutdown the broker.
    Remember that the jmqcmd/jmqadmin 'restart' command is to
    restart an already running broker. jmcmd/jmqadmin does
    not support starting a new broker instance.
    If you are using csh, end the jmqcmd command with an ampersand ("&")
    to have the broker running in the background. An alternative is to
    stop the process with Ctrl-Z then input the command "bg" to have that
    process resumed in the background.
    The problem with not being able to start a broker using the
    administration console is a documented limitation of the product that
    Yvonne also mentioned. Check the Administrator's Guide for that.

  • How to set SAXParser at command-line interface to create a large XML file

    Hi,
    I am trying to create a large XML file (more than 50 MB) by selecting from Oracle database but failed because of "out of memory" error. According to "Oracle XML Developer Guide", we should use SAXParser to parsing a large XML file. But there is no example to show how to set SAXParser at command-line
    Following is what I use to get xml files. It works only when the file is small.
    java OracleXML getXML -DateFormat -withDTD -rowsetTag PO_HDR -conn
    "jdbc:oracle:oci8:@server_name" -user "ID/password" "select * from table_name"
    When I set SAXParser at the way below,
    java oracle.xml.parser.v2.SAXParser OracleXML getXML -DateFormat -withDTD -rowsetTag PO_HDR -conn
    "jdbc:oracle:oci8:@server_name" -user "ID/password" "select * from table_name"
    it failed with the error message: "In class oracle.xml.parser.v2.SAXParser: void main(String argv[]) is not defined"
    Does anyone know how to solve the problem? I'll be appreciated very much for your help.
    Yi

    here are my ideas.
    register the xml schema.
    using xmldom, generate the desired xml output and return as xmltype.
    then you can use something like this to check.
    declare
    xmldoc xmltype ;
    begin
       -- populate xmldoc from you xmldom function
       -- validate against XML schema
       xmldoc.isSchemaValid(schema_url, root_element);
       if xmldoc.isSchemaValid = 1 then
            --valid schema
       else
            --invalid
       end if;
    end

  • How to call Operating System commands / external programs from within APEX

    Hi,
    Can someone please suggest how to call Operating Systems commands / external programs from within APEX?
    E.g. say I need to run a SQL script on a particular database. SQL script, database name, userid & password everything is available in a table in Oracle. I want to build a utility in APEX where by when I click a button APEX should run the following
    c:\oracle\bin\sqlplusw.exe userud/password@database @script_name.sql
    Any pointers will be greatly appreciated.
    Thanks & Regards,

    Hi Guys,
    I have reviewed the option of using scheduler and javascript and they do satisfy my requirements PARTIALLY. Any calls to operating system commands through these features will be made on the server where APEX is installed.
    However, here what I am looking at is to call operating systems programs on client machine. For example in my APEX application I have constructed the following strings of commands that needs to be run to execute a change request.
    sqlplusw.exe user/password@database @script1.sql
    sqlplusw.exe user/password@database @script2.sql
    sqlplusw.exe user/password@database @script3.sql
    sqlplusw.exe user/password@database @script4.sql
    What I want is to have a button/link on the APEX screen along with these lines so that when I click that link/button this entire line of command gets executed in the same way it would get executed if I copy and paste this command in the command window of windows.
    Believe me, if I am able to achieve what I intend to do, it is going to save a lot of our DBAs time and effort.
    Any help will be greatly appreciated.
    Thanks & Regards,

  • How to use ls-l command in SAP ??

    Hi,
    can any one suggest how to use ls-l command of unix in sap to get the details of file like creation date,etc.
    Thanks.

    Hi Krishna.
    These are the steps you need to follow.
    tables: specify the table.
    data: begin of fs_...
            end of fs_    " Structure Field string.
    data: t_table like
            standard table
                      of fs_...
    data:
    w_file TYPE string.
    data:
      fname(10) VALUE '.\xyz.TXT'.
    select-options: if any.
    PARAMETERS:
      p_file LIKE rlgrap-filename.
    w_file = p_file.
    select .... statement
    OPEN DATASET fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    *OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
    LOOP AT t_... INTO fs_....
    write:/ .....
    TRANSFER fs_... TO fname.
    or
    TRANSFER t_... TO fname
    ENDLOOP.
    CLOSE DATASET fname.
    Reward points wisely and if you are benefitted or ask for more detailed explanation if problem not solved.
    Regards Harsh.

  • I am using a code based typesetting program (not WYSISYG) that outputs PDFs. I am producing 100 plus pages that have multiple graphics on each page. I need to know how to format a PDF command that I can incllude in my programming that will tag my graphics

    I am using a code based typesetting program (not WYSISYG) that outputs PDFs. I am producing 100 plus pages that have multiple graphics on each page. I need to know how to format a PDF command that I can incllude in my programming that will tag my graphics with "Alternative Text".
    I know that with a Microsoft product graphics can be tagged before a PDF is made. I need to know how to do this with my programming.

    The Acrobat SDK might be a starting point.
    From there, perhaps a plug-in (built with C+).
    Perhaps with a licensed release of a PDF Library (this could be $$).
    The viable and cost effective alternative is use the tried and true.
    Authoring in an appropriate authoring application with appropriate tag management.
    Example:  Adobe InDesign; Adobe FrameMaker or MS Word with PDFMaker (comes with install of Acrobat).
    This way you place "Alternative Text" when mastering content in the authoring file.
    Going the route and with some look-see (research) you may find programmatic approaches to placing the alt txt in the authoring file.
    Note: as discussed in the Matterhorn Protocols there is no programmatic method that provides a fully accessible PDF (specifically, that is an ISO 14289-1, PDF/UA-1 compliant PDF).
    Regardless, here you have a sub-forum for discussions on Acrobat usage.
    Consequently discussions on/of 3rd party software is rather out of scope eh.
    Be well...

  • How to use Net use command in SAP

    Dear All,
    Any one knows how to user Net use command in SAP to connect to other system  i have Created in SM69. when i am executing the program it is asking login Details of other system.
    Regards
    SNB

    Hi,
    What is the exact command you exceuting?
    Message was edited by:
            Pavel sheynkman

  • How to issue cash flow report?

    Hello everybody:
    Can anyone tell me what is the standard method for SAP to issue cash flow report? Is it Cash Budget Management?
    I am using SAP version 470.
    rgds!
    Andy.

    Could you give me more explanation on the logic of SAP how to issue cash flow report?
    Andy

  • SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first

    Hello, I was trying to send mails via GMail's smtp server (smtp.gmail.com) but the following exception occurred. I used port 25 (used 467 also, didnt work). Would anybody tell what the following exception mean. Thanx.
    com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command firstHere's my code:
    import javax.mail.*;
    import javax.mail.event.TransportListener;
    import javax.mail.event.TransportEvent;
    import javax.mail.internet.*;
    import java.util.Properties;
    import javax.activation.*;
    class MailSender {
         private String mailHost="smtp.gmail.com";
         private String body;
         private String myFile="F:\\DRacing.avi";
         private Properties props;
         private Session mailSession;
         private MimeMessage message;
         private InternetAddress sender;
         private Multipart mailBody;
         private MimeBodyPart mainBody;
         private MimeBodyPart mimeAttach;
         private DataSource fds;
         MailSender()
              //Creating a Session
              props=new Properties();
                        props.put("mail.transport.protocol", "smtp");
              props.put("mail.smtp.host", mailHost);
              props.put("mail.smtp.port", "25");
              props.put("mail.smtp.auth", "true");
              mailSession=Session.getDefaultInstance(props, new MyAuthenticator());
              //Constructing and Sending a Message
              try
                   //Starting a new Message
                   message=new MimeMessage(mailSession);
                   mailBody=new MimeMultipart();
                   //Setting the Sender and Recipients
                   sender=new InternetAddress("[email protected]", "Kayes");
                   message.setFrom(sender);
                   InternetAddress[] toList={new InternetAddress("[email protected]")};
                   message.setRecipients(Message.RecipientType.TO, toList);
                   //Setting the Subject and Headers
                   message.setSubject("My first JavaMail program");
                   //Setting the Message body
                   body="Hello!";
                   mainBody=new MimeBodyPart();
                   mainBody.setDataHandler(new DataHandler(body, "text/plain"));
                   mailBody.addBodyPart(mainBody);
                   //Adding a single attachment
                   fds=new FileDataSource(myFile);
                   mimeAttach=new MimeBodyPart();
                   mimeAttach.setDataHandler(new DataHandler(fds));
                   mimeAttach.setFileName(fds.getName());
                   mailBody.addBodyPart(mimeAttach);
                   message.setContent(mailBody);
                                  Transport.send(message);
              catch(java.io.UnsupportedEncodingException e)
                   System.out.println(e);
              catch(MessagingException e)
                   System.out.println(e);
              catch(IllegalStateException e)
                   System.out.println(e);
    public class TestMail01
         public static void main(String args[])
              new MailSender();
    class MyAuthenticator extends Authenticator
         MyAuthenticator()
              super();
         protected PasswordAuthentication getPasswordAuthentication()
              return new PasswordAuthentication("dider7", "MY_PASSWORD");
    }

    This is an application that sends a message but there is a problem the domain could not be resolved
    * Notifier.java
    * Created on March 23, 2006, 11:22 AM
    * To change this template, choose Tools | Options and locate the template under
    * the Source Creation and Management node. Right-click the template and choose
    * Open. You can then make changes to the template in the Source Editor.
    * @author Trainee
    import java.util.*;
    import java.sql.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    public class Notifier //throws MessagingException
    public static void main(String args[]) //throws Exception
    //SystemTray.getDefaultSystemTray().addTrayIcon(new TrayIcon(new ImageIcon("imagefilename")));
    // starts time getter
    NotifierThread NThread = new NotifierThread();
    Thread t = new Thread(NThread);
    t.start();
    //email module
    //EmailThread emailThread = new EmailThread();
    //emailThread.sendMessage();
    /*SimpleSender simple = new SimpleSender();
    simple.senderClassKo();*/
    //String[] arrayKo = { "[email protected]","def","xyz" };
    //String[] arrayKo = { "[email protected]","def","xyz" };
    //String recipients = "[email protected]";
    /*EmailThread EThread = new EmailThread();
    try
    // ( String recipients[ ], String subject, String message , String from)
    EThread.postMail( "[email protected]" , "NOTIFY", "ContractOverdue" , "[email protected]");
    System.out.println("ethread");
    catch(MessagingException me)
    me.printStackTrace();
    //DBConnection dbc = new DBConnection();
    //dbc.DBConnect();
    String host = "smtp.gmail.com";
    String from = "[email protected]";
    //String to = "[email protected]";
    String to = "[email protected]";
    // Get system properties
    Properties props = System.getProperties();
    // Setup mail server
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.starttls.enable", "true");
    props.put("mail.smtp.auth", "true");
    // Get session
    Authenticator auth = new MyAuthenticator();
    Session session = Session.getDefaultInstance(props, auth);
    // Define message
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    message.addRecipient(Message.RecipientType.TO,
    new InternetAddress(to));
    message.setSubject("Hello JavaMail");
    message.setText("Welcome to JavaMail");
    // Send message
    //com.sun.mail.smtp.SMTPSSLTransport.send(message);
    Transport.send(message);*/
    class DBConnection
    static String[] email2 = new String[10];
    static int ctr = 0;
    static String ctrlno = "";
    public void DBConnect()
    Connection connection = null;
    Statement statement = null;
    ResultSet rs = null;
    try
    Class.forName("org.postgresql.Driver");
    connection = DriverManager.getConnection("jdbc:postgresql:cms", "postgres", "password");
    statement = connection.createStatement();
    String ctrlno2 = "ctrlno1";
    String sql = "SELECT (expiredate - CURRENT_DATE) as no_days, cms_trans_contract.ctrlno, cms_trans_contract_notify.notifyid, ofc_employee.email, notify1, notify2, notify3 from" +
    " cms_trans_contract, cms_trans_contract_notify, ofc_employee where" +
    " cms_trans_contract.ctrlno = cms_trans_contract_notify.ctrlno and cms_trans_contract_notify.notifyid = ofc_employee.idnum";
    //where ctrlno = " + "'"+ctrlno2+"'";
    //"select expiredate from cms_trans_contract";
    //wherer ctrlno = " + "'"+ctrlno2+"'";
    //SELECT (CURRENT_DATE - expiredate) as no_days from cms_trans_contract
    sql += "where startdate between '";
    sql += request.getParameter("commenceStartDate") + "' and '"
    sql += request.getParameter("commenceEndDate") + "'";
    sql += "and expiredate between '";
    sql += request.getParameter("expireStartDate") + "' and '"
    sql += request.getParameter("expireEndDate") + "'";
    rs = statement.executeQuery(sql);
    //System.out.println("rs: " + rs.next());
    while (rs.next())
    //System.out.println("Record Found");
    String firstname = "";
    String lastname = "";
    String notifyid = "";
    String email = "";
    int notify1;
    int notify2;
    int notify3;
    //Date expiredate;
    int subtracted_date;
    //firstname = (rs.getString(1));
    subtracted_date = (rs.getInt(1));
    ctrlno = (rs.getString(2));
    notifyid = (rs.getString(3));
    //email = (rs.getString(4));
    email2[ctr] = (rs.getString(4));
    notify1 = (rs.getInt(5));
    notify2 = (rs.getInt(6));
    notify3 = (rs.getInt(7));
    //lastname = (rs.getString(2));
    //out.println(contract.getCtrlno());
    //System.out.println("FIRSTNAME: " + firstname);
    //System.out.println("LASTNAME: " + lastname);
    //System.out.println("Expiredate: " + expiredate);
    //System.out.println("Ctrlno: " + ctrlno);
    System.out.println("SUB: " + subtracted_date);
    //System.out.println("sql: " + sql);
    if((((subtracted_date == notify1) || (subtracted_date == notify2)) || (subtracted_date == notify3)) && (subtracted_date > 0))
    System.out.println("CtrlnoGET: " + ctrlno);
    System.out.println("NotifyID: " + notifyid);
    //System.out.println("email " + email);
    System.out.println("EmailCTR: " + ctr +": " + email2[ctr]);
    System.out.println("notify1: " + notify1);
    System.out.println("notify2: " + notify2);
    System.out.println("notify3: " + notify3);
    EmailThread emailThread = new EmailThread();
    emailThread.sendMessage(DBConnection.email2, DBConnection.ctrlno);
    //ctr++;
    ctr++;
    if (rs.next() == false)
    System.out.println("No records found");
    catch (Exception ex)
    ex.printStackTrace();
    System.out.println("Error getting connections");
    finally
    try
    if (rs != null)
    rs.close();
    if (statement != null)
    statement.close();
    if (connection != null)
    connection.close();
    catch (Exception ex)
    ex.printStackTrace();
    System.out.println("Error closing connections");
    // time getter module
    class NotifierThread implements Runnable
    public void run()
    while (true)
    Calendar cal = new GregorianCalendar();
    int hour12 = cal.get(Calendar.HOUR); // Range 0..11
    //int hour24 = cal.get(Calendar.HOUR_OF_DAY); // Range 0..23
    int min = cal.get(Calendar.MINUTE); // Range 0..59
    int sec = cal.get(Calendar.SECOND); // Range 0..59
    //int ms = cal.get(Calendar.MILLISECOND); // Range 0..999
    int ampm = cal.get(Calendar.AM_PM); // Range 0=AM, 1=PM
    String am_pm = "";
    if(ampm == 0)
    am_pm = "AM";
    else
    am_pm = "PM";
    System.out.println("Time " + hour12 + ":" + min + ":" + sec + " " + am_pm);
    if(sec == 10)
    System.out.println("YIPEE");
    //EmailThread emailThread = new EmailThread();
    //emailThread.sendMessage(DBConnection.email2);
    DBConnection dbc = new DBConnection();
    dbc.DBConnect();
    try
    Thread.sleep(1000);
    catch(Exception e)
    e.printStackTrace();
    class SimpleSender
    * Main method to send a message given on the command line.
    /*public void senderClassKo()
    try
    //String smtpServer="mail.kiksbalayon.com";
    String smtpServer="localhost";
    String to="[email protected]";
    String from="[email protected]";
    String subject="hello";
    String body="sa wakas ng send din";
    send(smtpServer, to, from, subject, body);
    catch (Exception ex)
    //System.out.println("Usage: java com.lotontech.mail.SimpleSender"
    //+" smtpServer toAddress fromAddress subjectText bodyText");
    System.exit(0);
    /*public static void send(String smtpServer, String to, String from, String subject, String body)
    try
    Properties props = System.getProperties();
    // -- Attaching to default Session, or we could start a new one --
    props.put("mail.smtp.host", smtpServer);
    Session session = Session.getDefaultInstance(props, null);
    // -- Create a new message --
    Message msg = new MimeMessage(session);
    // -- Set the FROM and TO fields --
    msg.setFrom(new InternetAddress(from));
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
    // -- We could include CC recipients too --
    // if (cc != null)
    // msg.setRecipients(Message.RecipientType.CC
    // ,InternetAddress.parse(cc, false));
    // -- Set the subject and body text --
    msg.setSubject(subject);
    msg.setText(body);
    // -- Set some other header information --
    //msg.setHeader("X-Mailer", "LOTONtechEmail");
    msg.setSentDate(new Date());
    // -- Send the message --
    Transport.send(msg);
    System.out.println("Message sent OK.");
    catch (Exception ex)
    ex.printStackTrace();
    //Authentication module
    class MyAuthenticator extends Authenticator
    MyAuthenticator()
    super();
    //protected PasswordAuthentication getPasswordAuthentication()
    public PasswordAuthentication getPasswordAuthentication()
    return new PasswordAuthentication("johann108", "password");
    // email module
    class EmailThread //throws MessagingException
    public void sendMessage(String toEmail[], String ctrlno) //throws MessagingException
    try
    String host = "localhost";
    //String host = "mail.philweb.com";
    //String from = "[email protected]";
    String from = "[email protected]";
    //String[] to = toEmail;
    //"[email protected]";
    // Get system properties
    Properties props = System.getProperties();
    // Setup mail server
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.auth", "true");
    // Get session
    Authenticator auth = new MyAuthenticator();
    Session session = Session.getDefaultInstance(props, auth);
    boolean debug = true;
    session.setDebug(debug);
    // Define message
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    InternetAddress[] to = new InternetAddress[DBConnection.ctr];
    for (int i = 0; i < DBConnection.ctr; i++)
    to[i] = new InternetAddress(toEmail);
    //System.out.println("EMAILTO:" + to[i]);
    message.setRecipients(Message.RecipientType.TO, to);
    //message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    message.setSubject("Contract Expiry");
    message.setText(
    "Contract is about to expire\n" +
    " ContractNumber is " + DBConnection.ctrlno
    // Send message
    Transport.send(message);
    catch(Exception me)
    me.printStackTrace();
    System.out.println("Error in Sending Message");

Maybe you are looking for

  • How to use Session scope in jsp page

    Hello, I have login form, where user provides username and password. Then click on submit, it will forward to validation.jsp. Where it will check in database make sure username and password exit. Now i can also retrive accountid of perticular user. I

  • Odd superscript/subscript behavior

    Hi all I wanted to format a subscript character in Pages today, but both subscript and superscript were grayed out in the tool bar and also in the menu (Format>Baseline). however, the keyboard shortcut "Control - Command- -" worked fine. Can anyone e

  • Internet Directory on Redhat 7.1

    Have successully installed 9i on Redhat 7.1. Am now trying to install OID. The install docs said that towards the end of the installation the Internet Directory Configuration Assistant would appear, however it didn't and I could find no errors in the

  • Can you help me with my External Hard Drive?

    Hey everyone, I'm having a big problem with my external hard drives. Firstly, I'll give you all the information I think you might need- * I'm running on Mac OSX 10.4.11. * I have the most recent release 13" Macbook and it has plenty of memory left. *

  • How to fetch folders and subfolders from sharepoint document library

     I have document library with name . Under "Documents" there are some folders.Under some folders there are some subfolders. I need to fetch the folders in to dropdown list. IF I select some folder in dropdownlist,I need to fetch subfolders of that fo