Re: Printing

1998-08-14 Thread Juergen Kreileder

"Laura L. Evangelista" <[EMAIL PROTECTED]> writes:

> John Zukowski wrote:
> 
> > Does the Linux JDK support printing?
> 
> If you mean it comes with the JDK, yes ... I'm using JDK 1.1.3.
> 
> > The error message seems to imply that it didn't come from the source in
> > from the AWT book. Is this something you added, or does it come from the
> > Linux port?
> 
> The error did not come from the source. This error dialog is part of the
> Print Dialog that comes up when the getPrintJob() method is called ... (I did
> not change anything in the source code.) ... Right there, pjob becomes null,
> not giving me the chance to get into the loop following it ...
> 
> > I'm no longer on the Java-Linux mailing list, so I'm not sure if anyone
> > else answered this for you already.
> 
> My problem has not been solved yet ...
> 
> I hope somebody can help me ... Printing is a real necessity ...
> 

Printing with java 1.1.6 on linux works, I don't know if it works with 1.1.3.
The error you get is thrown if java cannot execute /usr/bin/lpr or
/usr/bin/lp. Does one of these files exist on your system?
Have you tried printing to a file?


Jürgen

-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802



Re: Time zone handling broken in Linux java?

1998-08-14 Thread Juergen Kreileder

Mats Petersson <[EMAIL PROTECTED]> writes:

> Hello!
> 
> I recently downloaded JDK 1.1.6 v2, and I have problems getting it
> correctly interpret the timezone setting on my machine. Since I live
> in Sweden, my timezone is "MET DST", however this seems to confuse
> java. The time returned from Date() is 2 1/2 hours ahead of the local
> time (?). However, if I make the timezone GMT or UTC or something more
> "common", it seems to work as it should. Still, it doesn't recognize 
> any offset, i.e. "GMT +2" or something similar.
> 
> Is this a linux specific quirk, or is it a general bug in java?

It's a sun bug. It has been fixed in JDK-1.2b4.

You might want to try "TZ=ECT java DateTest".


Jürgen

-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802



Re: Printing

1998-08-14 Thread Laura L. Evangelista

> Printing with java 1.1.6 on linux works, I don't know if it works with 1.1.3.

Have you tried running the code I attached to my first post?
(TestPrint.java)

> The error you get is thrown if java cannot execute /usr/bin/lpr or
> /usr/bin/lp. Does one of these files exist on your system?

lpr exists ... and I use it in printing a web page (Netscape) and
even redirecting output to printer ...

> Have you tried printing to a file?

Yes ... and it did print to a file ... However, the text at the
left and top margin were cut off ...


What could be the problem (saving to Printer)?

Than'x!

-- Laura



Wrong time in Clock demo (fwd)

1998-08-14 Thread Steve Byrne

Mats Petersson writes:
 > 
 > Hello!
 > 
 > I just downloaded JDK v1.1.6 v2, and I have tried some of the demos
 > included. Most of them work fine, except for the "Clock" demo,
 > which shows completely wrong time when running it with appletviewer.
 > In Netscape it works as it should, though.
 > I guess there has to be something with appletviewer, since it
 > works ok in NS.

In what way is the time wrong?  Is it just the timezone, or does it show 2:43
when it's really 8:19?

Steve



Re: Printing

1998-08-14 Thread Steve Byrne

Uncle George writes:
 > it is most likely trying to run the "lp" as in ( i tyhink) "/usr/bin/lp"
 > which doesnt exist there under redhat. u can symbolically link the lp's
 > together.

That won't be enough -- the code uses the arguments that lp understands.

I fixed this in 1.1.6v2 -- I can't tell from the message whether that's the
version you are using, but if it's not, that's the problem.

 > Laura L. Evangelista wrote:
 > 
 > > Sir,
 > >
 > > I tried to run your sample application "TestPrint" but it
 > > wouldn't print anything ... The print dialog shows up. But when I
 > > choose "Print" from the dialog, a "Print Error" dialog shows up
 > > with the message:
 > >
 > > "Could not execute print
 > > command: [Ljava.lang.String;@80cbe12"
 > >
 > 
 > 
 > 



install JDK without AWT ? [ no x11 ]

1998-08-14 Thread Steve Byrne

RTFM (README.linux).  Yes, X/AWT isn't required.



Re: Wrong time in Clock demo (fwd)

1998-08-14 Thread Mats Petersson

On Thu, 13 Aug 1998, Steve Byrne wrote:

> Mats Petersson writes:
>  > 
>  > Hello!
>  > 
>  > I just downloaded JDK v1.1.6 v2, and I have tried some of the demos
>  > included. Most of them work fine, except for the "Clock" demo,
>  > which shows completely wrong time when running it with appletviewer.
>  > In Netscape it works as it should, though.
>  > I guess there has to be something with appletviewer, since it
>  > works ok in NS.
> 
> In what way is the time wrong?  Is it just the timezone, or does it show 2:43
> when it's really 8:19?
> 
> Steve
> 
> 
> 

I got an answer from another person here on the list about this, he said
it's a Sun bug. What happens is that java doesn't seem to recognize the
"MET" timezone designator, which is what I use currently (Sweden...)
He suggested that I change the timezone to "ECT" instead, thought it
was supposed to be CET, whatever, haven't heard of ECT before but it
works at least =|:-)
According to the person I talked to, Sun will fix this in 1.2b4.
So I guess I'll just stick to "ECT" until they fix this...

Best Regards,
Mats Petersson



Re: Wrong time in Clock demo (fwd)

1998-08-14 Thread Rob Nugent

You might like to look at my bug

http://developer.javasoft.com/developer/bugParade/bugs/4124203.html

and the one it was closed as a duplicate of. In the U.K, the clocks were fine until
JDK 114 shipped, and they
had "fixed" the fact that the GMT time zone went on to daylight savings time. My
clocks have been out an
hour ever since, on both Linux and WinNT.

Of course, "fixed in JDK 1.2" doesn't help very much.

Rob

Mats Petersson wrote:

> On Thu, 13 Aug 1998, Steve Byrne wrote:
>
> > Mats Petersson writes:
> >  >
> >  > Hello!
> >  >
> >  > I just downloaded JDK v1.1.6 v2, and I have tried some of the demos
> >  > included. Most of them work fine, except for the "Clock" demo,
> >  > which shows completely wrong time when running it with appletviewer.
> >  > In Netscape it works as it should, though.
> >  > I guess there has to be something with appletviewer, since it
> >  > works ok in NS.
> >
> > In what way is the time wrong?  Is it just the timezone, or does it show 2:43
> > when it's really 8:19?
> >
> > Steve
> >
> >
> >
>
> I got an answer from another person here on the list about this, he said
> it's a Sun bug. What happens is that java doesn't seem to recognize the
> "MET" timezone designator, which is what I use currently (Sweden...)
> He suggested that I change the timezone to "ECT" instead, thought it
> was supposed to be CET, whatever, haven't heard of ECT before but it
> works at least =|:-)
> According to the person I talked to, Sun will fix this in 1.2b4.
> So I guess I'll just stick to "ECT" until they fix this...
>
> Best Regards,
> Mats Petersson



--


Rob Nugent
Development Manager
UniKix Technologies Europe
[EMAIL PROTECTED]
Tel: +44 (0) 1489 585503
Fax: +44 (0) 1489 881363




Re: Wrong time in Clock demo (fwd)

1998-08-14 Thread Mats Petersson

On Fri, 14 Aug 1998, Rob Nugent wrote:

> You might like to look at my bug
> 
> http://developer.javasoft.com/developer/bugParade/bugs/4124203.html
> 
> and the one it was closed as a duplicate of. In the U.K, the clocks were fine until
> JDK 114 shipped, and they
> had "fixed" the fact that the GMT time zone went on to daylight savings time. My
> clocks have been out an
> hour ever since, on both Linux and WinNT.
> 
> Of course, "fixed in JDK 1.2" doesn't help very much.
> 
> Rob
> 

Maybe not :) kind of annoying this stuff for sure... and what is ECT? 
it seems to work here at least... maybe "European Central Time", as 
opposed (or similar, how you see it) to CET, "Central European Time".
Whatever... getting tired of this shit hehe... 

Take care,
Mats



Re: "Tried to free bogus memory"...

1998-08-14 Thread Hoe-Teck Wee

Hello!

>I am using jdk1.1.6 v2, and I get the message 
>   "Tried to free bogus memory , ignored"

README.linux for the jdk 1.1.6 v2 from sbb reads:

"Resizing AWT components has been linked with memory corruption.  As of the
time of this writing, it appears that the corruption (double freeing) is
happening within Motif or Xt.  By default, this release does some extra checking
for this case and ignores duplicated free operations."

That's what happening on your system. Hope that clarified things somewhat.

- hoeteck



No DB connection in Netscape ? Please help.

1998-08-14 Thread Kapoor, Nishikant X

Hello friends

I have apache-1.1.3-3 and PostgreSQL-6.3.2 running on my Linux RH4.2,
kernel 2.0.30 (genx). I have a Java Applet that tries to connect to
PostgreSQL
using JDBC, from NS-4.5b1 on an IBM RISC6000, AIX-4.1.4 (mm01).

Typing "mm01: netscape http://genx/PrfApplet.htm" brings up the applet
in the NS
but the database connection is not established. The Java console shows:

openDb(PrfDb):Connecting to Database URL = jdbc:postgresql:prfdb...
openDb(PrfDb): Could not connect. e= security.Couldn't connect to
'localhost' with origin from 'genx'.

The same problems exits when I start NS from the same machine where the
PostgreSQL
server is running i.e. the Linux box(genx).

*** But, when I use "genx: netscape http://127.0.0.1/PrfApplet.htm" on
genx, the
*** database connection gets established.

The two machines genx and mm01 are on the same network and can ping each
other
using the hostnames.

THE CLASSPATH IS *NOT* SET ON RISC MACHINE (mm01) and the postgresql.jar
is already
in mm01:$MOZILLA_HOME/java/classes. The JDBC interface is as follows:

// Load the driver
try {
  Class.forName(PrfConstants.DB_DRVR);
} catch(Exception e) {
System.out.println("openDb(PrfDb): Class.forName() failed. e= "
+ e.getMessage());
return (false);
  }

// Connect to database
System.out.println("openDb(PrfDb):Connecting to Database. URL =
jdbc:postgresql:prfdb...");
try {
  connect = DriverManager.getConnection("jdbc:postgresql:prfdb",
"postgres", "");
} catch (SQLException e) {
System.out.println("openDb(PrfDb): Could not connect to
database. e=" + e.getMessage() );
connect = null;
return (false);
  } catch (Exception e) {
  System.out.println("openDb(PrfDb): Could not connect. e= " +
e.getMessage());
  connect = null;
  return (false);
}

Can someone please help me. This has been much more complicated than
what I'd anticipated.

I'm not sure if this is a problem at Java end or the PostgreSQL end. So,
please
excuse me if I've posted this problem to the wrong group. I'm just
desperate for help !!!

Thanks much in advance.
Nishi

To err is human but to really mess it up is computer
mailto:[EMAIL PROTECTED]   http://www.c3ipros.com/nkapoor
---~~~--



Re: No DB connection in Netscape ? Please help.

1998-08-14 Thread Kenny Freeman

I could be on thin ice, but applets can only make connections to the site
that they were loaded from. I noticed a security... something or other in
the java console o/p (just a quick look). Maybe that explains why you can
connect on one machine, and not the other

On Fri, 14 Aug 1998, Kapoor, Nishikant X wrote:

> Hello friends
> 
> I have apache-1.1.3-3 and PostgreSQL-6.3.2 running on my Linux RH4.2,
> kernel 2.0.30 (genx). I have a Java Applet that tries to connect to
> PostgreSQL
> using JDBC, from NS-4.5b1 on an IBM RISC6000, AIX-4.1.4 (mm01).
> 
> Typing "mm01: netscape http://genx/PrfApplet.htm" brings up the applet
> in the NS
> but the database connection is not established. The Java console shows:
> 
> openDb(PrfDb):Connecting to Database URL = jdbc:postgresql:prfdb...
> openDb(PrfDb): Could not connect. e= security.Couldn't connect to
> 'localhost' with origin from 'genx'.
> 
> The same problems exits when I start NS from the same machine where the
> PostgreSQL
> server is running i.e. the Linux box(genx).
> 
> *** But, when I use "genx: netscape http://127.0.0.1/PrfApplet.htm" on
> genx, the
> *** database connection gets established.
> 
> The two machines genx and mm01 are on the same network and can ping each
> other
> using the hostnames.
> 
> THE CLASSPATH IS *NOT* SET ON RISC MACHINE (mm01) and the postgresql.jar
> is already
> in mm01:$MOZILLA_HOME/java/classes. The JDBC interface is as follows:
> 
> // Load the driver
> try {
>   Class.forName(PrfConstants.DB_DRVR);
> } catch(Exception e) {
> System.out.println("openDb(PrfDb): Class.forName() failed. e= "
> + e.getMessage());
> return (false);
>   }
> 
> // Connect to database
> System.out.println("openDb(PrfDb):Connecting to Database. URL =
> jdbc:postgresql:prfdb...");
> try {
>   connect = DriverManager.getConnection("jdbc:postgresql:prfdb",
> "postgres", "");
> } catch (SQLException e) {
> System.out.println("openDb(PrfDb): Could not connect to
> database. e=" + e.getMessage() );
> connect = null;
> return (false);
>   } catch (Exception e) {
>   System.out.println("openDb(PrfDb): Could not connect. e= " +
> e.getMessage());
>   connect = null;
>   return (false);
> }
> 
> Can someone please help me. This has been much more complicated than
> what I'd anticipated.
> 
> I'm not sure if this is a problem at Java end or the PostgreSQL end. So,
> please
> excuse me if I've posted this problem to the wrong group. I'm just
> desperate for help !!!
> 
> Thanks much in advance.
> Nishi
> 
> To err is human but to really mess it up is computer
> mailto:[EMAIL PROTECTED]   http://www.c3ipros.com/nkapoor
> ---~~~--
> 



re: Can´t load a RTF-Document in JEditorPane

1998-08-14 Thread Steve Alexander

[EMAIL PROTECTED] (Bernhard Hoelcker) wrote:
> Hi,
> To load a RTF-document, I tried to use an JEditorPane and
> invoke the read(Reader,null) method of its superclass JTextPane.
>
> But there is allways an IOException: ´RFT is an 8-Bit format´.
>
> I tried to build the Reader with: 
>
> InputStreamReader(new FileInputStream(fileName),encoding).
> I tried every BytetoChar-Adapter I could find in the classes.zip, but it
> don´t work (see example attached).
>
> Does the read method require a special second parameter? 
> Can´t find any Documention about this parameter.
> Thank you for any help,
>
> Bernhard


use com.sun.java.swing.text.rtf.RTFEditorKit's method:
  read(java.io.InputStream in, Document doc, int pos) 
instead.

You'll have to create an appropriate document using
createDefaultDocument().


Steve.
 
-
Steve Alexander   Linguistics and MEL
[EMAIL PROTECTED]  Lancaster University
--- Sun Certified Java Programmer ---



Re: Socket connect timeout (user threads and blocking)

1998-08-14 Thread Kevin B. Hendricks

Hi,

Just to clarify a few things.  There is very little difference in
performance between a user based green_threads implementation and a kernel
threads (native) implementation (except for scheduling rules) on single
processor systems.  If done well, user based threads can even be faster
than kernel based (native) threads on single processor systems due to the
need to set and restore a smaller context (less overhead during switching).

The v3 version of jdk116 uses non-blocking io for all io system calls
including stdin (that was one of the fixes for v3).  So user threads do not
(should not!) block on io and the entire user based thread package does not
stop.

This works as follows:

A call is made to an read from an fd (which has already been set to be
non-blocking).  It will return errno equal to EAGAIN immediately if no data
is ready to be read.  That user thread will then enter a waiting list and
yield to the next thread.  It will stay that way until a sigio comes in.
The signal handler does a select() to determine which of the waiting
threads are ready to run (i.e. their file descriptor is ready for io) and
that thread is awakened.

I hope this description helps.  Although the green threads model catches
alot of flack, it it not that much different from a user-based pthreads
implementation.  Sun just needs to fine tune it abit more "some might say a
lot!".

Hopefully a native threads version will come soon (a few people are working
on it), but don't expect a big performance boost on uni-processor machines.


Please let me know if I haven't explained this well.  I hope this helps.

Kevin
Linux PPC JDK porting team
[EMAIL PROTECTED]


--
Kevin B. Hendricks
Associate Professor, Operations & Information Technology
School of Business, College of William & Mary
Williamsburg, VA 23187, [EMAIL PROTECTED]
http://business.tyler.wm.edu