Re: Const in java

1999-10-14 Thread Vartan Piroumian

Hi folks,

All parameters are ALWAYS passed by value in Java.

When the parameter being passed is an object reference it is the 
VALUE OF THE REFERENCE that is passed by value, not the object being
referenced. 

This may seem like a moot distinction, but it is not.  A method cannot
destroy the reference passed to it by changing the value of the formal 
parameter.  The formal parameter is a copy.


Regards,

Vartan



[EMAIL PROTECTED] writes:
 > On Wed, 13 Oct 1999, Robert Simmons wrote:
 > 
 > > Since everything in java is passed by reference this becomes even more of an 
 >issue. 
 > > Therefore can I do the following to achieve the desired safety ? 
 > 
 > Well, everything is not passed by reference in Java.  I believe primitives
 > and immutable types are passed by value.  Someone know the exact rules
 > behind this? I always have to write a little test program to remember.
 > Okay, I'll stop being pedantic.
 > 
 > I think if you do
 > 
 > public void myFunction(final SomeClass var) {
 >  .. whatever ..
 > }
 > 
 > Will do what you desire.  Not positive though so some of the other wiser
 > folks on the list might wish to confirm this.
 > 
 > 
 > --
 > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
 > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


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



RE: JNI on linux.

1999-10-14 Thread Sachin Goyal


Hello everybody,

I also got the same problem and then i found that in java.lang.System has
one more command load(String pathname)...u can give the full path of .so
file here

e.g. i give load("/home/sachin/lib/libpers.so")

hope it helps

sachin


-Original Message-
From: Jacob Nikom [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 14, 1999 3:07 AM
To: Vijo Cherian; Java-Linux listserver
Subject: Re: JNI on linux.


Hi,

I am pretty sure, if you remove your libhello.so library
completely from your directory, you are going to get exactly
the same message. It means that your loader cannot find your
library libhello.so, even if it is in the directory.

I don't think LD_LIBRARY_PATH matters. Verify that you
have . in your path variable and classpath as well.

You also can try the command
java -classpath .;$JAVA_HOME; HelloWorld

JAVA_HOME is the /bin directory where you java, javac,
and other Java executables are located.

Good luck,

Jacob

Vijo Cherian wrote:
>
> i did everything as mentioned...
> and at `java HelloWorld` , i got the following error
>
> vijol@darkstar] ~/jni$ java HelloWorld
> Exception in thread "main" java.lang.UnsatisfiedLinkError: no hello in
> java.library.path
> at java.lang.ClassLoader.loadLibrary(Compiled Code)
> at java.lang.Runtime.loadLibrary0(Compiled Code)
> at java.lang.System.loadLibrary(Compiled Code)
> at HelloWorld.(HelloWorld.java:7)
>
> what can be done to get this working?
>
> i have libhello.so in the current directory and LD_LIBRARY_PATH points
> there, too.
>
> thanx in advance,
>
> /l / . .  _
>  l/ /l/l/(_) .
>   /l
>  (_l


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



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



Re: JNI on linux.

1999-10-14 Thread Juergen Kreileder

> Jacob Nikom writes:

Jacob> Vijo Cherian wrote:
>> 
>> i did everything as mentioned...
>> and at `java HelloWorld` , i got the following error
>> 
>> vijol@darkstar] ~/jni$ java HelloWorld
>> Exception in thread "main" java.lang.UnsatisfiedLinkError: no hello in
>> java.library.path
>> at java.lang.ClassLoader.loadLibrary(Compiled Code)
>> at java.lang.Runtime.loadLibrary0(Compiled Code)
>> at java.lang.System.loadLibrary(Compiled Code)
>> at HelloWorld.(HelloWorld.java:7)
>> 
>> what can be done to get this working?
>> 
>> i have libhello.so in the current directory and LD_LIBRARY_PATH points
>> there, too.

Set the java.library.path property to the current directory:
$ java -Djava.library.path=. HelloWorld


Juergen

-- 
Juergen Kreileder, Blackdown Java-Linux Porting Team
http://www.blackdown.org/java-linux.html


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



Re: Const in java

1999-10-14 Thread Alex M.

So there is no added benefit to declaring a parameter final other than to
allow access from inner classes within the method.

On Thu, 14 Oct 1999, Vartan Piroumian wrote:

> Hi folks,
> 
> All parameters are ALWAYS passed by value in Java.
> 
> When the parameter being passed is an object reference it is the 
> VALUE OF THE REFERENCE that is passed by value, not the object being
> referenced. 
> 
> This may seem like a moot distinction, but it is not.  A method cannot
> destroy the reference passed to it by changing the value of the formal 
> parameter.  The formal parameter is a copy.
> 
> 
> Regards,
> 
> Vartan
> 
> 
> 
> [EMAIL PROTECTED] writes:
>  > On Wed, 13 Oct 1999, Robert Simmons wrote:
>  > 
>  > > Since everything in java is passed by reference this becomes even more of an 
>issue. 
>  > > Therefore can I do the following to achieve the desired safety ? 
>  > 
>  > Well, everything is not passed by reference in Java.  I believe primitives
>  > and immutable types are passed by value.  Someone know the exact rules
>  > behind this? I always have to write a little test program to remember.
>  > Okay, I'll stop being pedantic.
>  > 
>  > I think if you do
>  > 
>  > public void myFunction(final SomeClass var) {
>  >.. whatever ..
>  > }
>  > 
>  > Will do what you desire.  Not positive though so some of the other wiser
>  > folks on the list might wish to confirm this.
>  > 
>  > 
>  > --
>  > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
>  > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> 
> 
> --
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> 


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



Re: A Global instance ?

1999-10-14 Thread Armen Yampolsky

Marc, I don't entirely understand what you have pointed out here. It sounds important, 
but I have to admit I don't get it.
Do you mean to say that, for proper synchronization, we must synchronize the whole 
getInstance method? I would think that if
another thread tried to access any of the class's fields, it would either be blocked 
at the synchronized block (if it was in
process of obtaining a reference for the first time), or it would already have a valid 
reference to the singleton, in which
case why would the fields be bogus?

And how can a thread pre-read contents of an object, if it has yet to obtain a bona 
fide instance of it?

I am still finding my thread sea legs, so to speak, so apologies for being so blind to 
this.

-Armen


> On Wed, 13 Oct 1999, Peter Pilgrim wrote:
>
> > Or perhaps alternatively the lazy singleton.
> >
> > public class NetworkPrinter {
> >
> >   protected PaperStackpaper
> >   protected static Object locker = new Object();
> >   private static NetworkPrinter   thePrinter = null;
> >
> >
> >   private NetworkPrinter ( )
> >   {
> >   }
> >
> >   public static NetworkPrinter getInstance()
> >   {
> >   if ( thePrinter != null ) {
> >   // Thread Safety - Double Guard technique
> >  synchronized( locker )
> >   if ( thePrinter != null ) {
> >thePrinter = new NetworkPrinter();
> >  }
> >   }
> >   return (thePrinter);
>
> (yea, this is somewhat offtopic, but...)
>
> This is not properly synchronized, as I have been taught by someone with
> more sense than I have.
>
> The basic problem revolves around the fact that synchronization is
> not just for serialization but is also for visibility.  ie. without
> synchronization, you are not always guaranteed that a change made by
> one thread is visible in another.  Sometimes this is ok.
>
> Although the JLS guarantees that the thePrinter reference must be
> fully visible if it is visible, it doesn't guarantee that instance
> variables, etc. of the class that thePrinter references are also
> visible.  So if the creating thread is still in the synchronized
> block, then the value stored in thePrinter may be copied to main
> memory, but things like instance variables may not be, so when
> another thread tries to use them they are bogus.
>
> In addition, apparently another thread could have pre-read the contents
> of the object referenced by thePrinter before it reads the reference
> in thePrinter.
>
> What it boils down to is you can't cheat on synchronization.
>


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



Re: Const in java

1999-10-14 Thread Vartan Piroumian

OK, last one, and then maybe we should take this "offline" because it
is not a Java linux question...

A "final" parameter is REQUIRED by the compiler if the variable is
referred to by an inner class. 

All local variables must be declared final when referred to by inner
class definitions.  This includes paramaters.  This is required in
order to maintain the relationship between the outer object and the
inner object. 

Vartan



Alex M. writes:
 > So there is no added benefit to declaring a parameter final other than to
 > allow access from inner classes within the method.
 > 
 > On Thu, 14 Oct 1999, Vartan Piroumian wrote:
 > 
 > > Hi folks,
 > > 
 > > All parameters are ALWAYS passed by value in Java.
 > > 
 > > When the parameter being passed is an object reference it is the 
 > > VALUE OF THE REFERENCE that is passed by value, not the object being
 > > referenced. 
 > > 
 > > This may seem like a moot distinction, but it is not.  A method cannot
 > > destroy the reference passed to it by changing the value of the formal 
 > > parameter.  The formal parameter is a copy.
 > > 
 > > 
 > > Regards,
 > > 
 > > Vartan
 > > 
 > > 
 > > 
 > > [EMAIL PROTECTED] writes:
 > >  > On Wed, 13 Oct 1999, Robert Simmons wrote:
 > >  > 
 > >  > > Since everything in java is passed by reference this becomes even more of an 
 >issue. 
 > >  > > Therefore can I do the following to achieve the desired safety ? 
 > >  > 
 > >  > Well, everything is not passed by reference in Java.  I believe primitives
 > >  > and immutable types are passed by value.  Someone know the exact rules
 > >  > behind this? I always have to write a little test program to remember.
 > >  > Okay, I'll stop being pedantic.
 > >  > 
 > >  > I think if you do
 > >  > 
 > >  > public void myFunction(final SomeClass var) {
 > >  > .. whatever ..
 > >  > }
 > >  > 
 > >  > Will do what you desire.  Not positive though so some of the other wiser
 > >  > folks on the list might wish to confirm this.
 > >  > 
 > >  > 
 > >  > --
 > >  > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
 > >  > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
 > > 
 > > 
 > > --
 > > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
 > > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
 > > 


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



Re: Const in java

1999-10-14 Thread Michael Sinz

On Thu, 14 Oct 1999 09:26:32 -0500 (CDT), Alex M. wrote:

>So there is no added benefit to declaring a parameter final other than to
>allow access from inner classes within the method.

Well, that is one benefit.  But the other benefit is a code maintainance
and readability issue.

By saying that a parameter is final you assure that no code within the
method will change that variable.  No, it does not make sure you do not
do methods on the object it may be a reference to but it does say you will
not change the reference.

For example:

void foo(Object x)
{
//... do some stuff
x=new Object();

//... do some more stuff
}

Sometimes this type of code is useful but sometimes it is just a bug
in thinking.  If you code the same thing with:

void foo(final Object x)
{
//... do some stuff
x=new Object();

//... do some more stuff
}

then the compiler will get upset since you can not change the value of
x.

Again, remember that there is a difference.  In fact, just like in C/C++,
a const pointer just means that it will not change what it points to and
not that what it points to will not be changed.

That is if char *x is a const pointer then it will always point to the
same memory location but the string at that location may change.  If
it is a pointer to a const, then the memory at that location will not
change but the location it points to may change.  In C/C++, if you want
both the point to be constant and what it points to be constant you
need a const pointer to a const char - aka "const char * const x"

-- 
Michael Sinz  Technology and Engineering Director/Consultant
"Starting Startups" mailto:[EMAIL PROTECTED]
My place on the web ---> http://www.users.fast.net/~michael_sinz



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



reminder - this list is for Java & Linux

1999-10-14 Thread Nelson Minar

We've had a lot of discussions on the list recently that were generic
questions about Java, questions that had nothing to do with Linux. I'm
sending this note to remind everyone that this mailing list is about
Java on Linux. If you have generic Java questions, they do not belong
here. I encourage list members not to reply to questions unless they
have some interest to Linux users.

I apologize if this sounds unreasonable, but it's important that we
keep this mailing list focussed on Linux. There are plenty of other
places to ask generic Java questions.

  [EMAIL PROTECTED]
.   .  . ..   .  . . http://www.media.mit.edu/~nelson/


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



Where is it?

1999-10-14 Thread webmaster



OK. I am new to the java world and have installed java on my 
redhat 6.0 system. I downloaded version 1.1.7 . I am missing the directory of 
docs and samples. Where are these located? 


Re: Where is it?

1999-10-14 Thread Alex M.

You get those from java.sun.com, docs and apis.

On Thu, 14 Oct 1999 [EMAIL PROTECTED] wrote:

> OK. I am new to the java world and have installed java on my redhat 6.0 system. I 
>downloaded version 1.1.7 . I am missing the directory of docs and samples. Where are 
>these located? 
> 


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



Re: Where is it?

1999-10-14 Thread Ruchir Tewari


These are no different from those on other platforms.
You can get both off the web -

docs at
http://java.sun.com/products/jdk/1.1/docs/index.html

samples at
http://www.javasoft.com/applets/jdk/1.1/index.html

g'luck,
Ruchir


From: [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
Subject: Where is it?
Date: Thu, 14 Oct 1999 13:29:17 -0700

OK. I am new to the java world and have installed java on my redhat 6.0 
system. I downloaded version 1.1.7 . I am missing the directory of docs and 
samples. Where are these located?

__
Get Your Private, Free Email at http://www.hotmail.com


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



Re: Benchmark results for Linux JVMs (formatted for 70 columns)

1999-10-14 Thread Renzo Pecoraro


does anyone know why I can't access any alphaworks.ibm.com webpage with
netscape 4.6 from my linux box?? netscape always stalls after after a
few bytes...

thanks!
renzo



Raja Vallee-Rai wrote:
> 
> I goofed with the last message and messed up the formatting.
> Here's a better version:
> 
> -Raja
> 
> -
> 
> Hello,
> 
> We have formally evaluated the different virtual machines available
> for Linux and thought it would be worthwhile to share the results with
> the Linux community.
> 
> The following tests were conducted on an unloaded dual processor
> Pentium II/400mhz running Debian GNU/Linux (kernel 2.2.8).  Each
> benchmark execution was repeated ten times.  We discarded the maximum
> and minimum results, and averaged the remaining 8 execution times.
> 
> The first 9 benchmarks come from the specJVM98 benchmark suite
> (http://www.spec.org), and the last two benchmarks come from our own
> private collection.
> 
> base(s): time in seconds to run under blackdown jdk 1.2, pre-release
> 2, with jit.
> 
> sunint: speedup (base time/this time) of the blackdown jdk1.2,
> pre-release 2, with no jit.
> 
> borjit: speedup of blackdown jdk1.2, pre-release 2, with the Borland
> jit installed (http://www.borland.com)
> 
> ibmjit: speedup of the AlphaWorks IBM 1.1.8 JIT
> (http://www.alphaworks.ibm.com)
> 
> A # indicates that the run failed validity checks.
> 
>base(s)sunintborjitibmjit
>  check .84 -1.33 -1.25 #1.75 -
>   compress   65.61 - .15 -1.07 -2.42 -
> db  148.43 - .57 - .98 -2.98 -
>   jack   64.50 - .43 -1.35 -3.65 -
>  javac   75.67 - .54 -1.21 -2.51 -
>   jess   50.86 - .47 -1.44 -2.67 -
>  mpegaudio   54.61 - .15 -1.19 #2.32 -
>   mtrt   40.32 - .41 -1.78 -2.79 -
>   raytrace   55.56 - .45 -1.92 -3.04 -
>  sablecc-w   42.57 - .58 -1.06 -2.32 -
> soot-j  132.93 - .69 -1.25 -2.26 -
> 
> The conclusions are fairly obvious.  Now, if only IBM had a jit for
> 1.2...  We also evaluated shujit and tyajit, but they were unable to
> run most of the benchmarks correctly. Stay tuned for a comparison of
> NT Java Virtual Machines in the near future, on the same hardware.
> 
> Permission is granted to re-distribute this e-mail in any medium as
> long as it remains unchanged.  All trademarks belong to their
> respective owners.
> 
> To everyone working on Java for Linux: keep up the great work! :)
> 
> Best regards,
> 
> Raja Vallee-Rai ([EMAIL PROTECTED])
> Sable Research Group
> 
> --
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


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



3D API

1999-10-14 Thread videoranger


Ladies, Gentlemen:

Greetings once again!

I've been looking at some stuff concerning the 3D API over at the Java
Developers Connection.

Is this stuff included in the blackdown 1.2 prerelease or is it
something I have to add from sun? does it even work with the blackdown
jdk?

Man, I'm just FULL of questions...

Best Regards,
James


-- 
"The reverse side also has a |James G. Stallings II
 reverse side"   | http://angelfire.com/id/videoranger
- Japanese Proverb   |  ''Live Long and Prosper''



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



JDBC for mysql?

1999-10-14 Thread Brian Gilman

Hello all!

although this is not *exactly* a java Linux question, I 
believe it is close enough.Can someone point me to a mysql driver 
for jdbc? Thanks in advance!

sincerely,

Brian Gilman
-BEGIN PGP PUBLIC KEY BLOCK-
Version: PGPfreeware 6.5.1 for non-commercial use 

mQENAzfgDVUAAAEIALTF+F7yvAThOGDVYagMf8wL8ZWjTNn9xzY9t8OBWyQwJO6b73ozK6 
nA148NhNkxGLBgH0FVZ3EHOW5Fxvjc6/TYuUPXjJ4R3o6HxyM/wbWYH/Hjz7kgIYdKQBBH 
bhvaVzWuNfjqsnsB9fp2bkG+rlDM7CKyZQc23Kwgrk7rqyaBBBzgwom7fXZVjnGoIqCmLS 
B3je/HgbC5l0EHsSFxKbhF904R0HCEaYcVksSjbsATW1Qu0L5t0hMAsiitQ5/ToXFYWFwx 
7AexVHPHzWOZ8VZQUxmfi5v00r27MdffXH/mqipvKEGl1TIxpo71Pm5dbfAJrw5X6t2vv7 
IOmfw4INEABRG0JkJyaWFuIEdpbG1hbiA8Z2lsbWFuYkB2dXNlci51bmlvbi5lZHU+iQEV 
AwUQN+ANVb+yDpn8OCDRAQEtUQf/T9dMe4iW9885Om0KrzvcFwmYcHKEBc4ykwEPH0+J2C 
sjA9lWpU03CIIY+t/omuw5GcArildpZYFB0S145+90APVg6dsRF6b2Kuw7FMPdL8Yz7vWi 
vjT/2rhHsvYBAQmcsrLrPjhfyD0kTByg/CUSp2rVAbmR54zUsMXe6bDdleOW4rGo+jepf6 
J1TsCXEFzbym1nFX5aZ9oU8KtfQky8/E85z7JdDvDNC0nC5jWPwGpyrUNrpCWN+TQSpQFP 
xNrqrTU19X4+Oe1Gyzyf363tUsS/jMnvAKOLkWsI4k75wY/HHTvn0lq3GWeRwj2BJLeihG 
XvaiWEi3lRwCKiGUZKKg===wwNh
-END PGP PUBLIC KEY BLOCK-


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