• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

how to solve this Exception

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
THe problem is in the FaxModem class so we can't help without more information.
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to Resolve a java.lang.NullPointerException
 
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic