Another keytool error

1999-10-13 Thread ermirza erekose


Hi,

Anybody knows what these mean ???

  PINE 4.10   COMPOSE MESSAGE   Folder: INBOX  8
Messages   

To  : [EMAIL PROTECTED]
Cc  : 
Attchmnt: 
Subject : Another keytool error
- Message Text -

Hi,

Anybody knows what these mean ???

#keytool -genkey -v -alias signer -keysize 1024 -dname 69.15.9.167 \
-validity 365 -keypass mindterm -keystore store -storepass fish123
Exception in thread "main" java.lang.OutOfMemoryError
at java.lang.StringBuffer.expandCapacity(Compiled Code)
at java.lang.StringBuffer.append(Compiled Code)
at sun.security.x509.AVA.(Compiled Code)
at sun.security.x509.X500Name.parseRDN(Compiled Code)
at sun.security.x509.X500Name.parseDN(Compiled Code)
at sun.security.x509.X500Name.(Compiled Code)
at sun.security.tools.KeyTool.doGenKeyPair(Compiled Code)
at sun.security.tools.KeyTool.doCommands(Compiled Code)
at sun.security.tools.KeyTool.run(Compiled Code)
at sun.security.tools.KeyTool.main(Compiled Code)

Thanks

erekose



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



keytool on jdk1.2

1999-10-13 Thread ermirza erekose


Hi,

I just installed jdk1.2 pre 2 on Linux Mandrake 6.0 on i386 platform.  I
tried to create a signed applet using the keytool command.  

keytool -alias signer -genkey
Enter keystore password:  *
What is your first and last name?
  [Unknown]:  ermirza erekose
What is the name of your organizational unit?
  [Unknown]:  Fish
What is the name of your organization?
  [Unknown]:  Fish Ltd
What is the name of your City or Locality?
  [Unknown]:  Kuala Lumpur
What is the name of your State or Province?
  [Unknown]:  Wilayah Persekutuan
What is the two-letter country code for this unit?
  [Unknown]:  MY
Is  correct?
  [no]:  y

But then it won't generate any cert .. it just hangs there ... 

Is this a bug or is there any patch/workaround ... also I found that
"identitidb.obj" is not available on the ported jdk1.2.


Pliz help coz I am in need of signing my applet (Mindterm exactly)

Thanks




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



Re: Problems with JDB

1999-10-13 Thread Rachit Siamwalla

> 
> > Ever try System.out.print() or the "Ctrl-\" thing?
> 
> 
> What is the "Ctrl-\"  thing?

Ctrl-\ or SIGQUIT will give you a "thread-dump" of the jvm. Consider it
like a combination of "info threads" and "bt" in gdb rolled into one.
Plus, you can call it anytime at will. It also prints out all monitor
locks. It is an indispensable tool when looking for deadlocks or even
busy loops in your program. It also helps a million with AWT
development. This is one great debugging tool that sun gave to us with
java.

i could never get jdb to do anything sensible.

-rchit


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



Re: Debugger

1999-10-13 Thread Alexander Davydenko

Brian Miller wrote:
> 
> I was wondering what debugger people are using?  Does a Linux port of
> ddd exist?

IMHO pure jdb from terminal with some patience is a nice choice, especially
if threads debugging. There is a jd from alphaworks. It's a java written,
and
quite robust.

Cheers.

-- 
Alexander Davydenko |
[EMAIL PROTECTED], [EMAIL PROTECTED]   | Moscow, USSR
-
<   Powered by Linux & 220V   >


--
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-13 Thread Martin Schröder

On 1999-10-12 13:52:58 -0400, Raja Vallee-Rai wrote:
> 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.

native or green threads?

Best regards
   Martin
-- 
  Martin Schröder, [EMAIL PROTECTED]
ArtCom GmbH, Grazer Straße 8, D-28359 Bremen
   Voice +49 421 20419-44 / Fax +49 421 20419-10

 PGP signature


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

1999-10-13 Thread Robb Shecter

Interesting comments.

> >benchmark execution was repeated ten times.  We discarded the maximum
> >and minimum results, and averaged the remaining 8 execution times.
> 
> very good methodology... sure wish more people would do that.

Yes - it sounds like a nice mix between "median" and "mean".  Mean, on
its own, is not a good measure of central tendency.  Maybe the
"professionals" who do benchmarks should take a typical university
experimental methodology course.  I don't think I've ever seen a
benchmark say that results are "statistically insignificant".  (Not
talking about the original poster here.)

Personally, I'd be interested to see info about non-Blackdown free
JVMs.  We don't hear too much about them on this list.  That would
have been an interesting comparison.

- Robb


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



I am a new user of Java on Linux platform...

1999-10-13 Thread Cengiz Ulutas

Hi,
I downloaded jdk117_v3 from your site and installed it on my
RedHat6.0...It seems to work properly.
I copied my compiled project classes to my Linux, too and added my
projects path to the classpath. When I try to execute as in the
following, 'java myPackage.myApplication' I received the following
message: 'can't find class myApplication'...Can you help me about what
is missing...THANKS!


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



A Global instance ?

1999-10-13 Thread Robert Simmons Jr.

I have a gizmo that keeps track of resources for a program. The problem
is that Im ending up passing this gizmo to every child component and
that is beginning to bug me. In C++ I ould just create a global static
var and let everyone access it. This is one of those rare cases where
its a good idea. ALL parts use the same instance and the instance is
read once (at the beginning) and written once(at program shutdown)
anyone have any more elgant solution then passing it all over the damn
place ?

--rob


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



Re: A Global instance ?

1999-10-13 Thread Stefan Bodewig

Hi Robert,

the "standard answer" I guess: use the Singleton-Pattern (see "Design
Patterns" by Gamma, Helm, Johnson and Vlissidis) like this:

public class Gizmo {

private static Gizmo instance = null;

private Gizmo() {
}

public static Gizmo getInstance() {
if (instance == null)
instance = new Gizmo();
return instance;
}
}

and call Gizmo.getInstance() wherever you need it.

You do know that this is not really a Java-*Linux*-Question, right?

Stefan

 PGP signature


Re: A Global instance ?

1999-10-13 Thread Catalin Climov


package mypackage;

public class Global // use this class to keep your global properties
{
private Global() // disable it's constructor, since all its members are
static
{
}

static // This is the static initialization. It is performed after the
class is loaded into jvm
{
res = new MyResource();
// other init stuff
}

private static MyResource res;
public static MyResource getRes()
{
return res;
}
}

Then just import the Global class wherever you need it, and access resources
with Global.getRes(), i.e.

- Original Message -
From: Robert Simmons Jr. <[EMAIL PROTECTED]>
To: Java <[EMAIL PROTECTED]>
Sent: Wednesday, October 13, 1999 1:31 PM
Subject: A Global instance ?


> I have a gizmo that keeps track of resources for a program. The problem
> is that Im ending up passing this gizmo to every child component and
> that is beginning to bug me. In C++ I ould just create a global static
> var and let everyone access it. This is one of those rare cases where
> its a good idea. ALL parts use the same instance and the instance is
> read once (at the beginning) and written once(at program shutdown)
> anyone have any more elgant solution then passing it all over the damn
> place ?
>
> --rob
>
>
> --
> 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: I am a new user of Java on Linux platform...

1999-10-13 Thread Jo Uthus

"Cengiz Ulutas" wrote: 

| Hi,
| I downloaded jdk117_v3 from your site and installed it on my
| RedHat6.0...It seems to work properly.
| I copied my compiled project classes to my Linux, too and added my
| projects path to the classpath. When I try to execute as in the
| following, 'java myPackage.myApplication' I received the following
| message: 'can't find class myApplication'...Can you help me about what
| is missing...THANKS!

export CLASSPATH=$CLASSPATH:.

Should do the trick:

add it permanently to the following file:
~/.bashrc


(or any other startup-file)
-- 
Jo Uthus| e-mail: [EMAIL PROTECTED] (private)
Software Engineer   | e-mail: [EMAIL PROTECTED]  (work)


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



Re: A Global instance ?

1999-10-13 Thread Paul Mclachlan

At  5:31 10 Oct 1999 -0600, Robert Simmons Jr. wrote:

> I have a gizmo that keeps track of resources for a program. The problem
> is that Im ending up passing this gizmo to every child component and
> that is beginning to bug me. In C++ I ould just create a global static
> var and let everyone access it. This is one of those rare cases where

You are looking for something called the singleton pattern.  Take a look at

http://www.alumni.caltech.edu/~croft/research/java/pattern/

(or do your own search :)

Keep in mind if you use the first Singleton.java that you need to
Class.forName() or otherwise initialise the class so it makes it into the
VM in the first place.

Paul


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



Re: Java and Linux

1999-10-13 Thread Michael Sinz

On Mon, 11 Oct 1999 16:33:29 -0500, [EMAIL PROTECTED] wrote:

>Hi:
>
>I'm new in Linux.  Please forgive me if the questions are too simple.
>
>Q1: What version of Java (1.1 or 1.2) does JVM inside Blackdown JDK package
>support?

Depends on which you download.  We have released versions for 1.1.x
and pre-release versions for 1.2.

>Q2: A Java application was developed on Windows NT 4.0 (Intel) by using
>VisualCafe 3.0.  Can we simply move all class files of the application to
>Redhat 6.0 Linux (Intel), and use JVM inside Blackdown to run it without any
>modification?

If your java code is written correctly it should be no problem.

Things that many times get missed are things like path name strings.
Many programmers trip over this by hard coding the path names rather
than building them using the Java properties for the platform.  Things
like the "/" vs "\" differences and the fact that Windows systems have
this really annoying drive letter thing.

-- 
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]



Re: A Global instance ?

1999-10-13 Thread Surjan Singh

Robert,

How about creating a class like this:

"public class Fred{
   public static final ResourceGizmo resourceGizmoRef;
}"

Then in the main class or init code do Fred.resourceGizmoRef=new .

Then any class can access the instance by using Fred.resourceGizmoRef.

Surj

"Robert Simmons Jr." wrote:
> 
> I have a gizmo that keeps track of resources for a program. The problem
> is that Im ending up passing this gizmo to every child component and
> that is beginning to bug me. In C++ I ould just create a global static
> var and let everyone access it. This is one of those rare cases where
> its a good idea. ALL parts use the same instance and the instance is
> read once (at the beginning) and written once(at program shutdown)
> anyone have any more elgant solution then passing it all over the damn
> place ?
> 
> --rob
> 
> --
> 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]



ddd as a java debugger

1999-10-13 Thread videoranger

First let me say thanks to all of you who responded to my original
newbie questions. I actually made some progress with my screwy code as a
result of your suggestions. Very Cool. I still have problems to solve,
though.

Being something of a doit-yourself type (as I imagine we all are), I'm
still trying to put together a debugging environment that is
'satisfying'. So far I've tried BlueJ, Wipeout and jdb. Wipeout has a
lot of promise, but seems a little unstable. This could be because I
have only 32MB of memory on the system. jdb is very stable, but rather
tedious in command syntax and more than a little brief with respect to
documentation. I could not get BlueJ to even start up.

Within the past couple of days I swapped messages with someone here on
the list regarding ddd. After mulling it over a bit I've decided I
oughtta give it a try.

Can you anyone provide me with resources for configuration and use
under X on debian 2.0 linux/jdk 1.2?

Thanks a Bunch, Folks =-)

James


-- 
It's not the size of the dog in the fight |James G. Stallings II
that counts, but rather the size of the   | http://angelfire.com/id/videoranger
  fight in the dog.   |  ''Live Long and Prosper''



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



Re: Benchmark results for Linux JVM's.

1999-10-13 Thread Jacob Nikom

Hi,

Does anybody know comparable benchmarks for Java, C and C++ tasks?
I am interested in comparative speed of the languages - any platform
is good. So far I heard only about two years old Java/C++ comparison
on NT, which stated similarity in speed under some conditions.

Thanks,

Jacob Nikom

Raja Vallee-Rai wrote:
> 
> 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]



Re: A Global instance ?

1999-10-13 Thread Peter Pilgrim



[EMAIL PROTECTED] wrote:
> 
> I have a gizmo that keeps track of resources for a program. The problem
> is that Im ending up passing this gizmo to every child component and
> that is beginning to bug me. In C++ I ould just create a global static
> var and let everyone access it. This is one of those rare cases where
> its a good idea. ALL parts use the same instance and the instance is
> read once (at the beginning) and written once(at program shutdown)
> anyone have any more elgant solution then passing it all over the damn
> place ?
> 
> --rob
> 
> --
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

The singleton pattern is basically :

o   a class with a private constructor

o   a class that can only be instantiated with a public method call
(in which you control access to the SINGLETON resource).

thus you can write the following :

public class NetworkPrinter {

protected PaperStackpaper

private static NetworkPrinter   thePrinter = new NetworkPrinter();

private NetworkPrinter ( )
{
}

public static NetworkPrinter getInstance()
{
// When we get `thePrinter' has already been constructed
return (thePrinter);
}
...

public boolean printDocument( Document doc ) 
{ 
...
}
...
}


Use it the form

void someBanalFunction() {
NetworkPrinter globalPrinter = NetworkPrinter.getInstance();
globalPrinter.printDocument( new Document( new File( "life.txt") );
}



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);
}
...

public boolean printDocument( Document doc ) 
{ 
...
}
...
}

-- 

Adios
Peter

-
import std.Disclaimer;  // More Java for your Lava, Mate.
"Give the man, what he wants. £££" [on Roy Keane, Quality Player]


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



Re: ddd as a java debugger

1999-10-13 Thread Daniel P. Zepeda

You can find DDD at:

http://www.cs.tu-bs.de/softech/ddd/

Just grab the sources, untar, run configure, make, make install. It was
that easy for me. Oh, you may need to get Lesstiff and some XPM library
stuff, but the information for that is included in the documentation.

Keep in mind that DDD is a front end for jdb. Any problems that you might
have with jdb will be present in DDD. 

Thus spake [EMAIL PROTECTED] on Wed, 13 Oct 1999:
> First let me say thanks to all of you who responded to my original
> newbie questions. I actually made some progress with my screwy code as a
> result of your suggestions. Very Cool. I still have problems to solve,
> though.
> 
> Being something of a doit-yourself type (as I imagine we all are), I'm
> still trying to put together a debugging environment that is
> 'satisfying'. So far I've tried BlueJ, Wipeout and jdb. Wipeout has a
> lot of promise, but seems a little unstable. This could be because I
> have only 32MB of memory on the system. jdb is very stable, but rather
> tedious in command syntax and more than a little brief with respect to
> documentation. I could not get BlueJ to even start up.
> 
> Within the past couple of days I swapped messages with someone here on
> the list regarding ddd. After mulling it over a bit I've decided I
> oughtta give it a try.
> 
> Can you anyone provide me with resources for configuration and use
> under X on debian 2.0 linux/jdk 1.2?
> 
> Thanks a Bunch, Folks =-)
> 
> James
> 
> 
> -- 
> It's not the size of the dog in the fight |James G. Stallings II
> that counts, but rather the size of the   | http://angelfire.com/id/videoranger
>   fight in the dog.   |  ''Live Long and Prosper''
> 
> 
> 
> --
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
--
Daniel P. Zepeda
[EMAIL PROTECTED]

"In complete darkness, we are all the same. Only our knowledge and wisdom 
separates us there." -- J. Jackson


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



Re: ddd as a java debugger

1999-10-13 Thread Matt Welsh


> Being something of a doit-yourself type (as I imagine we all are), I'm
> still trying to put together a debugging environment that is
> 'satisfying'. 

Although not directly relevant to the Blackdown JDK, GCJ (the Java front-end
to GCC) supports Java debugging with GDB. This is amazingly useful: you can
debug a Java program with native methods all within the same debugging
environment, examine the C->Java stack trace, debug programs which use 
multiple (native) threads, and so forth. 

Matt Welsh, UC Berkeley


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



Re: Benchmark results for Linux JVM's.

1999-10-13 Thread Jacob Nikom

Hi,

It was the article in one of the Java magazines two years ago.
I don't remember which one.  They claimed that for numerical
operations the speed was comparable.

In very crude and simple loop test on Linux with gcc -O3
and Blackdown Java (I assume jit was on) the ratio Java/C
speed was 3 - 4 times.

Jacob

[EMAIL PROTECTED] wrote:
> 
> Benchmarks comparisons between Java and C/C++.
> 
> Thanks.
> 
> Lee
> 
> -Original Message-
> From: Jacob Nikom [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 13, 1999 11:35 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Benchmark results for Linux JVM's.
> 
> Hi,
> 
> What information you mean?
> 
> Jacob
> 
> [EMAIL PROTECTED] wrote:
> >
> > Hi,
> >
> > Could you please let me share any information you get because I'm looking
> > for the same info.
> >
> > Thanks.
> >
> > Lee
> >
> > -Original Message-
> > From: Jacob Nikom [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, October 13, 1999 10:12 AM
> > To: Raja Vallee-Rai
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: Benchmark results for Linux JVM's.
> >
> > Hi,
> >
> > Does anybody know comparable benchmarks for Java, C and C++ tasks?
> > I am interested in comparative speed of the languages - any platform
> > is good. So far I heard only about two years old Java/C++ comparison
> > on NT, which stated similarity in speed under some conditions.
> >
> > Thanks,
> >
> > Jacob Nikom
> >
> > Raja Vallee-Rai wrote:
> > >
> > > 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]


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



Re: A Global instance ?

1999-10-13 Thread Marc Slemko

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: ddd as a java debugger

1999-10-13 Thread Nathan Meyers

"Daniel P. Zepeda" wrote:
> 
> You can find DDD at:
> 
> http://www.cs.tu-bs.de/softech/ddd/
> 
> Just grab the sources, untar, run configure, make, make install. It was
> that easy for me. Oh, you may need to get Lesstiff and some XPM library
> stuff, but the information for that is included in the documentation.
> 
> Keep in mind that DDD is a front end for jdb. Any problems that you might
> have with jdb will be present in DDD.

Which, in my own experience, means that DDD quickly stops working with
jdb 1.2.

Maybe there's an option I've missed, but 1.2 debugging under Linux is a
rough ride right now. jdb is flaky, anything built on top of jdb (like
DDD) is flaky, the wonderful Jikes debugger doesn's really work under
1.2, and the JPDA library - used by newer Java debuggers - is not yet
available on Linux.

The earlier recommendation to debug with print statements was not far
off the mark. I've had more success that way than I have with debuggers
under 1.2. That'll change in time, but not this week :-(.

Nathan


> 
> Thus spake [EMAIL PROTECTED] on Wed, 13 Oct 1999:
> > First let me say thanks to all of you who responded to my original
> > newbie questions. I actually made some progress with my screwy code as a
> > result of your suggestions. Very Cool. I still have problems to solve,
> > though.
> >
> > Being something of a doit-yourself type (as I imagine we all are), I'm
> > still trying to put together a debugging environment that is
> > 'satisfying'. So far I've tried BlueJ, Wipeout and jdb. Wipeout has a
> > lot of promise, but seems a little unstable. This could be because I
> > have only 32MB of memory on the system. jdb is very stable, but rather
> > tedious in command syntax and more than a little brief with respect to
> > documentation. I could not get BlueJ to even start up.
> >
> > Within the past couple of days I swapped messages with someone here on
> > the list regarding ddd. After mulling it over a bit I've decided I
> > oughtta give it a try.
> >
> > Can you anyone provide me with resources for configuration and use
> > under X on debian 2.0 linux/jdk 1.2?
> >
> > Thanks a Bunch, Folks =-)
> >
> > James
> >
> >
> > --
> > It's not the size of the dog in the fight |James G. Stallings II
> > that counts, but rather the size of the   | http://angelfire.com/id/videoranger
> >   fight in the dog.   |  ''Live Long and Prosper''
> >
> >
> >
> > --
> > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> --
> Daniel P. Zepeda
> [EMAIL PROTECTED]
> 
> "In complete darkness, we are all the same. Only our knowledge and wisdom
> separates us there." -- J. Jackson
> 
> --
> 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: Problems with JDB

1999-10-13 Thread Adam Ambrose

I've been using jdb (through JDE) on the Blackdown 1.2 JDK since it's been
released, and I've only gotten the problem you described when I try to run
java/jdb with native threads.  When I run it with green threads and no JIT, it
works perfectly for me, if slowly.

If you haven't already, try setting THREADS_FLAG=green and JAVA_COMPILER=NONE
before starting up java/jdb.

Adam Ambrose

"Daniel P. Zepeda" wrote:

> Hi,
> I subscribe to the digest. I haven't seen my message in the
> archive, nor has anyone answered me yet, so I subscribed to the full list.
> now. Here is my original below. Apologiies if this is seen twice now.
>
> So,
> I've been trying to use JDK 1.2prev2's jdb with no success. When I
> set a breakpoint, jdb happily continues on past the breakpoint without
> stopping. I've looked around quite a bit and the only reference I have
> found is that of Jacek Lasowski's  August 1999 reply to someone who said
> that he has seen the same problem and that he worked around it by including
> rt.jar in his CLASSPATH and using the JDK 117's jdb.
> This does not work for me.
> Has there been any progress in fixing this
> problem? Is it that no-one is using jdb? What are they using if not jdb?
> *Any* information would be greatly appreciated.
>  --
> Daniel P. Zepeda
> [EMAIL PROTECTED]
>
> "In complete darkness, we are all the same. Only our knowledge and wisdom
> separates us there." -- J. Jackson
>
> --
> 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: Benchmark results for Linux JVMs (formatted for 70 columns)

1999-10-13 Thread Paolo Ciccone

On Tue, Oct 12, 1999 at 08:51:29PM -0500, Chris Abbey wrote:
> 
> >A # indicates that the run failed validity checks.
> 
> poor bor...er...inprise

You can use Borland :). Anyway, the result is not bad since the JIT
has been released as a public Beta test and we'd like to know more
details about icomaptibilities or bugs. After all that's the purpose
of beta testing :)
 

-- 
Paolo Ciccone
JBuilder dev. team.


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



Re: ddd as a java debugger

1999-10-13 Thread Jacob Nikom

Hi,

Do you know anything about GCJ - latest Cygnus tool for Java
compilation and debugging?

Jacob Nikom

Nathan Meyers wrote:
> 
> "Daniel P. Zepeda" wrote:
> >
> > You can find DDD at:
> >
> > http://www.cs.tu-bs.de/softech/ddd/
> >
> > Just grab the sources, untar, run configure, make, make install. It was
> > that easy for me. Oh, you may need to get Lesstiff and some XPM library
> > stuff, but the information for that is included in the documentation.
> >
> > Keep in mind that DDD is a front end for jdb. Any problems that you might
> > have with jdb will be present in DDD.
> 
> Which, in my own experience, means that DDD quickly stops working with
> jdb 1.2.
> 
> Maybe there's an option I've missed, but 1.2 debugging under Linux is a
> rough ride right now. jdb is flaky, anything built on top of jdb (like
> DDD) is flaky, the wonderful Jikes debugger doesn's really work under
> 1.2, and the JPDA library - used by newer Java debuggers - is not yet
> available on Linux.
> 
> The earlier recommendation to debug with print statements was not far
> off the mark. I've had more success that way than I have with debuggers
> under 1.2. That'll change in time, but not this week :-(.
> 
> Nathan
> 
> >
> > Thus spake [EMAIL PROTECTED] on Wed, 13 Oct 1999:
> > > First let me say thanks to all of you who responded to my original
> > > newbie questions. I actually made some progress with my screwy code as a
> > > result of your suggestions. Very Cool. I still have problems to solve,
> > > though.
> > >
> > > Being something of a doit-yourself type (as I imagine we all are), I'm
> > > still trying to put together a debugging environment that is
> > > 'satisfying'. So far I've tried BlueJ, Wipeout and jdb. Wipeout has a
> > > lot of promise, but seems a little unstable. This could be because I
> > > have only 32MB of memory on the system. jdb is very stable, but rather
> > > tedious in command syntax and more than a little brief with respect to
> > > documentation. I could not get BlueJ to even start up.
> > >
> > > Within the past couple of days I swapped messages with someone here on
> > > the list regarding ddd. After mulling it over a bit I've decided I
> > > oughtta give it a try.
> > >
> > > Can you anyone provide me with resources for configuration and use
> > > under X on debian 2.0 linux/jdk 1.2?
> > >
> > > Thanks a Bunch, Folks =-)
> > >
> > > James
> > >
> > >
> > > --
> > > It's not the size of the dog in the fight |James G. Stallings II
> > > that counts, but rather the size of the   | http://angelfire.com/id/videoranger
> > >   fight in the dog.   |  ''Live Long and Prosper''
> > >
> > >
> > >
> > > --
> > > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> > --
> > Daniel P. Zepeda
> > [EMAIL PROTECTED]
> >
> > "In complete darkness, we are all the same. Only our knowledge and wisdom
> > separates us there." -- J. Jackson
> >
> > --
> > 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: Stupid Newbie Questions: Catching unanticipated null pointer exceptions (Are there really any other kind =^)

1999-10-13 Thread Eric vanberkel

Oh, this reminds me of (X)Emacs and Java:

Check out 

http://www.baclace.net/emacsjava.html

for your IDE mate.

gr. Eric

--- "Alex M." <[EMAIL PROTECTED]> wrote:
> > Exception in thread "main"
> java.lang.NullPointerException:
> >   at
> java.awt.Container.addImpl(Container.java:316)
> >   at
> java.awt.Container.add(Container.java:245)
> >   at Tedit.(Tedit.java:100)
> >   at Tedit.main(Tedit.java:557)
> 
> The problem is in line 100 of Tedit.java, specifically in
> the constructor.
> I bet you're trying to add a null object to a container,
> either that or
> you're trying to add an object to a container that is
> null.
> 
> I don't use JDB unless I'm really desparate.  If you use
> Emacs and install
> the JDE for Emacs (you can get to it off of blackdown
> under third party
> tools I think) it integrates the jdb debugger into emacs
> so it kind of
> works like JBuilder's debugger where you can see what
> line you are on and
> skip/trace/etc into the source code, and watch the source
> code while the
> program runs.
> 
> 
>
--
> To UNSUBSCRIBE, email to
> [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact
> [EMAIL PROTECTED]
> 
> 

__
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


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



Re: ddd as a java debugger

1999-10-13 Thread Nathan Meyers

Jacob Nikom wrote:
> 
> Hi,
> 
> Do you know anything about GCJ - latest Cygnus tool for Java
> compilation and debugging?

Yeah, gcj is a Java front end for the gcc compiler: Java goes in, native
code comes out. It compiles from either Java source or classfiles; it
doesn't recognize all current source constructs (like embedded classes),
so classfiles are usually a better choice.

gcj is a full-native solution, it cannot load or interpret classfiles
(although they're working on it). As for debugging... it's like any
other native language. The executable includes tables that map code
addresses to source line numbers, so debuggers like gdb can do
source-level debugging.

Nathan


> 
> Jacob Nikom
> 
> Nathan Meyers wrote:
> >
> > "Daniel P. Zepeda" wrote:
> > >
> > > You can find DDD at:
> > >
> > > http://www.cs.tu-bs.de/softech/ddd/
> > >
> > > Just grab the sources, untar, run configure, make, make install. It was
> > > that easy for me. Oh, you may need to get Lesstiff and some XPM library
> > > stuff, but the information for that is included in the documentation.
> > >
> > > Keep in mind that DDD is a front end for jdb. Any problems that you might
> > > have with jdb will be present in DDD.
> >
> > Which, in my own experience, means that DDD quickly stops working with
> > jdb 1.2.
> >
> > Maybe there's an option I've missed, but 1.2 debugging under Linux is a
> > rough ride right now. jdb is flaky, anything built on top of jdb (like
> > DDD) is flaky, the wonderful Jikes debugger doesn's really work under
> > 1.2, and the JPDA library - used by newer Java debuggers - is not yet
> > available on Linux.
> >
> > The earlier recommendation to debug with print statements was not far
> > off the mark. I've had more success that way than I have with debuggers
> > under 1.2. That'll change in time, but not this week :-(.
> >
> > Nathan
> >
> > >
> > > Thus spake [EMAIL PROTECTED] on Wed, 13 Oct 1999:
> > > > First let me say thanks to all of you who responded to my original
> > > > newbie questions. I actually made some progress with my screwy code as a
> > > > result of your suggestions. Very Cool. I still have problems to solve,
> > > > though.
> > > >
> > > > Being something of a doit-yourself type (as I imagine we all are), I'm
> > > > still trying to put together a debugging environment that is
> > > > 'satisfying'. So far I've tried BlueJ, Wipeout and jdb. Wipeout has a
> > > > lot of promise, but seems a little unstable. This could be because I
> > > > have only 32MB of memory on the system. jdb is very stable, but rather
> > > > tedious in command syntax and more than a little brief with respect to
> > > > documentation. I could not get BlueJ to even start up.
> > > >
> > > > Within the past couple of days I swapped messages with someone here on
> > > > the list regarding ddd. After mulling it over a bit I've decided I
> > > > oughtta give it a try.
> > > >
> > > > Can you anyone provide me with resources for configuration and use
> > > > under X on debian 2.0 linux/jdk 1.2?
> > > >
> > > > Thanks a Bunch, Folks =-)
> > > >
> > > > James
> > > >
> > > >
> > > > --
> > > > It's not the size of the dog in the fight |James G. Stallings II
> > > > that counts, but rather the size of the   | http://angelfire.com/id/videoranger
> > > >   fight in the dog.   |  ''Live Long and Prosper''
> > > >
> > > >
> > > >
> > > > --
> > > > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > > > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> > > --
> > > Daniel P. Zepeda
> > > [EMAIL PROTECTED]
> > >
> > > "In complete darkness, we are all the same. Only our knowledge and wisdom
> > > separates us there." -- J. Jackson
> > >
> > > --
> > > 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: JNI on linux.

1999-10-13 Thread Jacob Nikom

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]



Const in java

1999-10-13 Thread Robert Simmons



I was always the real proponent of type and instance safety in 
c++. for example. 
 
class Foo {
  private BarClass  
_bar;
 
  public const BarClass& 
getBar();
  public setBar(const BarClass const 
&bar);
}
 
This snippet guarantees that someone doesnt pull a getBar() 
then set the return result. ie: 
 
void main {
   Foo f = new Foo();
   BarClass c = new 
BarClass();
   BarClass b = 
g.getBar();
   b = c;  // DOH we just changed 
bar inside of the f instance
} 
 
Also it guarantees the following cant happen: 
 
Foo::setBar(const BarClass const &bar) {
  bar = new BarClass();  // DOH, just overwrote the 
var outside the method
}
 
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 
? 
 

class Foo {
  private BarClass  
_bar;
 
  public final BarClass& 
getBar();
  public setBar(final BarClass 
bar);
}
 
Thanks for your time.
 
--rob


Re: ddd as a java debugger

1999-10-13 Thread Jacob Nikom

Hi Matt,

Thank you for your info about GCJ. Have you ever try it? How well it
works?

I looked at its documentation and found it a little confusing. The
compiler
consists of two parts + debugger. Also there is visual front end to this
debugger, Insight.

The installation of each part consists of "install", "build" and
"configure"
tasks, overall 9 tasks (another task, "test" is optional). I even did
not 
mention Insight yet. Also, they mentioned about some compiler
limitations, 
like it does not support inner classes. Do you think it is important?

Jacob Nikom

Matt Welsh wrote:
> 
> > Being something of a doit-yourself type (as I imagine we all are), I'm
> > still trying to put together a debugging environment that is
> > 'satisfying'.
> 
> Although not directly relevant to the Blackdown JDK, GCJ (the Java front-end
> to GCC) supports Java debugging with GDB. This is amazingly useful: you can
> debug a Java program with native methods all within the same debugging
> environment, examine the C->Java stack trace, debug programs which use
> multiple (native) threads, and so forth.
> 
> Matt Welsh, UC Berkeley
> 
> --
> 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-13 Thread alx

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]



Re: Const in java

1999-10-13 Thread jools enticknap


Hi Robert,

Adding the final keyword to a variable in an argument list only
means that the reference is final, ie you can't make the reference refer to 
another object. I does not mean that I can't call certain methods in the 
same way as C++.

Regards

--Jools

>From: "Robert Simmons" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Subject: Const in java
>Date: Wed, 13 Oct 1999 15:54:26 -0600
>
>I was always the real proponent of type and instance safety in c++. for 
>example.
>
>class Foo {
>   private BarClass  _bar;
>
>   public const BarClass& getBar();
>   public setBar(const BarClass const &bar);
>}
>
>This snippet guarantees that someone doesnt pull a getBar() then set the 
>return result. ie:
>
>void main {
>Foo f = new Foo();
>BarClass c = new BarClass();
>BarClass b = g.getBar();
>b = c;  // DOH we just changed bar inside of the f instance
>}
>
>Also it guarantees the following cant happen:
>
>Foo::setBar(const BarClass const &bar) {
>   bar = new BarClass();  // DOH, just overwrote the var outside the method
>}
>
>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 ?
>
>class Foo {
>   private BarClass  _bar;
>
>   public final BarClass& getBar();
>   public setBar(final BarClass bar);
>}
>
>Thanks for your time.
>
>--rob

__
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: Const in java

1999-10-13 Thread Matt Welsh


Robert,

Since most of your questions are general Java questions and have
nothing to do with the Linux port of the JDK, can you please direct
them elsewhere? The USENET group comp.lang.java.programmer is probably
a good place to ask.

Thank you,
Matt Welsh, UC Berkeley

"Robert Simmons" <[EMAIL PROTECTED]> writes:
> This is a multi-part message in MIME format.
> 
> --=_NextPart_000_0552_01BF1593.39A8C1C0
> Content-Type: text/plain;
>   charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
> 
> I was always the real proponent of type and instance safety in c++. for =
> example.=20
> 
> class Foo {
>   private BarClass  _bar;
> 
>   public const BarClass& getBar();
>   public setBar(const BarClass const &bar);
> }
> 
> This snippet guarantees that someone doesnt pull a getBar() then set the =
> return result. ie:=20
> 
> void main {
>Foo f =3D new Foo();
>BarClass c =3D new BarClass();
>BarClass b =3D g.getBar();
>b =3D c;  // DOH we just changed bar inside of the f instance
> }=20
> 
> Also it guarantees the following cant happen:=20
> 
> Foo::setBar(const BarClass const &bar) {
>   bar =3D new BarClass();  // DOH, just overwrote the var outside the =
> method
> }
> 
> Since everything in java is passed by reference this becomes even more =
> of an issue.=20
> Therefore can I do the following to achieve the desired safety ?=20
> 
> class Foo {
>   private BarClass  _bar;
> 
>   public final BarClass& getBar();
>   public setBar(final BarClass bar);
> }
> 
> Thanks for your time.
> 
> --rob


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



Re: Const in java

1999-10-13 Thread Michael Emmel

[EMAIL PROTECTED] wrote:

> 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.

Well  that wont compile.

In reality const is just one form of programing by contract which java does not support
directly
to date.

Since reference arguments are passed as a reference copy in java you cant change a
reference.

example

public void foo(  Object obj ) {
obj =foobar;
}

Has no effect on the external pointer obj;
Pointers in java are passed also by copy .


To simulate a pointer in java you need

public void foo(  Object[] obj ) {
obj [0]=foobar;
}

Thus a pointer is really a index into a array which is gasp the same thing it is in C.

The only thing you don't know in java is you absolute address from the true  offset in
memory.
JNI allows pinning if Java allowed you to pin the address of and array and allow byte[]
int[] etc to point to the same memory regions. And allow you to subclass say int[]
99.999% of the reasons to use C are gone.

The only reason you can't cast a int[] to   byte[]  is because java is big  endian and
intel is little  :  (

Why you can't subclass int[] or byte[]   I don't know.


Mike


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



Re: Const in java

1999-10-13 Thread Gordon Keith

[EMAIL PROTECTED] wrote:
> 
> 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? 

Everything is passed by value. 
But you never actually pass objects, you only ever pass references to
objects.

Making a parameter final means you can't change what object that
parameter refers to. (you can still make changes to the object, if it's
not immutable)

Once you understand that its pretty clear what's happening.

Regards
Gordon


Gordon Keith
Programmer
Marine Science Support
Australian Antarctic Divsion
http://www.antdiv.gov.au


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