Re: terrible fonts in linux-jdk1.2

1999-03-06 Thread Kazuo Oishi

Louis-David Mitterrand <[EMAIL PROTECTED]> writes:

> Has anyone else noticed the fonts (or lack thereof) in Linux-jdk1.2?
> Everything seems to be in "lucida" or is it just me?

In my environment, java or appletviewer warns lack of font
and sometimes go crash.


% java test
Font specified in font.properties not found [--zapf 
dingbats-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found [--zapf 
dingbats-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
(snip)
Font specified in font.properties not found [--zapf 
dingbats-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
SISIGSEGV   11*  segmentation violation
stackpointer=0xbfffc078


> [using Debian 2.2]

I's using Debian 2.2, too.
I got this JDK from ftp.tux.org.

-- 
大石一雄 (OISHI Kazuo)


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



examples of creating a new object in jni?

1999-03-06 Thread Kevin White

I am having a tough time piecing together the (lack of) documentation on
using native code to actually allocate (and call the constructor of) a
new object.  Can someone please point me to an example?  I have a java
class that needs to be constructed by some native code.  It will take 4
parameters in the constructor, so I'd like to see a sample with multiple
paramters.

I've been reading the JNI tutorial at sun, but they don't have an
example of this, and I've been looking through the actual JNI spec but
of course, that's like reading a dictionary to try to learn grammar...

Any pointers or suggestions are helpful and appreciated.
--
Kevin White, Software Engineer
Envision Telephony
[EMAIL PROTECTED]
[EMAIL PROTECTED]


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



NATIVE CODE

1999-03-06 Thread Dinesh D



Dear sir,
 I use linux OS.
 I want to include a "C" function for writing into sound card in a
real-time application using the "JNI".
 I wrote the "C" function and created the corresponding header files. When
I try to compile the "C" file, it gives an error message saying that the
header file "jni_md.h" is not present. The file "jni_md.h" is included in
the header file "jni.h". But, it is not there in the include directory.
 It was not provided to us during download.
 Is the file "jni_md.h" essential and if it is essential, where do I get it
 from? 
  
   I have one more question: Is there a possibility of writing raw(PCM
bytes) in to the sound card directly, without resorting to the native "C"
implementation?i.e I want to know whether I can do linux audio programming
using java?
Thanking you and awaiting an early reply,

Yours sincerely,
Dinesh D. 



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JDK1.2 size question

1999-03-06 Thread Peter Schuller

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

> The reason for this is that the default -Xmx value is 64MB. 

But that's the *maximum* heap size; why does JDK 2.0 consume, in one particular
case, 50 megs of RAM when JDK 1.1 consumed 15 megs, just because the *maximum*
heap size is higher? Does the JDK just ignore freeing memory as long as it's
under the max limit?

The problem is that you can't decrease the max limit either, I take it, since
that would make it impossible to run apps that really do requre quite a bit of
memory.

Oh and btw;  I'd like to report that JDK 1.2 seems to work
fine on Debian 2.0, except for a few probs (thought I'd mention it considering
one's half expecting it to not run at all, given the README :).

/ Peter Schuller

- ---
PGP userID: 0x5584BD98 or 'Peter Schuller <[EMAIL PROTECTED]>'
E-Mail: [EMAIL PROTECTED] Web: http://hem.passagen.se/petersch
Help create a free Java based operating system - www.jos.org.



-BEGIN PGP SIGNATURE-
Version: PGPfreeware 5.0i for non-commercial use
Charset: noconv

iQA/AwUBNuEvBsBfJ1FVhL2YEQLv/ACgwtGl1aedTo97LGAD8Zzl8zbeUmgAn11E
hMzL1onwMcMIM7QoskMvNCFv
=KeYG
-END PGP SIGNATURE-


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: open, read, ioctl calls in java?

1999-03-06 Thread Daniel Dulitz

Kevin White writes:
> I am working on a java wrapper for a linux library that uses files to
> open(), read(), and issue ioctl() calls to a device.  I assume I can
> open() and read() the device file as I would any standard file in java. 

Yes.  Be careful not to use Buffered{Input,Output}Stream with device
files unless you really mean it.  Also, devices (depending on how
they're written) often capriciously return less data than you asked
for.  That's not a bug; if it happens, it just means you have to call
read() multiple times to get all the data you want, just like you must 
when reading from a socket.

> What about the ioctl() calls?  Can I do these in java wthout using JNI? 

Not portably, no.

> If I use jni, I have seen references that certain system calls (open(),
> read(), etc.) cannot be used in the native code, due to green thread
> issues.  Is this still the case?  Is there anyway I will be able to make
> the ioctl calls?

I haven't tried this, but it shouldn't be a problem.  When using
green_threads, only system calls which might block are restricted --
that's because you don't want all the threads to stop when one thread
goes into one of those system calls.  Most drivers don't sleep for
ioctl() calls, so you probably don't need to worry about this.

If your driver's ioctl() might sleep, then you have problems;
specifically you have to live with all your threads stopping when that
ioctl() sleeps.  (When calling read() and write() from native code
under green_threads, you can link against wrapper functions that
transfer control to another thread instead of blocking.
Unfortunately, since there's no way to predict whether an ioctl() will
block--since it's not "supposed" to block in the first place--the same 
trick won't work there.

Best,
daniel dulitz

Valley Technologies, Inc.   Peak Performance Real-Time DSP
State College, PA


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: examples of creating a new object in jni?

1999-03-06 Thread Daniel Dulitz

Kevin White writes:
> I am having a tough time piecing together the (lack of) documentation on
> using native code to actually allocate (and call the constructor of) a
> new object.  Can someone please point me to an example?  I have a java
> class that needs to be constructed by some native code.  It will take 4
> parameters in the constructor, so I'd like to see a sample with multiple
> paramters.

You "just" use the standard ways to call Java methods from JNI code. :-)

Call Class.forName(String) to get an Object that corresponds to the
class you want to allocate.  Then call getDeclaredConstructors() on
that object; that will return an array of objects having type
Constructor.  Search through that array until you find the Constructor
of four arguments that you want.  Finally, call newInstance() on that
Constructor object, passing it array of type Object that contains each
of the arguments you want to pass.

That's really complicated, so there are a few ways to cheat.  Let
NativeClass be the class containing your native method, let
TargetClass be the class you want your native method to instantiate,
and assume that you want to run the following constructor:
public TargetClass (int n, double d, String s, Vector v) { ... }

Then you can use a static initializer to find the constructor you want
and assign it to a static member variable.

package com.foobar;

public class NativeClass {
static Constructor cons;
static {
final Class cTarget = Class.forName ("com.foobar.TargetClass");
final Class cStr = Class.forName ("java.lang.String");
final Class cVec = Class.forName ("java.lang.Vector");
cons = c.getConstructor
(new Class [] { Integer.TYPE, Double.TYPE, cStr, cVec });
}
// ...
// various native method declarations here
}

Now all your JNI code has to do is get the static field named "cons",
create an Object [] containing the arguments to the constructor, and
call the newInstance(Object []) method.

Best,
daniel dulitz

Valley Technologis, Inc.Peak Performance Real-Time DSP
State College, PA


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JDK1.2 size question

1999-03-06 Thread Anand Palaniswamy

Peter Schuller <[EMAIL PROTECTED]> writes:

> > The reason for this is that the default -Xmx value is 64MB. 
> 
> But that's the *maximum* heap size; why does JDK 2.0 consume, in one
> particular case, 50 megs of RAM when JDK 1.1 consumed 15 megs, just
> because the *maximum* heap size is higher? Does the JDK just ignore
> freeing memory as long as it's under the max limit?

What ps/top report is the process size.  Not the working set.  If you
had a tool that showed you the working set it should be lower than
-Xmx (for most apps).

> The problem is that you can't decrease the max limit either, I take
> it, since that would make it impossible to run apps that really do
> requre quite a bit of memory.

Again, -Xmx64m is _not required_ to runs apps under Java 2.  It is
just the default.


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JDK1.2 size question

1999-03-06 Thread Joseph H. Buehler

[EMAIL PROTECTED] (Anand Palaniswamy) writes:

> Another bad side effect of this limitation is that the famous "return
> memory to OS" bug can not be implemented on Linux (ie, there is no
> heap "shrinking").

Are you sure about that?  I use GNU emacs a lot and just tried an
experiment on a machine running RedHat because I have observed address
space shrinking on other UNIX's.  Sure enough, the "ps" command under
RedHat reports that the emacs process size increases when it reads a
big file, but decreases back to what it was when I kill the buffer.  I
don't mean the resident size, either, but the overall process address
space size.

Joe Buehler


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: examples of creating a new object in jni?

1999-03-06 Thread Juergen Kreileder

> Daniel Dulitz writes:

Daniel> Kevin White writes:
>> I am having a tough time piecing together the (lack of)
>> documentation on using native code to actually allocate (and
>> call the constructor of) a new object.  Can someone please
>> point me to an example?  I have a java class that needs to be
>> constructed by some native code.  It will take 4 parameters in
>> the constructor, so I'd like to see a sample with multiple
>> paramters.

Daniel> You "just" use the standard ways to call Java methods from
Daniel> JNI code. :-)

Daniel> Call Class.forName(String) to get an Object that
Daniel> corresponds to the class you want to allocate.  Then call
Daniel> getDeclaredConstructors() on that object; that will return
Daniel> an array of objects having type Constructor.  Search
Daniel> through that array until you find the Constructor of four
Daniel> arguments that you want.  Finally, call newInstance() on
Daniel> that Constructor object, passing it array of type Object
Daniel> that contains each of the arguments you want to pass.

Daniel> That's really complicated, so there are a few ways to
Daniel> cheat.  Let NativeClass be the class containing your
Daniel> native method, let TargetClass be the class you want your
Daniel> native method to instantiate, and assume that you want to
Daniel> run the following constructor: public TargetClass (int n,
Daniel> double d, String s, Vector v) { ... }

Daniel> Then you can use a static initializer to find the
Daniel> constructor you want and assign it to a static member
Daniel> variable.

Daniel> package com.foobar;

Daniel> public class NativeClass {
Daniel> static Constructor cons;
Daniel> static {
Daniel> final Class cTarget = Class.forName ("com.foobar.TargetClass");
Daniel> final Class cStr = Class.forName ("java.lang.String");
Daniel> final Class cVec = Class.forName ("java.lang.Vector");
Daniel> cons = c.getConstructor
Daniel> (new Class [] { Integer.TYPE, Double.TYPE, cStr, cVec });
Daniel> }
Daniel> // ...
Daniel> // various native method declarations here
Daniel> }

Daniel> Now all your JNI code has to do is get the static field
Daniel> named "cons", create an Object [] containing the arguments
Daniel> to the constructor, and call the newInstance(Object [])
Daniel> method.

I may miss the point but why don't you use something like

jclass myclz = env->FindClass("com/foobar/TargetClass");
jmethodID cons = env->GetMethodID(myclz, "", 
  "(IDLjava/lang/String;Ljava/util/Vector;)V"); 
jobject obj = env->NewObject(myclz, cons, myint, mydouble, myString, myVector);


Juergen

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


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JDK1.2 size question

1999-03-06 Thread Anand Palaniswamy

[EMAIL PROTECTED] (Joseph H. Buehler) writes:

> [EMAIL PROTECTED] (Anand Palaniswamy) writes:
> 
> > Another bad side effect of this limitation is that the famous "return
> > memory to OS" bug can not be implemented on Linux (ie, there is no
> > heap "shrinking").
> 
> Are you sure about that?  I use GNU emacs a lot and just tried an
> experiment on a machine running RedHat because I have observed address
> space shrinking on other UNIX's.  Sure enough, the "ps" command under
> RedHat reports that the emacs process size increases when it reads a
> big file, but decreases back to what it was when I kill the buffer.  I
> don't mean the resident size, either, but the overall process address
> space size.

It is possible to unmap memory and return it to the OS on Linux.  I am
sure Emacs does that.  The classic VM garbage collector can not do
that.  It wants to keep the memory mapped (so it can always be sure
that the heap is contiguous -- unmmapping might lead to someone else
stealing the part you just unmapped).  The trick classic VM uses on
Solaris and on Windows is to keep the heap mapped but not have any
swap committed to it (which is slightly different from completely
unmapping it).

Emacs can probably deal with discontiguous heaps.  (Infact I wouldn't
be surprised if there is a special heap for large files).

-Anand.


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JDK1.2 size question

1999-03-06 Thread Nathan Meyers

Anand Palaniswamy wrote:
> 
> Peter Schuller <[EMAIL PROTECTED]> writes:
> 
> > > The reason for this is that the default -Xmx value is 64MB.
> >
> > But that's the *maximum* heap size; why does JDK 2.0 consume, in one
> > particular case, 50 megs of RAM when JDK 1.1 consumed 15 megs, just
> > because the *maximum* heap size is higher? Does the JDK just ignore
> > freeing memory as long as it's under the max limit?
> 
> What ps/top report is the process size.  Not the working set.  If you
> had a tool that showed you the working set it should be lower than
> -Xmx (for most apps).

And if you had such a tool, it might look something like this little
script I hacked together a while back :-). It shows VM and RSS for all
of your processes, sorted in increasing order of RSS. You're welcome to
play with it and search for insights.

Nathan

#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1999-03-06 15:06 PST by <[EMAIL PROTECTED]>.
# Source directory was `.'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode   name
# -- -- --
#541 -rwxr-xr-x showmem
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
 && ($dir/gettext --version >/dev/null 2>&1)
  then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
  gettext_dir=$dir
fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
 && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh17924; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# = showmem ==
if test -f 'showmem' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'showmem' '(file already exists)'
else
  $echo 'x -' extracting 'showmem' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'showmem' &&
#!/bin/sh
X
echo 'Name   PID  VM  RSS'
echo '   ---  --  ---'
(
cat /proc/*/status |
perl -n -e '
Xchop;
Xif (/^Name:/)
X{
X   if ($name)
X   {
X   printf "%-20s %6d %-12s %-12s\n", $name, $pid, $vmsize, $vmrss;
X   }
X   s/.*\t//;
X   $name=$_;
X   $vmsize = "";
X   $vmrss = "";
X   $pid = "";
X}
Xif (/^VmSize:/) { s/.*\t//; $vmsize=$_; }
Xif (/^VmRSS:/) { s/.*\t//; $vmrss=$_; }
Xif (/^Pid:/) { s/.*\t//; $pid=$_; }
'
) | sort -n +4 +2
SHAR_EOF
  $shar_touch -am 0805095598 'showmem' &&
  chmod 0755 'showmem' ||
  $echo 'restore of' 'showmem' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'showmem:' 'MD5 check failed'
3beb8aea99e80601541ce14f6d370da1  showmem
SHAR_EOF
  else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'showmem'`"
test 541 -eq "$shar_count" ||
$echo 'showmem:' 'original size' '541,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh17924
exit 0




New kernel

1999-03-06 Thread Jens M Andreasen

Alan Cox has put out a new kernel to solve the multicast issue

ftp://ftp.uk.linux.org/pub/linux/alan/2.0.37pre/2.0.37-pre-patch-8.bz2 


 
   (
)  
--c[]--- [EMAIL PROTECTED] ---C---


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



New kernel

1999-03-06 Thread Steve Byrne

Jens M Andreasen writes:
 > Alan Cox has put out a new kernel to solve the multicast issue
 > 
 > ftp://ftp.uk.linux.org/pub/linux/alan/2.0.37pre/2.0.37-pre-patch-8.bz2 

It solves one problem, but seems to uncover some others.  I'm going to do a
closer analysis of what's going on, but now that Alan has fixed the one
problem, others are showing up.  I'm just about recovered from LinuxWorld and
the Open Source Summit, so I'll be giving Alan more test cases to work
with (if in fact it's actually now a kernel bug).

Steve


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JDK1.2 size question

1999-03-06 Thread Steve Byrne

Anand Palaniswamy writes:
 > [EMAIL PROTECTED] (Joseph H. Buehler) writes:
 > 
 > > [EMAIL PROTECTED] (Anand Palaniswamy) writes:
 > > 
 > > > Another bad side effect of this limitation is that the famous "return
 > > > memory to OS" bug can not be implemented on Linux (ie, there is no
 > > > heap "shrinking").
 > > 
 > > Are you sure about that?  I use GNU emacs a lot and just tried an
 > > experiment on a machine running RedHat because I have observed address
 > > space shrinking on other UNIX's.  Sure enough, the "ps" command under
 > > RedHat reports that the emacs process size increases when it reads a
 > > big file, but decreases back to what it was when I kill the buffer.  I
 > > don't mean the resident size, either, but the overall process address
 > > space size.
 > 
 > It is possible to unmap memory and return it to the OS on Linux.  I am
 > sure Emacs does that.  The classic VM garbage collector can not do
 > that.  It wants to keep the memory mapped (so it can always be sure
 > that the heap is contiguous -- unmmapping might lead to someone else
 > stealing the part you just unmapped).  The trick classic VM uses on
 > Solaris and on Windows is to keep the heap mapped but not have any
 > swap committed to it (which is slightly different from completely
 > unmapping it).
 > 
 > Emacs can probably deal with discontiguous heaps.  (Infact I wouldn't
 > be surprised if there is a special heap for large files).

Of course, you *could* think about always having contiguous heaps with
a momentary hiccup when you allocate a new larger area and then unmap the 
previous pages after you've blitted things over.  COW ZFOD pages may help; it's
something we should check out more thorougly.

Steve


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]