[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

getText() using UNIX

Posted on 1998-06-22
1
Medium Priority
?
170 Views
Last Modified: 2010-04-16
I am creating a java program that connects to the SMTP server, also using GUI  I am trying to use the getText feature to use the  information inputted by the user to the server.  I am getting a NullPointer Exception...mu code is:
out.println("mail from: " +From.getText());
I am also using the printWriter
What am I doing wrong?
0
Comment
Question by:ritson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
evijay earned 200 total points
ID: 1223526
Please check if From variable is null before that statment

ie.,

if (From == null) {
  System.err.println("From is null : logical problem need to be fixed!!");
  System.exit(1);
}
else
  out.println("mail from : " + From.getText());
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question