JNI and fstream

1999-11-12 Thread Pierre Heroux

Hi,

I have a java class with a native method implemented in C++.
This method uses fstream. I got a Segmentation Fault when the destructor
of the fstream is called.
Is it a bug in JNI ? Am i missing something ?

#include 
JNIEXPORT
jboolean
JNICALL
Java_MyClass_write(JNIEnv * env, jobject obj)
  {
  ofstream out;
  out.open("file");
  if(!out.is_open())
return false;
  out << "HelloWorld"  << endl;
  out.close();
  return true;
  } /* it crashes here */

another version
#include 

JNIEXPORT
jboolean
JNICALL
Java_MyClass_write(JNIEnv * env, jobject obj)
  {
  ofstream * out;
  out = new ofstream;
  out->open("file");
  if(!out->is_open())
return false;
  *out << "HelloWorld"  << endl;
  out->close();
  delete out; /* it crashes here and it works fine if this line is
removed */
  return true;
  } /* it crashes here */



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



JNI and fstream

1999-11-12 Thread Pierre Heroux

Hi,

I have a java class with a native method implemented in C++.
This method uses fstream. I got a Segmentation Fault when the destructor

of the fstream is called.
Is it a bug in JNI ? Am I missing something ?

#include 
JNIEXPORT
jboolean
JNICALL
Java_MyClass_write(JNIEnv * env, jobject obj)
  {
  ofstream out;
  out.open("file");
  if(!out.is_open())
return false;
  out << "HelloWorld"  << endl;
  out.close();
  return true;
  } /* it crashes here */

another version
#include 

JNIEXPORT
jboolean
JNICALL
Java_MyClass_write(JNIEnv * env, jobject obj)
  {
  ofstream * out;
  out = new ofstream;
  out->open("file");
  if(!out->is_open())
return false;
  *out << "HelloWorld"  << endl;
  out->close();
  delete out; /* it crashes here and it works fine if this line is
removed */
  return true;
  } /* it crashes here */

Pierre


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



Re: java debuger

1999-11-12 Thread Jo Uthus

Donatas Simkunas wrote: 

| One simple question which java debuger you can recomend.
| I tried jikes debuger but it crashed after several debuging steps. AnyJ
| debuger seems to do same things it crashes after some debuging.
| BTW i heard that it can be jikes problem cause it generates corrupted
| debug information. but compile with javac is killing to me (jikes compiles 
| about 1 min. javac about 10).

I generally compile my project with jikes, and for debugging-purposes
I do a javac-compilation. Using jdb the way it should be used is also
an advantage (IE: start program, load class, set breakpoint, run, use
a combination of commands: "where|locals|print|dump|threads|
threadgroups", works for me (when I'm tired of those printf()-debugs)).


-- 
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: Oracle 8i & JDK 117v3

1999-11-12 Thread Aaron Mulder

On Fri, 12 Nov 1999, Ugo Cei wrote:
> I don't think this is off-topic at all.

Well, with that encouragement...

I've got a fresh install of Red Hat 6.1 on a P2-300 w/ 160MB and
JRE (actually we used the JRE for the install, not the JDK) 1.1.7v3.  The
big box is waiting for us to get the procedure straight.
The first problem was that the install program died complaining
that it couldn't create the virtual machine.  Apparently a script runs a
program that runs a script that starts a Java program, and the first
program died (is this the java -native problem?).  So we were able to
continue by doing what the first script did and running the second script
by hand.
Then, dbassist failed to launch from the install routine with the
error "not enough arguments".  When we tried to run it, it simply died,
which we traced to the fact that all the tools use java -native which does
nothing if native threads aren't installed (why not default to green?).
With suitable editing to .java_wrapper and jre, we got it to run using
green threads.
So we configured the instance with dbassist, generated shell
scripts to build the instance, and ran them.  We confirmed that we could
connect using the strangely named svrmgrl (Linux?) and "connect internal".

HOWEVER, we are unable to configure Net8.  The tools like
"netasst" and others (I've forgetten the others we tried) die with an
"Unable to load library" error.  The library in question (libnjni8.so) is
distributed by Oracle (see $ORACLE_HOME/lib), but with size 0 (both the
installed version and the version in the JAR on the CD).  The directory is
in our LD_LIBRARY_PATH, so I suspect it's just the "size 0" issue.
This means that we can't connect to the instance other than
through "connect internal", which is pretty useless.  We took a swing at
configuring a listener.ora by hand, but can't get past an error about "no
valid addresses specified"...

So my question is, what's going on?  Can I guess from the name
that the library in question relates to JNI for Native threads
(lib*njni*)?  If so, should we have a Blackdown version of this library
loaded before an Oracle version?  Or is this otherwise related to our
inability to run with native threads?

And on a related note, it would sure be nice to have a version of
the JDK with native threads that works with the glibc distributed with Red
Hat 6.1 (do I remember right 2.1.2?).  I won't ask when it's coming, I'll
just say that it would sure be nice.

Aaron


> I did it just yesterday, but I downloaded and installed JRE 1.1.6v5 as
> suggested by Oracle in its installation instructions. The only problem I
> had was with a message form dbassist telling me I had no support for
> national languages. I Ignored it and it created the database. Since then
> I just had the time to test that the instance is up and running.
> >  
> > Anyone had success installing Oracle 8i on Linux?  I'm fighting
> > some problems with the configuration tools, which are all Java-based.
> 
> This is on a RH 6.0 system with 256MB RAM + 256MB of swap.
> 
>   Ugo
> 
> -- 
> Ugo Cei - [EMAIL PROTECTED]
> Fuori Orario Srl - Galleria Manzoni 15, 27100 Pavia - Italy
> Tel: +39.382.22651, Fax: +39.382.539467
> 


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



Re: Printing with 1.2

1999-11-12 Thread Pavel Tolkachev

Hi Greg,

See this two articles on Sun's site:

http://developer.java.sun.com/developer/technicalArticles/Printing/Java2DPrinting/index.html,
http://developer.java.sun.com/developer/technicalArticles/Printing/SwingPrinting/index.html

You may need to register as Java Developer (it is free) to read them.

Hope this will help.

All the Best
Pavel

Greg Tomalesky wrote:
> 
> Hi Gang:
> 
> Does anyone know where I can get some examples of printing under JDK
> 1.2?
> 
> Thanks
> Greg
> 
> --
> 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]



Pass by Reference question.

1999-11-12 Thread Paul Grepps


I expected the following to work since Objects are supposedly pass-by-reference. 
Am I doing something wrong here?
I'm just trying to change a Boolean value inside of a method and return
as pass-by-reference to the caller.
My environment is:
Blackdown JDK1.2 pre2, RedHat 6.1, glibc 2.1.2
The output of the following program is:
Boolean before: false
changeBoolean(): false
changeBoolean(): true
Boolean after: false
I expected the Boolean after: to be true.
--
public class BooleanTest2 {
    public void changeBoolean(Boolean b) {
    System.out.println("changeBoolean():
" + b.booleanValue());
    b = Boolean.TRUE;
    System.out.println("changeBoolean():
" + b.booleanValue());
    }
    public static void main(String args[])
    {
    BooleanTest2 bt = new BooleanTest2();
    Boolean bool = new Boolean(false);
    System.out.println("Boolean
before: " + bool.booleanValue());
    bt.changeBoolean(bool);
    System.out.println("Boolean
after: " + bool.booleanValue());
    }
}

begin:vcard 
n:Grepps;Paul
tel;home:(703) 327-0768
x-mozilla-html:TRUE
org:Lightningcast Inc.
adr:;;
version:2.1
email;internet:[EMAIL PROTECTED]
title:Principal Engineer
x-mozilla-cpt:;0
fn:Paul Grepps
end:vcard



Where is the mistake ? Bug ?

1999-11-12 Thread Dirk Waxweiler

Vector ad = null;
...
  void readwinners(String winners) throws Exception{
String a = null, b = null;
File infile = new File(winners);
BufferedReader br = new BufferedReader(new FileReader(infile));
do{
a = br.readLine();
System.out.println(a);
if (a != null) {
ad.addElement(a);
}
}while(a != null);
}

public void actionPerformed(ActionEvent event){
String winnersstr = winnersTF.getText();
String address = addressTF.getText();
String outputfile = outputfileTF.getText();
try{
readwinners(winnersstr);
...

result: "java.lang.NullPointerException"


==
Dirk Waxweiler
incotech * 23,rue des Bruyères * L-1274 Howald/Luxembourg
Tel.: +352 29 53 83 -1 * Fax: +352 29 53 83 222
e-mail: [EMAIL PROTECTED] * internet: www.incotech.lu
==


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



Re: Pass by Reference question.

1999-11-12 Thread Oliver Koell

Paul Grepps wrote:
> 
> I expected the following to work since Objects are supposedly
> pass-by-reference.  Am I doing something wrong here?

Yes :-)
 
> I'm just trying to change a Boolean value inside of a method and
> return as pass-by-reference to the caller.

in changeBoolean() you are not changing the state of the passed Boolean
object. Instead you're assigning something to the reference of the
object, which itself is a copy of the original reference.

Something like this would work:

  public void changeBoolean(Boolean b) {
b.setValue(true);
  }

but unfortunately objects of type Boolean are not mutable (you cannot
change the value of the wrapped boolean value).

I would suggest to write your own class (e.g. MutableBoolean or
BooleanHolder) which allows for changing of the wrapped type.

Regards, Oliver

> My environment is:
> Blackdown JDK1.2 pre2, RedHat 6.1, glibc 2.1.2
> 
> The output of the following program is:
> Boolean before: false
> changeBoolean(): false
> changeBoolean(): true
> Boolean after: false
> 
> I expected the Boolean after: to be true.
> 
> --
> 
> public class BooleanTest2 {
> public void changeBoolean(Boolean b) {
> 
> System.out.println("changeBoolean(): " + b.booleanValue());
> b = Boolean.TRUE;
> System.out.println("changeBoolean(): " + b.booleanValue());
> }
> 
> public static void main(String args[])
> {
> BooleanTest2 bt = new BooleanTest2();
> Boolean bool = new Boolean(false);
> 
> System.out.println("Boolean before: " + bool.booleanValue());
> bt.changeBoolean(bool);
> System.out.println("Boolean after: " + bool.booleanValue());
> }
> }


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



Re: Pass by Reference question.

1999-11-12 Thread Matthias Pfisterer

Hi Paul,

"objects are passed by reference" is only half of the truth. In fact,
this is implemented by passing the reference to the object (in C you
would call it a pointer) by value. Your parameter Boolean b in
changeBoolean() is this reference. By assigning to the reference, this
reference will furthermore reference (point to in C-speak) another
object. The object itself, of course, is not changed. To change the
object, it has to have a method to influence its internal state. In case
of a Boolean object, a meaningful method would be setValue(boolean). For
security reasons and to make Boolean objects as similar as possible to
the native type boolean, such a method does not exist.

Matthias


Paul Grepps wrote:
> 
> I expected the following to work since Objects are supposedly
> pass-by-reference.  Am I doing something wrong here?
> 
> I'm just trying to change a Boolean value inside of a method and
> return as pass-by-reference to the caller.
> 
> My environment is:
> Blackdown JDK1.2 pre2, RedHat 6.1, glibc 2.1.2
> 
> The output of the following program is:
> Boolean before: false
> changeBoolean(): false
> changeBoolean(): true
> Boolean after: false
> 
> I expected the Boolean after: to be true.
> 
> --
> 
> public class BooleanTest2 {
> public void changeBoolean(Boolean b) {
> 
> System.out.println("changeBoolean(): " + b.booleanValue());
> b = Boolean.TRUE;
> System.out.println("changeBoolean(): " + b.booleanValue());
> }
> 
> public static void main(String args[])
> {
> BooleanTest2 bt = new BooleanTest2();
> Boolean bool = new Boolean(false);
> 
> System.out.println("Boolean before: " + bool.booleanValue());
> bt.changeBoolean(bool);
> System.out.println("Boolean after: " + bool.booleanValue());
> }
> }


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



Re: Where is the mistake ? Bug ?

1999-11-12 Thread Michael Sinz

On Fri, 12 Nov 1999 16:23:08 +0100, Dirk Waxweiler wrote:

>Vector ad = null;
>...
>  void readwinners(String winners) throws Exception{
>   String a = null, b = null;
>   File infile = new File(winners);
>   BufferedReader br = new BufferedReader(new FileReader(infile));
>   do{
>   a = br.readLine();
>   System.out.println(a);
>   if (a != null) {
>   ad.addElement(a);

[...]
>...
>
>result: "java.lang.NullPointerException"

Where do you create the vector?  You have an object reference that you
never created an object for and then you try to do a method on the non-object
which is why you get the null pointer exception.

Try changing the ad=null to:

java.util.Vector ad = new java.util.Vector();


-- 
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: Where is the mistake ? Bug ?

1999-11-12 Thread Robert Dietrick


Looks like ad is never being constructed.  Thus, 

   ad.addElement(a);

throws a NullPointerException.

-Rob

On Fri, 12 Nov 1999, Dirk Waxweiler wrote:

> Vector ad = null;
> ...
>   void readwinners(String winners) throws Exception{
>   String a = null, b = null;
>   File infile = new File(winners);
>   BufferedReader br = new BufferedReader(new FileReader(infile));
>   do{
>   a = br.readLine();
>   System.out.println(a);
>   if (a != null) {
>   ad.addElement(a);
>   }
>   }while(a != null);
> }
> 
> public void actionPerformed(ActionEvent event){
>   String winnersstr = winnersTF.getText();
>   String address = addressTF.getText();
>   String outputfile = outputfileTF.getText();
>   try{
>   readwinners(winnersstr);
> ...
> 
> result: "java.lang.NullPointerException"
> 
> 
> ==
> Dirk Waxweiler
> incotech * 23,rue des Bruyères * L-1274 Howald/Luxembourg
> Tel.: +352 29 53 83 -1 * Fax: +352 29 53 83 222
> e-mail: [EMAIL PROTECTED] * internet: www.incotech.lu
> ==
> 
> 
> --
> 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]



Libraries

1999-11-12 Thread Vida Luz

Hi all

I am test JDK1.2 y when run java -version, I have error with
with libhpi.so, the error is:

/var/opt/jdk1.2/bin/i386/native_threads/javac: error in loading shared
libraries libhpi.so: cannot open shared object file: No such file or
directory

I need to know because this error in shared object, I have installed
glibc2.0.7,the requeriments for JDK1.2 is Glibc2.0, I need Glibc2.1?

Thanks in advanced

Regards,



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



Re: Pass by Reference question.

1999-11-12 Thread Nathan Meyers

Your BooleanTest2 is assigning a new reference (i.e., a reference to a
different object) to the local variable "b". It's not changing the
object whose reference was passed in from main().

If you wanted to change the object passed in from main, you would need
to operate on *that* object... something like b.setValue(true), except
there's no such method! Boolean, like all of the primitive wrapper
objects, is immutable.

The behavior you're seeing on Linux is correct. I guess you might say
"pass by reference" is in the eye of the beholder. You're passing the
*value* of the local variable "bool", which is a *reference* to a
Boolean object, then expecting the value of the local variable to be
changed.

Nathan



Paul Grepps wrote:
> 
> I expected the following to work since Objects are supposedly
> pass-by-reference.  Am I doing something wrong here?
> 
> I'm just trying to change a Boolean value inside of a method and
> return as pass-by-reference to the caller.
> 
> My environment is:
> Blackdown JDK1.2 pre2, RedHat 6.1, glibc 2.1.2
> 
> The output of the following program is:
> Boolean before: false
> changeBoolean(): false
> changeBoolean(): true
> Boolean after: false
> 
> I expected the Boolean after: to be true.
> 
> --
> 
> public class BooleanTest2 {
> public void changeBoolean(Boolean b) {
> 
> System.out.println("changeBoolean(): " + b.booleanValue());
> b = Boolean.TRUE;
> System.out.println("changeBoolean(): " + b.booleanValue());
> }
> 
> public static void main(String args[])
> {
> BooleanTest2 bt = new BooleanTest2();
> Boolean bool = new Boolean(false);
> 
> System.out.println("Boolean before: " + bool.booleanValue());
> bt.changeBoolean(bool);
> System.out.println("Boolean after: " + bool.booleanValue());
> }
> }


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



blackdown jdk version

1999-11-12 Thread Raj Patel

Hi,
I am putting this problem here one more time.  I have a swing
application using
JNI.  Everything was working ok under blackdown jdk 1.1.7 with
swing-1.1.1 .  Now
i upgraded jdk to jdk 1.2(blackdown) so i don't have to have swing
because it is
already built in.  But now under jdk1.2 my application gives strange
exception error,


Exception occurred during event dispatching:
java.lang.IndexOutOfBoundsException: -1
at java.util.BitSet.get(Compiled Code)
at javax.swing.DefaultListSelectionModel.clear(Compiled Code)
at javax.swing.DefaultListSelectionModel.setState(Compiled Code)

at
javax.swing.DefaultListSelectionModel.removeIndexInterval(Compiled Code
)
at
javax.swing.plaf.basic.BasicListUI$ListDataHandler.intervalRemoved(Comp
iled Code)
at javax.swing.AbstractListModel.fireIntervalRemoved(Compiled
Code)
at javax.swing.DefaultComboBoxModel.removeAllElements(Compiled
Code)
at javax.swing.JComboBox.removeAllItems(Compiled Code)
at Fsa.refreshAttrCombo(Compiled Code)
at Fsa.addAttributes(Compiled Code)
at Fsa.createComponents(Compiled Code)
at Question$2.actionPerformed(Compiled Code)
at javax.swing.AbstractButton.fireActionPerformed(Compiled Code)

at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Compiled
 Code)
at javax.swing.DefaultButtonModel.fireActionPerformed(Compiled
Code)
at javax.swing.DefaultButtonModel.setPressed(Compiled Code)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Compiled Code)
at java.awt.Component.processMouseEvent(Compiled Code)
at java.awt.Component.processEvent(Compiled Code)
at java.awt.Container.processEvent(Compiled Code)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Container.dispatchEventImpl(Compiled Code)
at java.awt.Component.dispatchEvent(Compiled Code)
at java.awt.LightweightDispatcher.retargetMouseEvent(Compiled
Code)
at java.awt.LightweightDispatcher.processMouseEvent(Compiled
Code)
at java.awt.LightweightDispatcher.dispatchEvent(Compiled Code)
at java.awt.Container.dispatchEventImpl(Compiled Code)
at java.awt.Window.dispatchEventImpl(Compiled Code)
at java.awt.Component.dispatchEvent(Compiled Code)
at java.awt.EventQueue.dispatchEvent(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)


I tried to run in debugg mode but it died

black:rpatel% jdb Fsa
Initializing jdb...
0xb0:class(Fsa)
> run Fsa -interactive -outfile logfile
running ...
main[1]
Current thread "main" died. Execution continuing...
>
Fsa exited


I am using Linux6.0(glibc2.0) jdk1.2(blackdown).
Is there any known problem with this transition??

-Raj


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



Re: Oracle 8i & JDK 117v3

1999-11-12 Thread Ugo Cei

Aaron Mulder wrote:

> Then, dbassist failed to launch from the install routine with the
> error "not enough arguments".  When we tried to run it, it simply died,
> which we traced to the fact that all the tools use java -native which does
> nothing if native threads aren't installed (why not default to green?).
> With suitable editing to .java_wrapper and jre, we got it to run using
> green threads.

This is curious. At first I tried using the IBM JDK and the runInstaller
script died complaining that the jre did non support the "-green" option
(IBM does not support it indeed). Then I downloaded and installed
blackdown's 1.1.6v5 and run it successfully and I am positively certain
that I did NOT install the native thread package. Infact, as the
installer ran I was watching it using "top" and there was only one java
process.

> HOWEVER, we are unable to configure Net8.  The tools like
> "netasst" and others (I've forgetten the others we tried) die with an
> "Unable to load library" error.  The library in question (libnjni8.so) is
> distributed by Oracle (see $ORACLE_HOME/lib), but with size 0 (both the
> installed version and the version in the JAR on the CD).  The directory is
> in our LD_LIBRARY_PATH, so I suspect it's just the "size 0" issue.
> This means that we can't connect to the instance other than
> through "connect internal", which is pretty useless.  We took a swing at
> configuring a listener.ora by hand, but can't get past an error about "no
> valid addresses specified"...

Don't know what is going on here, but I did not run netasst, I just ran
"lsnrctl start" and now have a listener running and listening on port
1521/tcp. I also created a tablespace and a user and used "sqlplus
user/password" to create a few tables. But frankly I don't know if this
is a symptom that I have Net8 correctly installed and configured. I will
try to run netasst later to see how it goes.

-- 
Ugo Cei - [EMAIL PROTECTED]
Fuori Orario Srl - Galleria Manzoni 15, 27100 Pavia - Italy
Tel: +39.382.22651, Fax: +39.382.539467


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



Re: blackdown jdk version

1999-11-12 Thread Nathan Meyers

I think you didn't get an answer because, in general, people are
successfully using Swing and JNI with the JDK1.2 and nobody recognized
your problem.

> I am using Linux6.0(glibc2.0) jdk1.2(blackdown).
> Is there any known problem with this transition??

Yes, there are known problems with the JDK1.2 pre-release - you can read
about them at the Blackdown site and look through the mail archives. But
I don't think there's anything resembling your description.

I'm not sure what you mean by "Linux 6.0". Red Hat 6.0? SuSE 6.0? If it's
Red Hat, then you've got glibc 2.1.


Nathan Meyers
[EMAIL PROTECTED]


On Fri, Nov 12, 1999 at 11:53:56AM -0500, Raj Patel wrote:
> Hi,
> I am putting this problem here one more time.  I have a swing
> application using
> JNI.  Everything was working ok under blackdown jdk 1.1.7 with
> swing-1.1.1 .  Now
> i upgraded jdk to jdk 1.2(blackdown) so i don't have to have swing
> because it is
> already built in.  But now under jdk1.2 my application gives strange
> exception error,
> 
> 
> Exception occurred during event dispatching:
> java.lang.IndexOutOfBoundsException: -1
> at java.util.BitSet.get(Compiled Code)
> at javax.swing.DefaultListSelectionModel.clear(Compiled Code)
> at javax.swing.DefaultListSelectionModel.setState(Compiled Code)
> 
> at
> javax.swing.DefaultListSelectionModel.removeIndexInterval(Compiled Code
> )
> at
> javax.swing.plaf.basic.BasicListUI$ListDataHandler.intervalRemoved(Comp
> iled Code)
> at javax.swing.AbstractListModel.fireIntervalRemoved(Compiled
> Code)
> at javax.swing.DefaultComboBoxModel.removeAllElements(Compiled
> Code)
> at javax.swing.JComboBox.removeAllItems(Compiled Code)
> at Fsa.refreshAttrCombo(Compiled Code)
> at Fsa.addAttributes(Compiled Code)
> at Fsa.createComponents(Compiled Code)
> at Question$2.actionPerformed(Compiled Code)
> at javax.swing.AbstractButton.fireActionPerformed(Compiled Code)
> 
> at
> javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Compiled
>  Code)
> at javax.swing.DefaultButtonModel.fireActionPerformed(Compiled
> Code)
> at javax.swing.DefaultButtonModel.setPressed(Compiled Code)
> at
> javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Compiled Code)
> at java.awt.Component.processMouseEvent(Compiled Code)
> at java.awt.Component.processEvent(Compiled Code)
> at java.awt.Container.processEvent(Compiled Code)
> at java.awt.Component.dispatchEventImpl(Compiled Code)
> at java.awt.Container.dispatchEventImpl(Compiled Code)
> at java.awt.Component.dispatchEvent(Compiled Code)
> at java.awt.LightweightDispatcher.retargetMouseEvent(Compiled
> Code)
> at java.awt.LightweightDispatcher.processMouseEvent(Compiled
> Code)
> at java.awt.LightweightDispatcher.dispatchEvent(Compiled Code)
> at java.awt.Container.dispatchEventImpl(Compiled Code)
> at java.awt.Window.dispatchEventImpl(Compiled Code)
> at java.awt.Component.dispatchEvent(Compiled Code)
> at java.awt.EventQueue.dispatchEvent(Compiled Code)
> at java.awt.EventDispatchThread.run(Compiled Code)
> 
> 
> I tried to run in debugg mode but it died
> 
> black:rpatel% jdb Fsa
> Initializing jdb...
> 0xb0:class(Fsa)
> > run Fsa -interactive -outfile logfile
> running ...
> main[1]
> Current thread "main" died. Execution continuing...
> >
> Fsa exited
> 
> 
> I am using Linux6.0(glibc2.0) jdk1.2(blackdown).
> Is there any known problem with this transition??
> 
> -Raj
> 
> 
> --
> 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: blackdown jdk version

1999-11-12 Thread Raj Patel

Nathan Meyers wrote:

> I think you didn't get an answer because, in general, people are
> successfully using Swing and JNI with the JDK1.2 and nobody recognized
> your problem.

Thanks for the response.  I found the problem.  Now i have some trouble in
native calls.  I have Redhat Linux 6.0 with glibc2.1(my mistake i said 2.0).
I want to debug my native code(C++) using gdb .  I tried using attach process
id at gdb session but i did not get anything useful in my gdb sesson.

Is anybody familiar with jdb-gdb combination for debugging java code with
JNI??
I found most of the places with referenses to dbx which i don't have on
linux.
Thanks,

-Raj


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



Re: blackdown jdk version

1999-11-12 Thread Nathan Meyers

There isn't really a gdb-jdb combination. You can debug under gdb if
you want to debug native code, but you won't get source-level Java
debugging.

There are some tricks to getting your debugging session started under
gdb, because the breakpoint needs to be set in a library (your JNI code)
that isn't loaded at gdb startup. These steps can get you debugging
native code:

1) export LD_PRELOAD=
2) export DEBUG_PROG=gdb (or whatever debugger you want to use)
3) Run your application with green threads (java -green ...)
4) When the debugger starts up, set a breakpoint at main()
5) Run the program... be sure to specify the command-line args for java
6) When you hit the breakpoint in main(), set a breakpoint in your
   JNI code
7) Continue execution; gdb will stop when it hits your breakpoint.

Nathan


On Fri, Nov 12, 1999 at 02:02:09PM -0500, Raj Patel wrote:
> Nathan Meyers wrote:
> 
> > I think you didn't get an answer because, in general, people are
> > successfully using Swing and JNI with the JDK1.2 and nobody recognized
> > your problem.
> 
> Thanks for the response.  I found the problem.  Now i have some trouble in
> native calls.  I have Redhat Linux 6.0 with glibc2.1(my mistake i said 2.0).
> I want to debug my native code(C++) using gdb .  I tried using attach process
> id at gdb session but i did not get anything useful in my gdb sesson.
> 
> Is anybody familiar with jdb-gdb combination for debugging java code with
> JNI??
> I found most of the places with referenses to dbx which i don't have on
> linux.
> Thanks,
> 
> -Raj


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



Re: blackdown jdk version

1999-11-12 Thread Raj Patel

Nathan Meyers wrote:

> There isn't really a gdb-jdb combination. You can debug under gdb if
> you want to debug native code, but you won't get source-level Java
> debugging.
>
> There are some tricks to getting your debugging session started under
> gdb, because the breakpoint needs to be set in a library (your JNI code)
> that isn't loaded at gdb startup. These steps can get you debugging
> native code:
>
> 1) export LD_PRELOAD=
> 2) export DEBUG_PROG=gdb (or whatever debugger you want to use)
> 3) Run your application with green threads (java -green ...)
> 4) When the debugger starts up, set a breakpoint at main()

I am not able to do this,

black:rpatel% java -green "Fsa -interactive -outfile logfile"
GNU gdb 4.17.0.11 with Linux support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...

/usr/safdevel/JSAF/libsrc/libfsa/Fsa -interactive -outfile logfile: No such file
or directory.
(gdb) b Fsa:1565
No source file named Fsa.
(gdb) b Fsa.java:1565
No source file named Fsa.java.
(gdb) b Fsa.class:1565
No source file named Fsa.class.
(gdb) b netif.cc:165
No source file named netif.cc.
(gdb)

What am i missing??

-Raj

>
> 5) Run the program... be sure to specify the command-line args for java
> 6) When you hit the breakpoint in main(), set a breakpoint in your
>JNI code
> 7) Continue execution; gdb will stop when it hits your breakpoint.
>
> Nathan
>
> On Fri, Nov 12, 1999 at 02:02:09PM -0500, Raj Patel wrote:
> > Nathan Meyers wrote:
> >
> > > I think you didn't get an answer because, in general, people are
> > > successfully using Swing and JNI with the JDK1.2 and nobody recognized
> > > your problem.
> >
> > Thanks for the response.  I found the problem.  Now i have some trouble in
> > native calls.  I have Redhat Linux 6.0 with glibc2.1(my mistake i said 2.0).
> > I want to debug my native code(C++) using gdb .  I tried using attach process
> > id at gdb session but i did not get anything useful in my gdb sesson.
> >
> > Is anybody familiar with jdb-gdb combination for debugging java code with
> > JNI??
> > I found most of the places with referenses to dbx which i don't have on
> > linux.
> > Thanks,
> >
> > -Raj


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



Re: Pass by Reference question.

1999-11-12 Thread Peter Schuller

> I expected the following to work since Objects are supposedly
> pass-by-reference.  Am I doing something wrong here?

Yes: in the method you are chaning the reference, not the obejct.

E.g.:

Boolean a = Boolean.TRUE;
Boolean b = a;
b = Boolean.FALSE;

at this point, a is still equal to Boolean.TRUE. The third line simply
assigns b (the reference, NOT the object) to point to Boolean.FALSE.

-- 
/ Peter Schuller

PGP userID: 0x5584BD98 or 'Peter Schuller <[EMAIL PROTECTED]>'
Key retrival: Send an E-Mail to [EMAIL PROTECTED]
E-Mail: [EMAIL PROTECTED] Web: http://hem.passagen.se/petersch


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



Re: blackdown jdk version

1999-11-12 Thread Daniel P. Zepeda

I don't know about your problem, but I *do* know that you have to set 

THREADS_FLAG=green 
JAVA_COMPILER=NONE

to get jdb to run.

Thus spake Raj Patel on Fri, 12 Nov 1999:
> Hi,
> I am putting this problem here one more time.  I have a swing
> application using
> JNI.  Everything was working ok under blackdown jdk 1.1.7 with
> swing-1.1.1 .  Now
> i upgraded jdk to jdk 1.2(blackdown) so i don't have to have swing
> because it is
> already built in.  But now under jdk1.2 my application gives strange
> exception error,
> 
> 
> Exception occurred during event dispatching:
> java.lang.IndexOutOfBoundsException: -1
> at java.util.BitSet.get(Compiled Code)
> at javax.swing.DefaultListSelectionModel.clear(Compiled Code)
> at javax.swing.DefaultListSelectionModel.setState(Compiled Code)
> 
> at
> javax.swing.DefaultListSelectionModel.removeIndexInterval(Compiled Code
> )
> at
> javax.swing.plaf.basic.BasicListUI$ListDataHandler.intervalRemoved(Comp
> iled Code)
> at javax.swing.AbstractListModel.fireIntervalRemoved(Compiled
> Code)
> at javax.swing.DefaultComboBoxModel.removeAllElements(Compiled
> Code)
> at javax.swing.JComboBox.removeAllItems(Compiled Code)
> at Fsa.refreshAttrCombo(Compiled Code)
> at Fsa.addAttributes(Compiled Code)
> at Fsa.createComponents(Compiled Code)
> at Question$2.actionPerformed(Compiled Code)
> at javax.swing.AbstractButton.fireActionPerformed(Compiled Code)
> 
> at
> javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Compiled
>  Code)
> at javax.swing.DefaultButtonModel.fireActionPerformed(Compiled
> Code)
> at javax.swing.DefaultButtonModel.setPressed(Compiled Code)
> at
> javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Compiled Code)
> at java.awt.Component.processMouseEvent(Compiled Code)
> at java.awt.Component.processEvent(Compiled Code)
> at java.awt.Container.processEvent(Compiled Code)
> at java.awt.Component.dispatchEventImpl(Compiled Code)
> at java.awt.Container.dispatchEventImpl(Compiled Code)
> at java.awt.Component.dispatchEvent(Compiled Code)
> at java.awt.LightweightDispatcher.retargetMouseEvent(Compiled
> Code)
> at java.awt.LightweightDispatcher.processMouseEvent(Compiled
> Code)
> at java.awt.LightweightDispatcher.dispatchEvent(Compiled Code)
> at java.awt.Container.dispatchEventImpl(Compiled Code)
> at java.awt.Window.dispatchEventImpl(Compiled Code)
> at java.awt.Component.dispatchEvent(Compiled Code)
> at java.awt.EventQueue.dispatchEvent(Compiled Code)
> at java.awt.EventDispatchThread.run(Compiled Code)
> 
> 
> I tried to run in debugg mode but it died
> 
> black:rpatel% jdb Fsa
> Initializing jdb...
> 0xb0:class(Fsa)
> > run Fsa -interactive -outfile logfile
> running ...
> main[1]
> Current thread "main" died. Execution continuing...
> >
> Fsa exited
> 
> 
> I am using Linux6.0(glibc2.0) jdk1.2(blackdown).
> Is there any known problem with this transition??
> 
> -Raj
> 
> 
> --
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
--
Daniel P. Zepeda
[EMAIL PROTECTED]

"May the Schwartz be with you." -- Yogurt in Spaceballs. (MMM, yummy!)


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



Frame repaint

1999-11-12 Thread Martin Kavalar

Hello!
I am trying to do some painting on a panel used a a canvas with swing. So when
a button is pressed, the button is removed from the ContentPane and the Canvas
Panel is added. But my frame just wont draw the panel, only remove the button.
Only when i resize it the painting appears. I tried calling diffrent methods,
but only with setSize(x,x) the Canvas Panel appears. Can anyone help please
thx
  martin


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



Question about printing in Jdk 1.1

1999-11-12 Thread Eric Chao

I have an image that I wanted to print... This image is constructed
using MemoryImageSource using an array of bytes, with each byte
representing a pixel.
I also have a DirectColorModal to translate the color in each pixel.

 image = createImage
  (new MemoryImageSource
(d.width,
  d.height,
  dcm,/* Direct Color
Model */
  pixels,  /* array of bytes
*/
  0,
  d.width) );

When I tried to print the image. I keep getting this error(listed
below). But when I change the array of bytes to array of ints. It
worked.  But I do not want to store my data as ints when bytes works
fine... So any ideas???

Error Message:

Exception occurred during event dispatching:
java.lang.ClassCastException: java.awt.image.DirectColorModel
 at sun.awt.motif.PSGraphics.blitImage(Compiled Code)
 at sun.awt.motif.PSGraphics.drawImage(Compiled Code)
 at MyCanvas.paint(Compiled Code)
 at MemoryImageSourceTest1.actionPerformed(Compiled Code)
 at java.awt.Button.processActionEvent(Compiled Code)
 at java.awt.Button.processEvent(Compiled Code)
 at java.awt.Component.dispatchEventImpl(Compiled Code)
 at java.awt.Component.dispatchEvent(Compiled Code)
 at java.awt.EventDispatchThread.run(Compiled Code)



Chang-Cheng (Eric) Chao
Merlin Software Technologies Inc.


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



Re: Question about printing in Jdk 1.1

1999-11-12 Thread Jacob Nikom

Hi,

Here is some documentation:
"The direct color model is a color model which specifies a translation
from 
pixel values to alpha, red, green, and blue components using the actual
bits 
of the pixel value. This color model is similar to an X11 TrueColor
visual."

"The Abstract Window Toolkit represents each pixel as a 32-bit integer.
Bits 24-31 
are the alpha transparency, bits 16-23 are the red value, bits 8- 15 are
the green 
value, and bits 0-7 are the blue value."

You can use lookup table to save space and generate colors on fly.

Jacob Nikom.

Eric Chao wrote:
> 
> I have an image that I wanted to print... This image is constructed
> using MemoryImageSource using an array of bytes, with each byte
> representing a pixel.
> I also have a DirectColorModal to translate the color in each pixel.
> 
>  image = createImage
>   (new MemoryImageSource
> (d.width,
>   d.height,
>   dcm,/* Direct Color
> Model */
>   pixels,  /* array of bytes
> */
>   0,
>   d.width) );
> 
> When I tried to print the image. I keep getting this error(listed
> below). But when I change the array of bytes to array of ints. It
> worked.  But I do not want to store my data as ints when bytes works
> fine... So any ideas???
> 
> Error Message:
> 
> Exception occurred during event dispatching:
> java.lang.ClassCastException: java.awt.image.DirectColorModel
>  at sun.awt.motif.PSGraphics.blitImage(Compiled Code)
>  at sun.awt.motif.PSGraphics.drawImage(Compiled Code)
>  at MyCanvas.paint(Compiled Code)
>  at MemoryImageSourceTest1.actionPerformed(Compiled Code)
>  at java.awt.Button.processActionEvent(Compiled Code)
>  at java.awt.Button.processEvent(Compiled Code)
>  at java.awt.Component.dispatchEventImpl(Compiled Code)
>  at java.awt.Component.dispatchEvent(Compiled Code)
>  at java.awt.EventDispatchThread.run(Compiled Code)
> 
> Chang-Cheng (Eric) Chao
> Merlin Software Technologies Inc.
> 
> --
> 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]