No print service found java windows

No print service found java windows

Post by sorin_ristache » Thu Mar 24, 2005 2:39 pm

is a 100% pure Java application. That means it doesn’t use native code specific to a platform so the problem is between the Java virtual machine and the operating system.

If the printing system is CUPS and is working on that machine for non-Java applications then a workaround which works for the Debian distribution is to use Sun’s Java version 1.4.2 instead of 1.5. On any Linux distribution to change the Java virtual machine used by you must change the value of the key lax.nl.current.vm in the file Oxygen.lax located in the install directory so that it points to the appropriate executable. Before that make sure the package cupsys-bsd is installed on your machine and that the directory /usr/sbin is added to the PATH variable. This is necessary because the Java virtual machine executes a call «lpc status» to get a list of the valid printers installed and the command lpc is located in /usr/sbin. You can check this yourself by running «lpc status» at the console prompt.

If that doesn’t work you should uninstall CUPS and install the package called lpr instead. It contains the traditional Linux printing system.

Best regards,
Sorin

Post by CapnKirk » Thu Mar 24, 2005 4:53 pm

Thanks for your informative response.

I have installed in /usr/local/lib/oxygen. There is no Oxygen.lax file there. I then did a complete search of my system. No file. I then went into the oxygen.tar.gz file: nope.

Читайте также:  Android studio linux ярлык

Maybe there was a glitch at install time, perhaps?

My system is dual boot with Debian and WinXP. I have installed there as well. I just checked. No file there, either.

Printing out unicode from Java code issue in windows console

I have got a problem with printing out a unicode symbol in the windows console.

Here’s the java code that prints out the unicode symbol value;

The problem doesn’t exist when I run the program in Eclipse with encoding settings as UTF-8, however when it comes to windows console the symbol gets replaced by a question mark.

The following was done to try overcome this problem, with no success;

Change the font of windows console to Lucida Console.

Every time I run windows console I will change the encoding settings, i.e. with the use of chcp 65001

An extra step I’ve tried a few times was running the java file with an argument, i.e. java -Dfile.encoding=UTF-8 Filter (where «Filter» is name of the class)

3 Answers 3

By default, the code-page using in the CMD of Windows is 437. You can test by run this command in the prompt:

And, this code-page prevent you from showing Unicode characters properly! You have to change code page to 65001 AND using -Dfile.encoding=UTF-8 for that purpose.

In additions to the steps you have taken, you also need a PrintStream/PrintWriter that encodes the printed characters to UTF-8.

Unfortunately, Java designers have chosen to open the standard streams with the so called «default» encoding, which is almost always unusable *) under Windows. Hence, using System.out and System.err naively will make your program output appear differently, depending on where you run it. This is straight against the goal: compile once, run anywhere.

Читайте также:  Посмотреть текущую частоту процессора linux

*) It will be some non standard «code page» nobody except Microsoft recognizes on this planet. And AFAIK, if for example you have a German keyboard and a «German» OEM Windows and you want to have date and time in your home time zone, there is just no way to say: But I want UTF-8 input/output in my CMD window. This is one reason why I have my dual Ubuntu booted most of the time, where it goes without saying that the terminal does UTF-8.

The following usually works for me in JDK7:

java.awt.print.PrinterException: Invalid name of PrintService

I would ask it in the form of a question, but I have no idea why I’m getting this exception. I can’t find any real documentation online either.

To give you context although I don’t think it’s really relevant, I’m using it within the JFreeReport classic engine reporting framework.

The stacktrace is:

Any ideas or suggestions as to what’s happening here would be greatly appreciated!

Update: It would be great to also find some documentation on where and when this error is generated.

2 Answers 2

The print service name should be the name of your printer. The PrintUtil class I am using at the moment brings up a dialog listing the printers I have setup in my operating system. Can you print from other applications using your computer?

If not you need to configure your printer, otherwise you may want to check if jFreeReport needs a default printer specified somewhere. Since JFreeReport is open source, you should be able to create a simple test program using just the PrintUtil class — that may make it easier to demonstrate what is going wrong with code.

Читайте также:  Как резервировать windows 10

I had the same problem. Java just do not print my print job.

So I realised that, my company, just changed the main printer. Then I removed the old one from my printer’s list (win 8) and set the new one as default.

Оцените статью
Adblock
detector