• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to solve this Exception  RSS feed

 
srikanth pidikiti
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
while using progam i am getting this error

import com.java4less.rfax.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.image.BufferedImage;
import com.apple.mrj.*;
public class Sent
{
public static void main(String[] args)
{
try {
FaxProducer p=null;
//System.in.read();
AcrobatFaxProducer pdf=new AcrobatFaxProducer();
pdf.setPDFFile("c:\\report.pdf");
//FaxModem fm= new FaxModem();
pdf.pageImage=new BufferedImage(800,1290,java.awt.image.BufferedImage.TYPE_INT_RGB);
//System.in.read();
FaxModem m=new FaxModem();
m.setPortName("COM2");
m.flowControl=m.FLOWCONTROL_XONXOFF;
m.ATFlowControlXONXOFF="AT&K4";
m.faxClass=2;
m.setInitString("ATV1Q0");
m.AtFBOR=true;
m.sendFax("0,23735862");
//System.in.read();
m.open(pdf);
if (m.sendFax("0,23735862")) System.out.println("Success ***");
else System.out.println("FAILED");
m.close();
}
catch ( Exception e ) { e.printStackTrace();}


}
}
Command out.
ATDT0,23735862java.lang.NullPointerException
at com.java4less.rfax.FaxModem.sendATCommandnoWait(FaxModem.java:
at com.java4less.rfax.FaxModem.sendATCommand(FaxModem.java:2167)
at com.java4less.rfax.FaxModem.connect(FaxModem.java:1614)
at com.java4less.rfax.FaxModem.sendFax(FaxModem.java:708)
at Sent.main(Sent.java:26)
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THe problem is in the FaxModem class so we can't help without more information.
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to Resolve a java.lang.NullPointerException
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to Exception Stack
at com.java4less.rfax.FaxModem.sendATCommandnoWait(FaxModem.java:
at com.java4less.rfax.FaxModem.sendATCommand(FaxModem.java:2167)
at com.java4less.rfax.FaxModem.connect(FaxModem.java:1614)
at com.java4less.rfax.FaxModem.sendFax(FaxModem.java:708)
at Sent.main(Sent.java:26)

it's clealy visible that exception occured in FaxModem.sendFax function and you haven't shown that class in this thread. so we are unable to explain, how to remove this exception.

Let us know the FaxModem class.

Anything of Something is better then Something of Anything.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!