Printing in Java 1.4 - printJob.getGraphics() causes exception

Hi,
I'm trying to print (using java 1.4) however the code
'printJob.getGraphics()' (where printJob is a PrintJob object) seems to cause an exception (see below..)
Could anyone please tell me a bit more about what this exception means?
Thanks a lot!
Kat
Here's the exception:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D0844C6
Function=Java_sun_awt_windows_WPrinterJob_setNativePrintService+0x19D
Library=C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\awt.dll
Current Java thread:
at sun.awt.windows.WPrinterJob.setNativePrintService(Native Method)
at sun.awt.windows.WPrinterJob.setPrintService(WPrinterJob.java:384)
at sun.print.RasterPrinterJob.getPrintService(RasterPrinterJob.java:354)
at sun.awt.windows.WPrinterJob.getPrintService(WPrinterJob.java:408)
at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:997)
at sun.print.PrintJob2D.run(PrintJob2D.java:529)
at java.lang.Thread.run(Thread.java:536)
Dynamic libraries:
0x00400000 - 0x00406000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\bin\java.exe
0x77F50000 - 0x77FF9000 C:\WINDOWS\System32\ntdll.dll
0x77E60000 - 0x77F45000 C:\WINDOWS\system32\kernel32.dll
0x77DD0000 - 0x77E5B000 C:\WINDOWS\system32\ADVAPI32.dll
0x77CC0000 - 0x77D35000 C:\WINDOWS\system32\RPCRT4.dll
0x77C10000 - 0x77C63000 C:\WINDOWS\system32\MSVCRT.dll
0x6D330000 - 0x6D45C000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\client\jvm.dll
0x77D40000 - 0x77DCD000 C:\WINDOWS\system32\USER32.dll
0x77C70000 - 0x77CB0000 C:\WINDOWS\system32\GDI32.dll
0x76B40000 - 0x76B6C000 C:\WINDOWS\System32\WINMM.dll
0x76390000 - 0x763AA000 C:\WINDOWS\System32\IMM32.DLL
0x629C0000 - 0x629C8000 C:\WINDOWS\System32\LPK.DLL
0x72FA0000 - 0x72FFA000 C:\WINDOWS\System32\USP10.dll
0x6D1D0000 - 0x6D1D7000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\hpi.dll
0x6D300000 - 0x6D30D000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\verify.dll
0x6D210000 - 0x6D229000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\java.dll
0x6D320000 - 0x6D32D000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\zip.dll
0x6D260000 - 0x6D27C000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\jdwp.dll
0x501D0000 - 0x501D5000 C:\JBuilder4\jdk1.3\bin\dt_socket.dll
0x71AB0000 - 0x71AC5000 C:\WINDOWS\System32\ws2_32.dll
0x71AA0000 - 0x71AA8000 C:\WINDOWS\System32\WS2HELP.dll
0x71A50000 - 0x71A8B000 C:\WINDOWS\System32\mswsock.dll
0x76F20000 - 0x76F45000 C:\WINDOWS\System32\DNSAPI.dll
0x76FB0000 - 0x76FB7000 C:\WINDOWS\System32\winrnr.dll
0x76F60000 - 0x76F8C000 C:\WINDOWS\system32\WLDAP32.dll
0x76FC0000 - 0x76FC5000 C:\WINDOWS\System32\rasadhlp.dll
0x71A90000 - 0x71A98000 C:\WINDOWS\System32\wshtcpip.dll
0x6D000000 - 0x6D0FA000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\awt.dll
0x73000000 - 0x73023000 C:\WINDOWS\System32\WINSPOOL.DRV
0x771B0000 - 0x772CA000 C:\WINDOWS\system32\ole32.dll
0x5AD70000 - 0x5ADA4000 C:\WINDOWS\system32\uxtheme.dll
0x6D180000 - 0x6D1D0000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\fontmanager.dll
0x51000000 - 0x51044000 C:\WINDOWS\System32\ddraw.dll
0x73BC0000 - 0x73BC6000 C:\WINDOWS\System32\DCIMAN32.dll
0x6D910000 - 0x6D981000 C:\WINDOWS\System32\D3DIM.DLL
0x210F0000 - 0x21114000 C:\WINDOWS\System32\Hook98.dll
0x6D2A0000 - 0x6D2C1000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\jsound.dll
0x72D20000 - 0x72D29000 C:\WINDOWS\System32\wdmaud.drv
0x72D10000 - 0x72D18000 C:\WINDOWS\System32\msacm32.drv
0x77BE0000 - 0x77BF4000 C:\WINDOWS\System32\MSACM32.dll
0x77BD0000 - 0x77BD7000 C:\WINDOWS\System32\midimap.dll
0x6D130000 - 0x6D152000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\dcpr.dll
0x6D100000 - 0x6D123000 C:\Program Files\s1studio_jdk\j2sdk1.4.1\jre\bin\cmm.dll
0x763B0000 - 0x763F5000 C:\WINDOWS\system32\COMDLG32.DLL
0x772D0000 - 0x77333000 C:\WINDOWS\system32\SHLWAPI.dll
0x77340000 - 0x773CB000 C:\WINDOWS\system32\COMCTL32.dll
0x69800000 - 0x69FEE000 C:\WINDOWS\system32\SHELL32.dll
0x71950000 - 0x71A34000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.0.0_x-ww_1382d70a\comctl32.dll
0x21F10000 - 0x21F17000 C:\WINDOWS\System32\spool\DRIVERS\W32X86\2\HPBF0010.DLL
0x21F30000 - 0x21FA4000 C:\WINDOWS\System32\spool\DRIVERS\W32X86\2\HPBF0016.dll
0x21FB0000 - 0x21FC0000 C:\WINDOWS\System32\MSVCIRT.dll
0x21FC0000 - 0x220D2000 C:\WINDOWS\System32\spool\DRIVERS\W32X86\2\HPBF0013.DLL
0x220E0000 - 0x220FE000 C:\WINDOWS\System32\spool\DRIVERS\W32X86\2\HPBF0011.DLL
0x77C00000 - 0x77C07000 C:\WINDOWS\system32\VERSION.dll
0x6E680000 - 0x6E6B9000 C:\WINDOWS\System32\COMPSTUI.dll
0x76380000 - 0x76385000 C:\WINDOWS\System32\MSIMG32.dll
0x22100000 - 0x2210F000 C:\WINDOWS\System32\spool\DRIVERS\W32X86\2\HPBAFD32.DLL
0x76C90000 - 0x76CB2000 C:\WINDOWS\system32\imagehlp.dll
0x6D510000 - 0x6D58C000 C:\WINDOWS\system32\DBGHELP.dll
0x76BF0000 - 0x76BFB000 C:\WINDOWS\System32\PSAPI.DLL
Local Time = Tue Feb 18 15:37:46 2003
Elapsed Time = 22
# The exception above was detected in native code outside the VM
# Java VM: Java HotSpot(TM) Client VM (1.4.1-b21 mixed mode)
# An error report file has been saved as hs_err_pid3640.log.
# Please refer to the file for further information.

I have this problem, too. I have seen numerous references to it in the forum, but no solution - not even something to try! I have tried printing to the same printer using an HP LaserJet III driver and had success, but then IT ALSO STARTED GETTING THE SAME EXCEPTION!!! The same code on another PC has no errors and runs every time. We are comparing to see what the difference is between the two machines in hopes of finding a solution. But the one that fails worked yesterday! We really could use some help on this one...

Similar Messages

  • Problem in printing a java swing form

    Hi,
    Could anyone help me on how to set the page margings while I print a java swing form since it is taking a lot of space as margins in the top right top and bottom how do i do that. or is it that java can only print in the printable area or is there any way i can increase the scope of the printable area

    I used PrintRequestAttributeSet and set the margins to 0.5 on all four sides by creating an instance of MediaPrintableArea. By default, the margins on all sides comes up as 1.0 inch. Default paper size is LETTER (8.5 x 11).
    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    aset.add(new MediaPrintableArea(0.5f,0.5f,7.5f,10.0f,MediaPrintableArea.INCH);
    PrinterJob printJob = PrinterJob.getPrinterJob();
    printJob.setPrintable(component);
    if(printJob.printDialog(aset))
    printJob.print(aset);
    hope it helps.

  • Configure client printer in java.awt.print

    I have number of records in database.
    If User clicks on PRINT button (ON A JSP PAGE)each record should be printed(ON CLIENT PRINTER) on a separate sheet.
    I can only able to access printer connected to server not to client.
    I am using javax.print and java.awt.print packages

    I am not sure this..
    Instead of if pls give while and check:
    try{
    while(rsValue.next()) {
    g.setFont(fntHeading);
    g.setColor(Color.red);
    g.drawString("Main Report",200,100);

  • I just updated my latest java but the update is causing problems with some externale devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device

    i just updated my latest java but the update is causing problems with some external devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device.
    Is this possible and how do i do that?
    Anyone who responds thanks for that!
    Juko
    I am running
    Hardware Overview:
      Model Name:          Mac Pro
      Model Identifier:          MacPro1,1
      Processor Name:          Dual-Core Intel Xeon
      Processor Speed:          2,66 GHz
      Number of Processors:          2
      Total Number of Cores:          4
      L2 Cache (per Processor):          4 MB
      Memory:          6 GB
      Bus Speed:          1,33 GHz
      Boot ROM Version:          MP11.005D.B00
      SMC Version (system):          1.7f10
      Serial Number (system):          CK7XXXXXXGP
      Hardware UUID:          00000000-0000-1000-8000-0017F20F82F0
    System Software Overview:
      System Version:          Mac OS X 10.7.5 (11G63)
      Kernel Version:          Darwin 11.4.2
      Boot Volume:          Macintosh HD(2)
      Boot Mode:          Normal
      Computer Name:          Mac Pro van Juko de Vries
      User Name:          Juko de Vries (jukodevries)
      Secure Virtual Memory:          Enabled
      64-bit Kernel and Extensions:          No
      Time since boot:          11 days 20:39
    Message was edited by Host

    Java 6 you can't as Apple maintains it, and Java 7 you could if you uninstall it and Oracle provides the earlier version which they likely won't his last update fixed 37 remote exploits.
    Java broken some software here and there, all you'll have to do is wait for a update from the other parties.

  • XML Printing from Java

    I have an urgent request from my company's client to implement a feature of printing in our application.
    Actually the application is basically an XML Builder which generates XML code at the backend, something like Dreamweaver.
    I have no clue about printing in Java, and have not much time to research on this topic. If anybody have a program to send an XML file to print (Color printing if possible), please post here or email me at [email protected]
    Any help in this regard is highly appreciated (Dukes Dollars also available).
    Thanks
    Raheel

    I realize you're under time pressure, but this link may be of assistance: Printing in Java, Part 1: Acquaint yourself with the Java printing model

  • PL/SQL log messages are not printing from Java concurrent program

    Hi,
    I have a strange issue while submitting the Java concurrent program through PL/SQL.
    I have a PL/SQL concurrent program which will invoke the Java concurrent program inside the package by use of "FND_GLOBAL.SUBMIT_REQUEST". It worked and submitted successfully. From that Java concurrent program we are calling some other PL/SQL packages and printing some log messages over there. But problem here is the request is only printing the Java log messages in view log but not the PL/SQL log messages.  But if I submit the Java concurrent program directly from SRS form at that it is printing both Java and PL/SQL log messages.
    I am just wondering how the log messages has not printed. Please provide your inputs to solve this problem.
    Thanks
    Suriya

    I'm adding log messages in the package body , but these messages are not printing after completion of concurrent prog.
    Any suggestions.
    FND_FILE.PUT_LINE(FND_FILE.LOG,'Data Test :');Do you have COMMIT in your code?
    https://forums.oracle.com/forums/search.jspa?threadID=&q=%27FND_FILE.PUT_LINE%27+AND+commit&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Help needed in printing in java

    hello everyone, i m in grave need of a solution of printing a java page. I have a page designed in Java swings which contains mainly labels and textareas. And i need to print this page. The problem is that I have no clue how to go ahead. Cud neone arnd pls help me on this matter asap as this is very urgent. I shall be highly obliged to all the takers on this issue. Please email me at [email protected]
    Thanks and kind regards,
    Rahul.

    http://java.sun.com/docs/books/tutorial/2d/printing/index.html

  • Text Printing in Java

    How can i print characters with different styles in a dotmatrix printer using print api

    Well, getting the text from your JTextField should be rather easy: myJTextField.getText().
    To print it, you'll have to create an Graphics object and draw the text using the drawString method on a Graphics objects: myGraphics.drawString(myText, x, y). You will need to set the right font on the graphics before that (using the setFont() method).
    You can then use this Graphics object to print.
    See the java tutorial on printing for more info about printing: http://java.sun.com/docs/books/tutorial/2d/printing/overview.html

  • Printing in java - text positioning

    Hi there, I need some pointers in the right direction please.
    I need to print a page out to fill in a pre-printed sheet. The data to go onto the sheet is purely numbers, but the pre-printed sheet is not in a table format (the boxes where the data goes are in seemingly random positions.)
    I am currently completing the task by laying out a panel in the way I want it and using the printComponent method, but this obviously isnt the best way to do it as all I need to print out is text.
    How is the best way to go about this? Is it possible to define the position of each line of text?
    Cheers. :)

    Well, getting the text from your JTextField should be rather easy: myJTextField.getText().
    To print it, you'll have to create an Graphics object and draw the text using the drawString method on a Graphics objects: myGraphics.drawString(myText, x, y). You will need to set the right font on the graphics before that (using the setFont() method).
    You can then use this Graphics object to print.
    See the java tutorial on printing for more info about printing: http://java.sun.com/docs/books/tutorial/2d/printing/overview.html

  • How to print in java(page or whole frame with photos)

    Hell sir,
    My self kiran patel.I am going to devlop a visitor information system project for Ongc(stand-alon application)
    I want to know about below topics.
    (1) How to print simple page using printer in java.i dont know any code.
    (2) Printing page should contain the whole page which include information and photo of visitor.
    (3) how to catch the photo in data base or my frame of visitor info. which we have taken throw web-came.
    (4) can we store any image in database?
    Please help me as possible as soon.......
    kiran patel(MSc it)

    Background study -
    http://java.sun.com/docs/books/tutorial/2d/printing/index.html
    http://java.sun.com/docs/books/tutorial/jdbc/index.html

  • Printing From Java "The most F%&()�G stupid thing in the world"

    I have Spent the whole day trying to print a JPanel out of My application. I have gotten the panel to print but the print is not consistant. If the User Changes the Size of the Fame the Panel size Changes and Dimensions of the Plot Changes (aspect ratio). This happens because A print call makes a an image and then scales the image!!! Would it not make way more sence to scale the Jpanel to fit into the specified page size and then make an image to print! I anyone nows of way to do this Please!!!!!!!! let me know.

    I think the above post is an understatement, Printing in java is pretty much useless unless you can create your own framework, which you have to pretty much be a guru to create, but fortunately there was a nice guy, named Jean-Pierre Dube' who wrote an atricle for javaworld.com titled Printing in Java which provides a framework. It is really good. Initially I tried to print a JPanel and had the same problem as you, but then I read the article and used the framework and it did exactly what I wanted it to. I think what it does is take the programmed size (or preffered size) so if in your program you have specified the JPanel size (600,600) it will print it out in this size even if the person changes the size of the frame.
    Hope this helps and a big thanks to Jean-Pierre Dube'
    There are also a few other print Frameworks out there for free such as JFreeReport which is another good one, and I'd like to thank those guys if they happen to read this as well ( by the way, they made a post a few days ago stating a new version was out, and someone snubbed them by saying that this was not the place for advertising, but I think it is great they let us know, nothing wrong with being informed of a good freeware, especially for stuff that makes up where java lags. Thanks guys at JFreeReport).
    Cheers, Oz!!!!

  • Send a txt file to the printer with java

    Hello,
    I want to sent a txt file to the printer in java. I' am using the USB port. I can try to setup a dos command (print c:\test.txt), but I don't know the exactly command.
    There is also another solution in java I thing but I don't know the code!
    Can somebody give me the exact command for DOS and/or the code I have to write in java?
    THANX!!!!

    in dos imo you are not able to use usb-port. if your printer would be on lpt you could use javacomm ( http://java.sun.com/products/javacomm/index.html ). there is also another thread talking about this (print text to lpt). for your usb-problem i don't have a solution. but you could use JNI (java native interface). write code in c, compile to dll and use it in java.
    tobias
    ps: the other thread ( http://forum.java.sun.com/thread.jsp?forum=31&thread=224460 )

  • Printing in java? Does anyone know how?

    Um ......cant seem to find any tuorials on printing in java.
    Does anyone know how. I have a bit of text in a JTextArea that i just wanna print directly to the printer. No hassles.

    If you're trying to print in JDK 1.2 or 1.3 there is an online tutorial here:
    http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html
    Things have drastically changed for Java 2, JDK 1.4, and the new printing API/User guide can be found here:
    http://java.sun.com/j2se/1.4/docs/guide/jps/
    I have been having trouble with the locating printservices with the jdk 1.4, but it is still in BETA, so that could be the problem.

  • Warning Noob: Sending "Hello World!" in Printer using Java Applet

    Hello guys!
    im a newbie in java programming... i hope that you can help me with my problem.
    how can i print "Hello World!" in printer using java applet. lets pretend that the applet is digitally signed.
    i tried window.print in javascript but unfortunately, that is not what i am looking for.
    thanks for reading my post and i hope that you help me with my quest in java =)

    An applet is still part of the Swing package. I assume you're extending JApplet. There isn't anything in the print API that says it can't be done in an applet. Except that you might have to sign your applet Jar file with a digital certificate to get the printing to work.

  • Finally cause Exception be forgotten

    In trying out that finally cause previous return value be forgotten, as described on page 206 of "The Java Programming Language, 3rd edition", I wrote the following code, and tested it with jdk1.3.1. To my supprise, not only the return value was forgotten, the exception was appeared forgotten as well:
    class PException extends Exception {
    class Final {
        void f1(int i) {
         int result;
         System.out.println("f1("+i+")");
         try {
             result = f2(i);
             System.out.println("result = " + result);
         } catch(Exception e) {
             System.out.println("caught an Exception: " + e);
         try {
             result = f3(i);
             System.out.println("result = " + result);
         } catch(Exception e) {
             System.out.println("caught an Exception: " + e);
        int f2(int i) throws PException {
         try {
             if (i == 1) {
              System.out.println("generate exception");
              throw new PException();
             return 1;
         } finally {
             return 2;
        int f3(int i) throws PException {
         if (i == 1) {
             System.out.println("generate exception");
             throw new PException();
         return 1;
        public static void main(String[] args) {
         Final f = new Final();
         f.f1(1);
         f.f1(2);
         f.f1(1);
    }Here is the result:
    f1(1)
    generate exception
    result = 2
    generate exception
    caught an Exception: PException
    f1(2)
    result = 2
    result = 1
    f1(1)
    generate exception
    result = 2
    generate exception
    caught an Exception: PException

    The concern here is that when the
    try {
    finally {
    }pattern is used, without the catch block, purelly for flow control purpose, a return statement in the finally block could be problematic. If a finally block ends with a return statement, any exception that might be thrown in the try block would be ignored. The unhandled exception will not propergate, it simply lost in the midst. Because any code could throw unchecked exception, if the exception cannot afford to be lost, then one should be careful not to use return in the finally block. See the following test code:
    class Finally {
        void test() {
         int result;
         System.out.println("test()");
         try {
             result = f1();
             System.out.println("result = " + result);
         } catch(Exception e) {
             System.out.println("Caught an Exception: " + e);
         try {
             result = f2();
             System.out.println("result = " + result);
         } catch(Exception e) {
             System.out.println("Caught an Exception: " + e);
         try {
             f3();
         } catch(Exception e) {
             System.out.println("Caught an Exception: " + e);
         try {
             f4();
         } catch(Exception e) {
             System.out.println("Caught an Exception: " + e);
        int f1() {
         System.out.println("f1()");
         int a = 0;
         int b = 0;
         try {
             a = 1/0;  // this generate an unchecked exception
             b = 1;
         } finally {
             return b; // this return clobber the unchecked exception
        int f2() {
         System.out.println("f2()");
         int a = 0;
         int b = 0;
         a = 1/0; // this generate an unchecked exception
         b = 1;
         return b;
        void f3() {
         System.out.println("f3()");
         int a = 0;
         int b = 0;
         try {
             a = 1/0;  // this generate an unchecked exception
             b = 1;
         } finally {
             return;   // this return clobber the unchecked exception
        void f4() {
         System.out.println("f4()");
         int a = 0;
         int b = 0;
         try {
             a = 1/0;  // this generate an unchecked exception
             b = 1;
         } finally {
        public static void main(String[] args) {
         Finally f = new Finally();
         f.test();
    /code]
    Here are the results:test()
    f1()
    result = 0
    f2()
    Caught an Exception: java.lang.ArithmeticException: / by zero
    f3()
    f4()
    Caught an Exception: java.lang.ArithmeticException: / by zero
    We see that the devide by zero exception throw by f1() simply vanished, the unintended result 0, instead of the intended result 1, is returned. The test() method did not detect any abnormality in f1(), which is scary. To drive the point home, we try f3() and f4(), which has void return type. A simple return statement in f3() causes exception be lost. The stack frame seems intact, for otherwise, the test() method would exit abruptly before f2() even get a chance to be called.

Maybe you are looking for

  • Outlook 2011 for Mac Syncing with iPhone 5

    THIS IS WHAT I HAVE: Macbook Pro running OS X (10.8.2) - Mountain Lion iPhone 5 running iOS 6.0.1 Outlook for Mac 2011 (14.2.4) I am coming from a PC that ran the most current Outlook and iTunes.  Before I switched to my Macbook Pro I was able to inp

  • Wishlist for future of Aperture

    Ok, so the problems are out there now and are pretty obvious. Now assuming that much of the already discussed issues are resolved what would you all like to see in v 2? (or hopefully 1.1!) I for one would love to be able to synch my libraries from my

  • Loos connection trougth a firewall between oracle server an client after 10 minutes

    hello, i do loos the connection between oracle server an client, because the firewall is between. The firewall will close non active connections an ports after 10 minutes. Only port of one site is clost after 10 minutes then, other site let the port

  • Alter database link

    Hi Team, Can we alter a public database link to connect to a different db using the below statement? Alter public database link link_name connect to schema identified by password using 'newdb'; Db version is 10.2.0.4

  • Desktop icons don't drag or drop

    Can't drag or drop my desktop icons. I have so far cleared cache, cleared cookies, removed 160 corrupt fonts, ran disk utility and all checked out okay. Help please. [email protected]