Reading spam messages of gmail by java program

hey all,
I have to read spam messages of gmail by some java code. How can we do this ? any help

Sshikha wrote:
I have to read spam messages of gmail by some java code. How can we do this ? any helpThis forum has nothing to do with java programming nor accessing third-party email services such as Google Mail. I suggest you ask your question on the Java Mail forum instead:
http://forums.sun.com/forum.jspa?forumID=43
Regards,
Shane.

Similar Messages

  • How to read an XML file into a java program?

    hi,
    i want to load the following very simple xml file in my java program.
    <root>
    <weblogic>
    <url value="t3://192.168.1.160:7001" />
    <context value="weblogic.jndi.WLInitialContextFactory" />
    </weblogic>
    </root>
    I am getting the error: " Line=1: cvc-elt.1: Cannot find the declaration of element 'root'."
    What might be the problem can anyone help me out.
    My java class code is:
    public class BIXMLReader {
    /** All output will use this encoding */
    static final String outputEncoding = "UTF-8";
    // Parses an XML file and returns a DOM document.
    // If validating is true, the contents is validated against the DTD
    // specified in the file.
    public static Document parseXmlFile(String filename, boolean validating) {
    try {
    // Create a builder factory
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    factory.setIgnoringComments(false);
    factory.setIgnoringElementContentWhitespace(false);
    factory.setCoalescing(false);
    factory.setValidating(validating);
    // Create the builder and parse the file
    System.out.println("filename = " + filename);
    DocumentBuilder db = factory.newDocumentBuilder();
    // Set an ErrorHandler before parsing
    OutputStreamWriter errorWriter = new OutputStreamWriter(System.err, outputEncoding);
    db.setErrorHandler(new MyErrorHandler(new PrintWriter(errorWriter, true)));
    Document doc = db.parse(new File(filename));
    System.out.println(doc.toString());
    return doc;
    } catch (SAXException e) {
    System.out.println("A parsing error occurred; the xml input is not valid. " + e.getMessage());
    } catch (ParserConfigurationException e) {
    System.out.println("Parser configuration exception has occured");
    } catch (IOException e) {
    System.out.println("IO Exception has occured " + e.getMessage());
    return null;
    // Error handler to report errors and warnings
    private static class MyErrorHandler implements ErrorHandler {
    /** Error handler output goes here */
    private PrintWriter out;
    MyErrorHandler(PrintWriter out) {
    this.out = out;
    * Returns a string describing parse exception details
    private String getParseExceptionInfo(SAXParseException spe) {
    String systemId = spe.getSystemId();
    if (systemId == null) {
    systemId = "null";
    String info = "URI=" + systemId +
    " Line=" + spe.getLineNumber() +
    ": " + spe.getMessage();
    return info;
    // The following methods are standard SAX ErrorHandler methods.
    // See SAX documentation for more info.
    public void warning(SAXParseException spe) throws SAXException {
    out.println("Warning: " + getParseExceptionInfo(spe));
    public void error(SAXParseException spe) throws SAXException {
    String message = "Error: " + getParseExceptionInfo(spe);
    throw new SAXException(message);
    public void fatalError(SAXParseException spe) throws SAXException {
    String message = "Fatal Error: " + getParseExceptionInfo(spe);
    throw new SAXException(message);
    }

    ok thanks, i can get the elements, but why did it not validate it?
    I want to read the child nodes of "weblogic" not by their name but by their index. Because i dont want to confine the reader so i want to read all the child nodes of weblogic (looping over them). i m doing the following but its not returning me the correct result and giving me the wrong count of child nodes.
    Element elementNode = (Element)doc.getElementsByTagName("weblogic").item(0);
    NodeList nodeList = elementNode.getChildNodes();
    int length = nodeList.getLength();
    System.out.println("length = "+ length); // the length its giving is 5 but i shuld get only 2
    for(int i=0; i < length; i++) {
    Element elmChild = (Element) nodeList.item(i);
    System.out.println(elmChild.getAttribute("value"));
    what might be the problem?

  • How to read files on server from a java program?

    Hello,
    I am fairly new to JSP programming. I have an issue with reading files. I am trying to call method of a normal java file from a jsp program. The method I am trying to call does some IO operation on Files. I have the files in the same directory as my class files on server that is in WEB-INF/classes folder. In my java program, I am giving just the file name to open because the files and the classes are in the same directory. But this is not working.
    What exactly should I do to read a file from a java program, that is running on the server?
    Any help is appreciated.
    Thanks,
    Krishna

    String realFilePath = application.getRealPath("/WEB-INF/myFile.txt");
    File fileToOpen = new File(realFilePath);
    out.println(fileToOpen.getAbsolutePath() + ": exists? " + fileToOpen.exists());in this case "application" is a reference to the ServletContext.
    It is an implicit variable in a JSP. In a servlet:
    ServletContext application = getServletConfig().getServletContext();

  • How to get the erroe message, if i run java program using .bat file

    Hi,
    I have a java file which accepts two inputs as command line argument. I want to make this pgm a tool. So have created a *.bat file which has the following command
    java myprogram arg1 arg2
    I'm gonna share this program with others. So i'll keep the class file and the .bat file in a commaon folder. All the users have to do is, edit the .bat file to give his/her args and run the .bat file. The pbm is, if the user input is not valid, I have put displays in the pgm to show it.
    But if i run thru .bat, I'm not getting the error message or I don't know where it is getting displayed.
    Can anyone help me with this ?
    Thanks,
    Mary

    When i run from the console, I can see the output.
    But, when i double click on the .bat file from the
    folder, it runs fine and i couldn't see the output.
    nullThat's because the error message is printed, and then the console is closed. The message is there but you need to read really really fast :)

  • Error Message when running first java program

    Hi,
    I am reading "Sams Teach Yourself Java 6 in 21 Days" by Rogers Cadenhead. I am having a problem with compiling the sample program in the first part of the book, "HelloUser" which is supposed to print out "Hello (my name - Matt)" when run in the command line.
    I receive this error when trying to run it after having successfully compiled it (I enter java HelloUser while in correct folder):
    Exception in thread "main" java.lang.NoSuchMethodError: main
    I have correctly set the PATH and CLASSPATH settings for my PC (Windows XP). I am guessing that I need to define a "main" or something. I'm brand new to Java but am good with the scripting language PHP. Please tell me what I should do to correct this problem. Thanks in advance

    Here is the code for the program:
    public class HelloUser {
         public static void man(String[] arguments) {
              String username = System.getProperty("user.name");
              System.out.println("Hello " + username);
    }Here is what I enter in the Command Line:
    cd \JavaWork\j21work
    javac HelloUser.java
    java HelloUser
    There are no problems up until I enter the last line (java HelloUser) to run the program. By the way, I using JDK 6 update 1 with Windows XP.

  • HELP. How to read unread message from Gmail?

    Folder inbox = store.getFolder("INBOX");
              inbox.open(Folder.READ_ONLY);
              FetchProfile profile = new FetchProfile();
         profile.add(FetchProfile.Item.ENVELOPE);
    System.out.println(inbox.getUnreadMessageCount());
    It print out the number of all messages. I just want to get it number of unread message.
    I have bean searching for a long time. Is there any one can help me. I just want to make a Gmail notifier. Ring me when I get unread email.

    Are you using IMAP or POP?
    Did you read the JavaMail FAQ entries about Gmail?

  • Reading of messages

    When you down load message it doesn't open. The only message you receive is RETRIVING.
    Also attachments cannot be opened.

    Sshikha wrote:
    I have to read spam messages of gmail by some java code. How can we do this ? any helpThis forum has nothing to do with java programming nor accessing third-party email services such as Google Mail. I suggest you ask your question on the Java Mail forum instead:
    http://forums.sun.com/forum.jspa?forumID=43
    Regards,
    Shane.

  • Steps to read PDF using Java Program that uses LifecycleES Jboss server

    Can anyone please mention the steps to setup the Jboss server in Lifecycle ES suite....
    i have program to read PDF that has following contents --and it Fails to connect to LiveCycle server via RMI. Please help me out.....
    Properties connectionProps = new Properties();
    connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://localhost:1099");
    connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceC lientFactoryProperties.DSC_EJB_PROTOCOL);
    connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
    connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
    connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
    //Create a ServiceClientFactory instance
    ServiceClientFactory factory = ServiceClientFactory.createInstance(connectionProps);

    Vinay,
    i dont think that any body can read and write pdf files by java program.b'coz pdf files will have its own proprietery encoding format.
    Here is something u gotto remember when u post an answer to somebody's question. Never ever answer until u r very sure about something or u r a nerd in that area. Don't give a trivial or a insensible answer.
    Hope u learn the forum etiquette.
    Thanks,
    Kulk.

  • Read Java program objects output txt

    Hello,
    i try to read the output of a Java progam object that runs in BO server like this:
    int propertySet = IInfoObject.PropertySet.ALL;
        SearchPattern searchPattern = new SearchPattern();
        searchPattern.setObjectKind(CeKind.PROGRAM);
        searchPattern.setCUID(appCUID);
        searchPattern.setName(appName);
        SortType sortType = new SortType();
        sortType.addSortDimension(ISortDimension.NAME_DESC);
        IInfoObjects objectList = infoStore.find(propertySet, searchPattern, sortType);
        IProgram program = (IProgram) objectList.get(0);
        IInfoObjects results = program.getInstances();
        for (int i = 0; i < results.size(); i++) {
          IProgram log = (IProgram)results.get(i);
          System.out.println(log.getResultMIMEType());
          log.writeResult(System.out);
    it results in this  Exception
    text/plain
    com.crystaldecisions.sdk.exception.SDKException$PropertyNotFound: Die Eigenschaft mit ID SI_FILES ist im Objekt nicht vorhanden
         at com.crystaldecisions.sdk.occa.infostore.internal.InfoObject.getFiles(InfoObject.java:895)
         at com.crystaldecisions.sdk.occa.infostore.internal.AbstractSendableObject.getFiles(AbstractSendableObject.java:320)
         at com.crystaldecisions.sdk.occa.infostore.internal.AbstractSchedulableObject.getFiles(AbstractSchedulableObject.java:264)
         at com.crystaldecisions.sdk.plugin.desktop.program.internal.Program.getResultFile(Program.java:103)
         at com.crystaldecisions.sdk.plugin.desktop.program.internal.Program.writeResult(Program.java:113)
         at ch.raiffeisen.bo.accessor.BoProgramLogs.readLogs(BoProgramLogs.java:49)
    How can i read the txt output of a Java- program useing BOE SDK ?
    Thanks
    Johannes

    Hello Ted,
    thank you for your tip. In query builder SI_FILES is nonempty.
    I found a solution by reselecting the Instance - InfoObject with the Instances ID like this:
    IInfoObjects instances = program.getInstances();
        for (int i = 0; i < instances.size(); i++) {
          IProgram instance = (IProgram)instances.get(i);
          IInfoObjects objs =
                 infoStore.query("Select * " + "From CI_INFOOBJECTS Where SI_ID = " + instance.getID());
          for (int j = 0; j < objs.size(); j++) {
            IInfoObject obj = (IInfoObject) objs.get(0);
           ((IProgram)file).writeResult(System.out);
    This works
    Thanks very much.
    Johannes

  • Start a java program from an FMB then read and write some variables

    Hello,
    I am trying to see whether the following setup works:
    item A, B, D and Button Z are on a Forms Canvas.
    User clicks on Button Z. This will launch a java program (Myprog class).
    Myprog main will read values in item A and B, run some calculation and then will return it back to our forms module and then will be displayed in item D.
    I have read about PL/SQL wrapper but the way I am looking at my setup is that my Forms module will be just the GUI interface.
    Any ideas ?

    main thing: a JAVA class that will take some inputs and will output some results and messages.
    Prob: I do not want to use swing or any other GUI builder to make a nice GUI for my JAVA class.
    What I want: I know how to use Forms. As such, I just want to put together a quick interface (mymodule.fmb) that when executed will allow the user to click on a button to start the java process and then see the results and error messages.
    Why I don't want to go through SWING: my main prob is to get the java class executed ( which is fine right now thru command line) by other users thru a GUI interface. I do not have time to go thru SWING.
    From the paper I mentioned, I think the PJC is the way to go. Can you please confirm ?
    Thanks.

  • Keep getting error message when trying out a small java program in terminal

    I've been trying out running java programs in mac os x terminal. I have eclipse as well, but it's too much for me right now. I copied some programs out of the dummies book I have, just to get a feel for things -- so, I went to the desktop where the program was, and compiled it (I saved it with a .java extension). "javac javaprogram.java" to compile, which it did fine, and then 'java javaprogram' to execute it. It's just a simple line that says 'you'll love java!'. Anyway, it wouldn't execute it.
    Here's the program (written in text edit):
    class Displayer {
         public static void main (String args []) {
              System.out.println ("You'll love Java!");
    I got these messages:
    Exception in thread "main" java.lang.NoClassDefFoundError: javaprogram
    Caused by: java.lang.ClassNotFoundException: javaprogram
         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
    Now, I noticed that the first part of the error is "java.lang.NoClassDefFoundError: javaprogram". When I tried to run the program, it 'created' or put something on the desktop called Displayer.class, so I'm not sure what's going on. I've compared what I entered to what's in the book, and there are no mistakes on my part.
    Can anyone tell me what I'm doing wrong, and is there any book or site I can go to which will instruct me on running programs in terminal?

    For starters, rename javaprogram.java to Displayer.java and dojavac Displayer.java
    java Displayerand since you are new to Java, change your source code to public class Displayer.
    In Java, files containing a Java class named "ClassName" should/have to be named "ClassName.java".

  • I need to send a message via socket from a C program to a Java program

    Hi,
    I need to send a message via socket from a C program to a Java program. The message has three data: a long, an integer and a string.
    How can I put those three fields in a array of bytes in C? How can I extract those same three fields from an array of bytes in java?
    Thanks a lot!

    A few options:
    JNI
    Corba
    Using sockets directly
    take your pick.

  • Error occurred when processing Java programs (CRM ORDER READ is called)

    Hi,
      We are facing a problem while running a batch job.Its a batch job which reads order data from crm system by using crm order read and generates fur files on application server.
    But the problem is,  after executing or generating lets say 10000 records in file the batch job is automatically closed.
    When we tried to analyse it from SM37 we got the error message saying,
      " An error occurred while executing a Java program in the VM container"
    So what could be the reason of this problem.And what is the solution.
    Regards
    PG

    This is the error we get when we read Pricing condition or Variant Config from the ORDER.
    I think you are not  initalizing the order after you have the read the data.Pass the guid to ti_guis_to_init.
       call function 'CRM_ORDER_INITIALIZE'
          exporting
            it_guids_to_init = <>
          exceptions
            error_occurred   = 1
            others           = 2.
    This may solve the problem.
    Edited by: Chandra on Jan 30, 2009 1:30 PM

  • Where to place    text file in  Jdeveloper9irc  to read from Java program

    For ex.
    package mypackage;
    import java.io.*;
    public class ReadData
    public ReadData()
    public static void main(String[] args)
    new ReadData();
    try{
    File fin = new File("test.txt");
    if (fin.canRead())
    System.out.println("Can read file");
    I am geting a error message of file not found. Please advise
    in which directory should I place the text file "test.txt" so that the java program can read from it.
    Thanks,
    agsp

    The test.txt file should be in the 'Run Directory" of your Project. Select Project.jpr and invoke Project settings dialog.
    Click on the Runner. You will see the "Run Directory" edit field.
    For ex.
    package mypackage;
    import java.io.*;
    public class ReadData
    public ReadData()
    public static void main(String[] args)
    new ReadData();
    try{
    File fin = new File("test.txt");
    if (fin.canRead())
    System.out.println("Can read file");
    I am geting a error message of file not found. Please advise
    in which directory should I place the text file "test.txt" so that the java program can read from it.
    Thanks,
    agsp

  • Error message when try to run copied java program

    Hi Java Guru,
    Can somebody help me with this issue ?
    I was copy my java source from java_ulangan2 to java_ulangan20, when i tried to run the java program, i get an error message.
    Below is the error message:
    05/01/2010 1:02:42 PM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [003]Deployment aborted
    Settings
    SDM host : wfmdev
    SDM port : 50018
    URL to deploy : file:/d:/DOCUME1/GunawanJ/LOCALS1/Temp/temp7843042886291622098Java_ulangan20.ear
    Result
    => deployment aborted : file:/d:/DOCUME1/GunawanJ/LOCALS1/Temp/temp7843042886291622098Java_ulangan20.ear
    Aborted: development component 'Java_ulangan20'/'local'/'LOKAL'/'0.2010.01.05.13.02.32'/'0':Caught exception during application deployment from SAP J2EE Engine's deploy service:java.rmi.RemoteException: Cannot deploy application local/Java_ulangan20.. Reason: Clusterwide exception: Failed to deploy application local/Java_ulangan20. Check causing exception for details (trace file). Hint: Are all referenced components deployed and available on the engine?; nested exception is:      com.sap.engine.services.deploy.container.DeploymentException: Clusterwide exception: Failed to deploy application local/Java_ulangan20. Check causing exception for details (trace file). Hint: Are all referenced components deployed and available on the engine? (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Deployment exception : The deployment of at least one item aborted
    I really appreciate any kind of help.
    Thanks,
    JGN

    Hi John.
    In past i have faced same problem for the same task. Take help of the Basis team provide tham .ear file name and ask then to un-deploy the file from the server cluster.
    After this deploy your application again.
    Hope this may help you.....:)
    Deepak!!!

Maybe you are looking for

  • Does it exist a manual for learning to use Oracle Forms?

    What I'm looking for is a manual or tutorial for using Oracle Forms. Looking at Oracle Documentation link http://www.oracle.com/technetwork/developer-tools/forms/documentation/10g-forms-091309.html I haven't found an user or developer guide. On the w

  • Need help with multiple photographs in canvas- Hard Day's Night - Effect

    I'm working on a music video for my son's 6th grade band and have taken a serious of photographs of each of the 4 band members in rapid sequence ala George Harrison in Hard Days Night when he is being photographed by the press and he changes his expr

  • Oracle instance shutdown normal vs immediate (users connected) how-to?

    Hello Oracle crowd, recently, i tried to shutdown my instance Oracle 9.2.0.1.0 using sqlplus shutdown. i assume the default is shutdown normal but the instance would not shutdown. after reading the admin docs i realized it must be waiting for connect

  • I can't sync photos and music to my iPad afternoon updated to ISO5

    After updating to IOS5, i can't upload my photos and music to my dad's iPad.  My and my mom's iPhone 4 are OK.  We just have problem with my dad's iPad. I just updated it to 5.0.1, it's still not working. Anyone has the same problem? And can anyone h

  • Feather Minimum Value

    Hello, I've updated to the latest patch and I've also had a good long look through the thread history, as well as an extensive search through google looking for an answer to my problem. Basically, on the option bar for feathering when using any of th