Printing/Application

I attempted to compile the following code and got the error:
Exception in thread "main" java.lang.NoClassDefFoundError: printer
import java.awt.*;
import java.awt.event.*;
public class printer {
     public static void main(String[] argv) {
          printgraphics w = new printgraphics();
class printgraphics extends Frame {
     printgraphics() {
          PrintJob p = getToolkit().getPrintJob(this, "Print graphics", null);
          Graphics g = p.getGraphics();
          g.drawRect(1, 1, 40, 40);
          g.drawLine(1, 1, 40, 40);
          g.dispose();
          p.end();
I appreciate any help you can give me :)

"...I'm clueless..."
So we see.
I just cut & pasted your code into a directory. I compiled it like this:
javac printer.javaand got a printer.class file in that directory.
Then I ran it like this:
java -classpath . printerA print dialog box popped up. I hit the "OK" button. That dismissed the dialog. I could see my print manager icon come up, but nothing else happened. I hit control-C and exited the problem.
It doesn't do much, and it's badly written, but it DOES compile and run if you do what you were told earlier. - MOD

Similar Messages

  • When I try to print from my iPad I see a message "searching for printer" and then "no printer found.".  I have a printer application loaded and it finds my wireless printer.   How do I get the iPad to do the same so I can print from emails, the web, etc?

    When I try to print from my iPad I see a message "searching for printer" and then "no printer found.".  I have a printer application loaded and it finds my wireless printer.   How do I get the iPad to do the same so I can print from emails, the web, etc?  Thanks

    sandrafromsilver spring wrote:
    When I try to print from my iPad I see a message "searching for printer" and then "no printer found.".  I have a printer application loaded and it finds my wireless printer.   How do I get the iPad to do the same so I can print from emails, the web, etc?  Thanks
    Go to the following link:
    http://jaxov.com/2010/11/how-to-enable-airprint-service-on-mac-os-x-10-6-5/

  • Print application

    hi
    i am developing print application using applet
    when the user click print a page setting dailog box will display
    and the user set the page properties ie landscape or potrait
    i have few question
    1)which api should i implememt to develop this application
    shall i use java.awt.print or javax.print api
    2)i want to print a word doc file but i am not able to print the
    file
    3)i have use javax.print.api and i wanted to print a html and txt file
    but the doc flovor is not supporting only GIF doc flovot is supporting
    i want to print a html and .doc file how do i print the file
    plz do provide me all information
    sameer

    I prefer used javax.print for the whole print work, instead java.awt.print.
    what do you mean with "to print a html and txt file", have you tried with another DocFlavor.INPUT_STREAM ? (e.g AUTOSENSE)

  • Printing application ALWAYS running after printing

    I would like to see if I am the ONLY one who found that when you print, the printer application stays running and you have to manually quit the application!!?? BEFORE Leopard, you didn't have to do this and I cannot see where I can have this automatically quit AFTER sending all to the printer!
    Any suggestions other than going back to the previous version of the OS...

    Open the printer's queue application (or print something, and as you noted, it'll stay open).
    Right-click -- or control-click -- on the application's icon in the dock.
    Select the "Auto-quit" item, see that it's checked, and then quit the application.
    Voilà! Next time you print it'll quit on its own.

  • New Printing Applications

    Check out the latest HP printing applications at www.hp.com/go/printing-software.  Great solutions for photo and web printing on PCs and iPhones.

    Thank you for your suggestion.  You are correct that Appleworks 5  for Windows does not have a preview command in the file menu.  However, using the idea of converting to a different type of file to print, in the
    "save as..." window I found I could change the file type and be able to print the newly designated file.  Some style drawbacks to that, but it works in a pinch.  For new files, they might as well be created in a different application to begin with.  But this could be a very handy technique to use to print old files so as to not have to recreate them to print.  Thanks, Barry
    Anthony

  • Printer applications remain open

    We are using Deep Freeze on our public machines. Along with the applications that "remain open" the printer applications do not close when you are done printing you have to close them before you can shutdown.
    Any thoughts?
    Mark

    CTRL- or RIGHT-click on the printer's Dock icon and select the option to close automatically.
    You may need to do this before "deep freezing" or the preference may be lost when the default system is restored by Deep Freeze.

  • Printing/Applications/OS

    fyi -- mac newbie!
    Here is my specs:
    MacPro Desktop 2x2.66ghz Intel
    500GB HDD
    2GB Ram
    ATI X1900XT Video Card
    Bluetooth/Airport
    1x16x Superdrive
    OS X 10.4.8
    Applications I use: Adobe Creative Suite CS2, Macromedia Studio 8, Microsoft Office 2004.
    Well since i do alot of Print, Publishing, Graphic work with texts and such and i just transferred from a customized pc rig - so bear with me as im new to this environment of the os -
    but when transferring files over such as fonts [[which ive seen as a huge problem or seems to be the biggest issue most are facing]] and all my fonts i transfer over are valid ive checked them with fontbook and ive tested them among other macs [[imac core dup, macbook rpo, G5, G4's etc]] however some applications such as Word wont allow certain fonts it says: "The Font :font name: is not available on your system. Do you want to use it anyway?" - however it works perfectly fine in other applications such as powerpoint and illustrator/ps and since i do alot of print documents with the font itself and it wont display it just replaces it with the default times new roman font - is there any way to troubleshoot or fix this issue? it seems to be microsoft word 2004 specific because i uploaded the fonts to a server and installe dthem on varient apple computers, such as G5's, G4'S and iMacs...i noticed it worked perfectly fine on Microsoft Office X or Word X or whatever its called so i ruled out a font problem and i installed the font into the User/Library/Fonts directy - like all my fonts but im not sure where t go from there kind of a headache in the switch over as i just dont wanna corrupt my system with these fonts..but need to use them across each application.
    Here are the fonts for anyone to mess with:
    http://www.anexometa.com/fireoverwater/
    the font family is Nimbus [NimbusRom, NimbusSans, etc]
    THANKS ALOT IN ADVANCED!!
    I appreciate it.

    thank you ill try that.
    BTW [just for arguments sake and the fact im still used to my other pc and trying to make the switch smooth and just understand the differences and the fact im picky [since i do alot of website editing and builind] - maybe this is just due to the os. but when i view certain sites in firefox 2 on osx compared to xp the test is unreadable/smaller no matter what type of apple i use. also certain characters/symbols dont display in firefox2 on osx [yes on xp] but view in in safari...maybe something to just bring up to the firefox forums? maybe others ran into these or noticed these - since i do a lot of webdevelopement and trying to find a standard to use and how it looks across each platform i want to be able to get it right and have it viewable...so i figured id bring this up
    just for reference i used this site as referencing - [[]]
    osx: http://www.loudspeakermusic.com/test/firefox2_osx1048.jpg
    xp: http://www.loudspeakermusic.com/test/firefox2_xp.jpg
    thanks again [[no mind to the pickiness!!]]
    thanks

  • Yosemite install deleted files from Time Machine!!  Yosemite installation deleted a printer application.  Went into Time Machine to restore the printer app and it was gone!  Now I wonder what else is gone.

    Installed Yosemite on iMac desktop.  Made sure I backed up and disconnected external hard drive.  Yosemite deleted a printer/scanner application.  Went into Time Machine to restore it and it was gone.  When external hd was remounted Yosemite went into it, probably to index, and deleted the application from all backups.  Wonder what else is missing??    Besides being unbelievably SLOW now I have to see what else has been lost.  

    Can you simply navigate to your Time Machine backup with the Finder? Treat it like an external hardrive and just look for your old Applications folder. /Applications/
    Also, quite a few apps put config and support files in ~/Library/Application\ Support/
    So you may be able to get the files from there as well.

  • Need help for printer application status

    Hi,
    I am using jdeveloper11.1.1.2.0.Actually standalone java application,I want to know status of the printer,If there is no paper inside printer then message should be display no paper in the printer,
    if i did printout but after 2 second i want to cancel the print then message should be also display ...
    my code is below..
    public void invokePrintJob(ActionEvent actionEvent) {
    // Add event code here...
    PrintService[] printers = PrintServiceLookup.lookupPrintServices(null, null);
    Boolean printerFound = false;
    for (int i = 0; i < printers.length && !printerFound; i++) {
    if (printers.getName().equalsIgnoreCase(getSelectedPrinter())) {
    printerFound = true;
    PrintService printer = printers[i];
    UploadedFile file = getTheFile();
    String fileName = getTheFile().getFilename();
    // String file = getTheFile();
    //PrintJobAdapter pr = new PrintJobAdapter();
    InputStream input;
    try {
    input = new BufferedInputStream((file.getInputStream()));
    Doc doc = new SimpleDoc(input, DocFlavor.INPUT_STREAM.PNG, null);
    PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet();
    attrs.add(new Copies(2));
    attrs.add(OrientationRequested.LANDSCAPE);
    JobName name = new JobName(fileName ,null);
    attrs.add(name);
    DocPrintJob job = printer.createPrintJob();
    PrintJobWatcher pjDone = new PrintJobWatcher(job);
    job.print(doc, attrs);
    pjDone.waitForDone();
    System.out.println("--------jobRunning-end----------");
    input.close();
    } catch (PrintException e) {
    System.out.println(e.getMessage());
    addFacesErrorMessage(e.getMessage());
    } catch (FileNotFoundException e) {
    System.out.println(e.getMessage());
    addFacesErrorMessage(e.getMessage());
    }catch (IOException ioe) {
    // TODO: Add catch code
    ioe.printStackTrace();
    public static class PrintJobWatcher {
    // true iff it is safe to close the print job's input stream
    boolean done = false;
    PrintJobWatcher(DocPrintJob job) {
    // Add a listener to the print job
    job.addPrintJobListener(new PrintJobAdapter() {
    public void printJobCanceled(PrintJobEvent pje) {
    System.out.println("-------printJobCanceled--------");
    allDone();
    public void printJobCompleted(PrintJobEvent pje) {
    System.out.println("------printJobCompleted---------");
    allDone();
    public void printJobFailed(PrintJobEvent pje) {
    System.out.println("----------printJobFailed-------");
    allDone();
    public void printJobNoMoreEvents(PrintJobEvent pje) {
    System.out.println("--------printJobNoMoreEvents---------");
    allDone();
    @Override
    public void printJobRequiresAttention(PrintJobEvent pje) {
    System.out.println("-----------printJobRequiresAttention----------");
    allDone();
    @Override
    public void printDataTransferCompleted(PrintJobEvent pje) {
    System.out.println("-------printDataTransferCompleted---------");
    allDone();
    void allDone() {
    // System.out.println("---------------");
    synchronized (PrintJobWatcher.this) {
    done = true;
    PrintJobWatcher.this.notify();
    public synchronized void waitForDone() {
    try {
    while (!done) {
    wait(1000);
    } catch (InterruptedException e) {
    e.printStackTrace();
    Please help me..

    Help with what? What's the actual problem?
    As far the code looks horrible. This kind of logic belongs in a fitler rather than a backing bean. You use empty strings instead of nulls. You stores passwords plain and unhashed in DB. You compares the password in Java instead of in DB. You stores password in a cookie. Your query is unsafe for SQL injections. You're reloading the driver class everytime when you acquire the connection. You're leaking DB connections. The application will crash sooner or later when the DB run out of connections.
    Is that all what you need to know?

  • AB AP (BDC) to launch 3rd party printing application

    Hi all,
    i intend to create a BDC program to generate PDF file.
    Unfortunately, due to system constraint (4.6B), unable to convert SAP document directly to PDF in the system (using FM) so have to use a 3rd party software.
    currently i have a 3rd party software for creating PDF from using print function. what i have in mind is to use the BDC program to print the SAP document through local printer, which will in turn launch the 3rd party software. this will pop-up a window promtping for name of PDF file to be created in local drive (eg, C:\)
    I would like to seek advises from experts, how can i perform the BDC to launch the printing option (LPD) in SAP and enter the desired PDF file name in the pop-up window, and pass back the file name back to the BDC session.
    Appreciate your help, thanks a lot!!
    regards,
    JL

    Hi
    If you are requirement is to print a document to the local printer, try generating a spool for the document.
    Use the spool number for FM: 'RSPO_OUTPUT_SPOOL_REQUEST'
              CALL FUNCTION 'RSPO_OUTPUT_SPOOL_REQUEST'
                EXPORTING
                  device           = <device name>
                  spool_request_id = <spool number>.
    Kind Regards
    Eswar

  • Whenever I attempt to print, applications I'm in unexpectedly quit

    Hello. I have a new 24" Intel iMac and this issue occurs no matter what application I'm using.
    Any ideas?

    Hello...
    Have you attempted to look at your logs yet?
    iMac 24"   Mac OS X (10.4.8)  

  • How will i be able to print on my macbook air if it has no port to install the printer application cd ?

    please help me with my question.

    purchase this: http://store.apple.com/us/product/MC684ZM/A, or use Remote Disc.

  • Which print application best serves hp photosmart 6510?

    I am looking for the best app for my iPad to install hp photosmart 6510printer.

    You have posted this in the wrong forum I'm afraid. I'd repost in the correct one.

  • How to print formatted data / report on user's printer in Web Application

    Hi All
    I want to print some formatted data/report ( it might be 1000 pages) on user's printer.
    application is web based and tech. used are Java - jsp - servlets
    now prob. is ...
    how i will transfer all data to client (web browser) from the server and how i can print that data on user's printer ...??
    there is requirement that I can not use applet for this purpose.
    if any one done or have idea then let me know.
    thanks
    Shailesh Koradiya

    Hi
    Its simple, first of all break ur data in terms of pages. Write the logic in one JSP.
    suppose i have jsp PrintReport.jsp , for page 1 url will PrintReport.jsp?page=0 ... so on
    get the page parameter in JSP
    String page="";
    if(request.getParameter("page")!=null)
    page=request.getParameter("page");
    get the rowcount from the Result and assume records per page is 100
    if u have 1000 rows then 10 pages u have to serve
    StartRowNumber=page*recordsPerPage
    EndRowNumber=StartRowNumber+recordsPerPage
    Execute a SQL query , select * from table where rownum between
    StartRowNumber and EndRowNumber
    Provide google like pageNumbers in ur HTML page
    ie 1 2 3 4 5 6 ..10
    Regarding printing , Create HTML button called 'print' and add Javascript ' window.print()' on clicking it.
    Hope it would solve ur problem
    Cheers
    Rajendra Bandi

  • Applications quit when trying to print.

    First real problem I have ever had with Apple software. When trying to print a web page in Safari the program quits. Then tried to print an Excel (Office 2004) spreadaheet and the same thing. So it is happening in native and Rosetta. Printer is HP LaserJet 1012 attached to an AirPort Extreme. All other Macs in the house have no problems printing. Any thoughts?
    Thanks
    MacBook Pro 2.0 GHz, 1G RAM   Mac OS X (10.4.5)  

    I've got a similar problem to the one you answered about inability to print- applications just closing ('unexpectedly closed'). I have reinstalled my wireless printer multiple times, still have programs closing when I try to print (Mail, any type of Browser-Safari, Camino, Netscape, Opera). (No problems with printing on the 2 iBooks & iMac on the network.) I've been on the phone with Apple Tech support- they recommended I do an 'Archive & Reinstall'- no help. I even did a clean install (thinking there was a problem with my migration settings from my old iBook)- still same problem. Any hints? Thanks.

Maybe you are looking for

  • 4 page form letter setup, best way

    Is the best way to set up a report that has 4 different pages to insert 4 detail sections. Page 1 would be Section 3 (details a), page 2 would be detail b, etc. We have no need for headers or footers. Then to get page 1 to page break at the end of th

  • Time on battery check

    Is there a way I can see how long the laptop has been running on battery? This is different than seeing an estimate how long the laptop can run on the battery.

  • Premiere Pro CC won't play audio from video file

    I've been trying to edit videos recorded with Bandicam in Premiere Pro CC. The video file itself is fine, when I play it in Windows Media Player it all checks out, but once I get it into a sequence in Premiere Pro CC despite it showing the audio trac

  • Security of Service Oriented Architecture and Passing the Credentials

    I have posted this in SOA Suite forum, but it is a general and conceptual question and I hope that I can receive educating responses here. With all agent and gateway concepts and the facilities SOA Suite provides, it seems to me that there is a gap b

  • I literary cannot find Library/Preferences/System Configuration? HELP!!

    Hello all! I have searched through the community and seen many people have had the same problem i get the Alert:No internet connection exclamation mark and cannot access the internet. It happened to me once and the apple support people helped me solv