Re: java programming

1999-02-15 Thread C.V. Rajagopal



On Sun, 14 Feb 1999, alexander lang wrote:

> Hi all.
> 
> Does anyone know if one is allowed to initialize static final variables 
> within the "try" clause of a static initializer block?
> 
> (eg.
>   static final int x;
>   static{
> try
>   {
>  x = 5;
>   }
>   catch(exception e)
>  {...and so on ..}
> )

in Java all variables with final qaulifier must be initialised during
decalration. so you can't compile this code

rajagopal

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



Regular Expressions

1999-02-15 Thread Frank B. Brokken

Hi, listmembers,

I'm looking for classes that can be used to test the contents of Strings
against regular expressions, comparable to Perl's regular expressions
capability or the standard C library's regcomp() and regexec() functions.

Does anybody know whether (and where) such classes are available for Java?

Thanks in advance for any pointers I might receive,


-- 
Frank B. Brokken(al sinds enige jaren uitgedost (untranslatable))
My extended signature is at http://www.icce.rug.nl/frank/signature



Re: java programming

1999-02-15 Thread Chris Huebsch

Hello,

> in Java all variables with final qaulifier must be initialised during
> decalration. so you can't compile this code

this is not correct. With Java2 you can use deferred-initialization of
final-variables.

That means that you can declare a: "final  ;" and do later a
" = ;"

But there must be one and only one initialization!

regards


Chris
-- 
public class chu extends ChrisHübsch implements TUChemnitz {
  String  email= "mailto:[EMAIL PROTECTED]";
  String  SMSMail  = "mailto:[EMAIL PROTECTED]?Subject=SMS: info";
  URL homepage = new URL("http://www.tu-chemnitz.de/~chu/");
  Talktalkto   = new Talk("[EMAIL PROTECTED]");
  Integer ePlus= new Integer(4628555);
}



Re: C/C++

1999-02-15 Thread Scheer István

You have to try Xelfi. This is a free software.
You can use it  on all platform, where you can find JDK.
Eredeti üzenet
Feladó: Ozer Irfan <[EMAIL PROTECTED]>
Címzett: C.V. Rajagopal <[EMAIL PROTECTED]>
Másolatot kap: alexander lang <[EMAIL PROTECTED]>;
[EMAIL PROTECTED] <[EMAIL PROTECTED]>
Dátum: 1999. február 15. 10:55
Tárgy: C/C++


>Hello
>How program graphics with C/C++ ?
>I search a development tools like Visual C++ or C++ Builder for Linux ?
>Can you help me ?
>
>Thanks.
>
>
>
>



Re: java programming

1999-02-15 Thread Dimitris Vyzovitis


Chris Huebsch wrote:
 
this is not correct. With Java2 you can use deferred-initialization
of
final-variables.
That means that you can declare a: "final  ;" and do
later a
" = ;"
But there must be one and only one initialization!
 

That's a feature that was missing, but we still compile under jdk117v1a...
Dimitris

 


Re: java programming

1999-02-15 Thread Juergen Kreileder

> Dimitris Vyzovitis writes:

Dimitris> Chris Huebsch wrote:

>> 
>> 
>> this is not correct. With Java2 you can use deferred-initialization of
>> final-variables.
>> 
>> That means that you can declare a: "final  ;" and do later a
>> " = ;"
>> 

Dimitris> That's a feature that was missing, but we still compile
Dimitris> under jdk117v1a...

The feature is called 'blank finals' and was introduced in Java 1.1
(see the Inner Classes Specification). Unfortunately javac 1.1 has
many problems with blank finals, javac 1.2 is much better at this.


Juergen

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



Device communication.

1999-02-15 Thread Ejaz Mohd

Hello,
I've small problem. 
I've a device connected on a serial port. To communciate with that 
device I've opened random access file.
This strategy works but when device is unable to send me the
required bytes or when device is switched off my java program
goes in an blocked mode. And unless I press ^C the program does'nt
come out.
One of the alternatives is to use 'Communication API' but is their
any other method?
Ejaz

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



Re: C/C++

1999-02-15 Thread Nathan Buggia

Look into tools such as openGL at www.opengl.org

nate

On Mon, 15 Feb 1999, Ozer Irfan wrote:

> Hello
> How program graphics with C/C++ ?
> I search a development tools like Visual C++ or C++ Builder for Linux ?
> Can you help me ?
> 
> Thanks.
> 
> 
> 
> 



Re: Regular Expressions

1999-02-15 Thread Carl H. Sayres

> Hi, listmembers,
> 
> I'm looking for classes that can be used to test the contents of Strings
> against regular expressions, comparable to Perl's regular expressions
> capability or the standard C library's regcomp() and regexec() functions.
> 
> Does anybody know whether (and where) such classes are available for Java?
> 
> Thanks in advance for any pointers I might receive,

http://javaregex.com/

Very easy to use, and works well.

- Carl



Re: Regular Expressions

1999-02-15 Thread C. Harald Koch

I know of two:


* gnu.regexp - Regular Expressions For Java
  by Wes Biggs <[EMAIL PROTECTED]>
  http://www.cacas.org/~wes/java/

 contains OROMatcher, a regexp pacakage that claims
to be 100% compatible with Perl5 Regular expressions.

-- 
C. Harald Koch <[EMAIL PROTECTED]>

"It takes a child to raze a village."
-Michael T. Fry



About Communication Ports API...

1999-02-15 Thread Julian Bolivar

Dear Srs.

Can I  use the Sun's Communication API in the Linux JDK 1.1.7v1a,
because I need access the PC's Serial and Parallel Ports.

Regards.

Julian Bolivar



Re: About Communication Ports API...

1999-02-15 Thread Chris Huebsch

Hello,

there are Linux-Ports but unfortunately they only support Serial Ports.
(Please correct me if I am wrong.)

Have a look at:

http://www.blackdown.org/java-linux/otherproducts.html

and look for: Java Comm for Linux or RXTX

greetings

Chris

Julian Bolivar wrote:
> 
> Dear Srs.
> 
> Can I  use the Sun's Communication API in the Linux JDK 1.1.7v1a,
> because I need access the PC's Serial and Parallel Ports.
> 
> Regards.
> 
> Julian Bolivar

-- 
public class chu extends ChrisHübsch implements TUChemnitz {
  String  email= "mailto:[EMAIL PROTECTED]";
  String  SMSMail  = "mailto:[EMAIL PROTECTED]?Subject=SMS: info";
  URL homepage = new URL("http://www.tu-chemnitz.de/~chu/");
  Talktalkto   = new Talk("[EMAIL PROTECTED]");
  Integer ePlus= new Integer(4628555);
}



Re: Device communication.

1999-02-15 Thread Chris Abbey

Basically you want a non-blocking read... join the club.

Here's _a_ solution: use two threads. The first thread reads the data,
the second thread sleeps for a while and wakes up the first thread if
it hasn't read yet. (yeah, "ugh" was my first reaction to this method
too)

Here's _a_better_ solution (but still not optimal):

byte[]
readUpToNBytesWithOutBlockingForever(
  InputStream from,
  int N,
  int maxLoops) {
byte[] retval = new Byte[N];
int temp;
int rsf = 0;
int lcv = 0;
while (rsf < N && 0 < lcv) {
  temp = from.available();
  if (temp > 0) {
from.read(retval, rsf, temp); //won't block
lcv = 0; //reset loop count var
rsf += temp;
  } else {
++lcv;
//you could also do a thread.sleep() here if your device is
// really slow, or some form of thread.yeild() if you are
// worried about chewing up CPU time in a busy wait state
}
if (rsf = N)
  return retval;
else
  ...
  }

Well, it's ugly code, but you get the idea

Now I'm curious... what file are you using to talk to a serial device?
something in /dev, but which? /dev/cua? does this work both for read
and write? I'm looking at doing some form of out-of-band signaling
between two PCs (right next to each other) and a null modem cable sounds
a lot cheaper than my other ideas ;) 

Oh... but wait... does available() correctly report on these "files"
or do they suffer the same problem as those in /proc?  It would be nice,
in this case, if available() would report the bytes as yet unconsumed
for the port or pipe or whatever is under the file. Of course that assumes
there is a buffering under there... and now I'm getting into deeper water
than I care to swim this week... any kernel hackers care to step in and
tell me I'm being a wishfull fool? :) -=Chris

At 04:25 AM 2/15/99 PST, Ejaz Mohd wrote:
>Hello,
>I've small problem. 
>I've a device connected on a serial port. To communciate with that 
>device I've opened random access file.
>This strategy works but when device is unable to send me the
>required bytes or when device is switched off my java program
>goes in an blocked mode. And unless I press ^C the program does'nt
>come out.
>One of the alternatives is to use 'Communication API' but is their
>any other method?
>Ejaz
>
>__
>Get Your Private, Free Email at http://www.hotmail.com
>
>
>

<*> cabbey at rconnect dot com  http://homepage.rconnect.com/cabbey/ <*>
"What can Microsoft do? They certainly can't program around us." - Linus

-BEGIN GEEK CODE BLOCK-   Version:3.12   http://www.geekcode.com
GCS$/IT/PA$ d(-) s++:+ a-- C+++$ UL UA++$ P++ L++ E- W++ N+ o? K? !P
w---(+)$ O- M-- V-- Y+ PGP+ t--- 5++ X+ R tv b+ DI+++ D G e++ h(+) r@ y?
--END GEEK CODE BLOCK--



Re: Help me compile for Native Methods?

1999-02-15 Thread Moses DeJong

You need to compile that as a shared library not a static lib. Use -shared
not -static on the command line.

Mo DeJong
dejong at cs.umn.edu

On Mon, 15 Feb 1999, Peter Gutowski wrote:

> I've used Cay Horstmann's and Gary Cornell "Core Java" books and have been
> pretty happy with them. The second volume claims to help you create native
> methods that can be called from java code. Their examples use Solaris and
> WindozNT only though.. 
> 
> The instructions for using javah -jni to create a .h file are clear.
> Everything seems quite smooth until I try to run the java program that
> calls the C code. Here's what I get:
> 
> $ java HelloNative
> @@Native.so: ELF file's phentsize not the expected size
> (libHelloNative.so)
> java.lang.UnsatisfiedLinkError: greeting
> at HelloNative.main(HelloNative.java:10)
> $
> 
> I'm guess I'm not sure what compile options I need to be using to make
> java happy. My Make file (currently) looks something like this:
> 
> libHelloNative.so: HelloNative.c HelloNative.h
> gcc -c -o libHelloNative.so  \
> -static \
> -I/usr/java/include \
> -I/usr/java/include/genunix \
>  HelloNative.c
> 
> The java program calling the C function is quite simple: 
> 
> public class HelloNative {
>   public native static void greeting();
> 
>   static {
> System.loadLibrary ( "HelloNative" );
>   }
> 
>   public static void main ( String args[] ) {
>   HelloNative hn = new HelloNative();
>   hn.greeting();
>   }
> 
> }
>  
> The C program is equally simple:
> #include "HelloNative.h"
> #include 
> 
> JNIEXPORT void JNICALL Java_HelloNative_greeting
>   ( JNIEnv *env, jclass cl) {
>   printf ( "Hello Native World" );
> }
> 
> All of this is *similar* to the example in the book but I am not sure what
> I need to do to make it work. Any ideas?
> 
> Peter Gutowski
> email: [EMAIL PROTECTED]
> http://www.powervue.com/~peterg
> 
> 



Re: Help me compile for Native Methods?

1999-02-15 Thread Raju Karia

Peter Gutowski wrote:
> 
> I've used Cay Horstmann's and Gary Cornell "Core Java" books and have been
> pretty happy with them. The second volume claims to help you create native
> methods that can be called from java code. Their examples use Solaris and
> WindozNT only though..
> 
> The instructions for using javah -jni to create a .h file are clear.
> Everything seems quite smooth until I try to run the java program that
> calls the C code. Here's what I get:
> 
> $ java HelloNative
> @@Native.so: ELF file's phentsize not the expected size
> (libHelloNative.so)
> java.lang.UnsatisfiedLinkError: greeting
> at HelloNative.main(HelloNative.java:10)
> $
> 
> I'm guess I'm not sure what compile options I need to be using to make
> java happy. My Make file (currently) looks something like this:
> 
> libHelloNative.so: HelloNative.c HelloNative.h
> gcc -c -o libHelloNative.so  \
> -static \
> -I/usr/java/include \
> -I/usr/java/include/genunix \
>  HelloNative.c
> 
> The java program calling the C function is quite simple:
> 
> public class HelloNative {
>   public native static void greeting();
> 
>   static {
> System.loadLibrary ( "HelloNative" );
>   }
> 
>   public static void main ( String args[] ) {
>   HelloNative hn = new HelloNative();
>   hn.greeting();
>   }
> 
> }
> 
> The C program is equally simple:
> #include "HelloNative.h"
> #include 
> 
> JNIEXPORT void JNICALL Java_HelloNative_greeting
>   ( JNIEnv *env, jclass cl) {
>   printf ( "Hello Native World" );
> }
> 
> All of this is *similar* to the example in the book but I am not sure what
> I need to do to make it work. Any ideas?
> 
> Peter Gutowski
> email: [EMAIL PROTECTED]
> http://www.powervue.com/~peterg



I've used native methods on Linux very successfully (but about two years
ago !). Your source code looks OK. I think you need to compile the C
code
with a special option for gcc to generate a shared object - can't
remember
off hand what it is (maybe "-shared").

Raju Karia



Help me compile for Native Methods?

1999-02-15 Thread Peter Gutowski

I've used Cay Horstmann's and Gary Cornell "Core Java" books and have been
pretty happy with them. The second volume claims to help you create native
methods that can be called from java code. Their examples use Solaris and
WindozNT only though.. 

The instructions for using javah -jni to create a .h file are clear.
Everything seems quite smooth until I try to run the java program that
calls the C code. Here's what I get:

$ java HelloNative
@@Native.so: ELF file's phentsize not the expected size
(libHelloNative.so)
java.lang.UnsatisfiedLinkError: greeting
at HelloNative.main(HelloNative.java:10)
$

I'm guess I'm not sure what compile options I need to be using to make
java happy. My Make file (currently) looks something like this:

libHelloNative.so: HelloNative.c HelloNative.h
gcc -c -o libHelloNative.so  \
-static \
-I/usr/java/include \
-I/usr/java/include/genunix \
 HelloNative.c

The java program calling the C function is quite simple: 

public class HelloNative {
  public native static void greeting();

  static {
System.loadLibrary ( "HelloNative" );
  }

  public static void main ( String args[] ) {
  HelloNative hn = new HelloNative();
  hn.greeting();
  }

}
 
The C program is equally simple:
#include "HelloNative.h"
#include 

JNIEXPORT void JNICALL Java_HelloNative_greeting
  ( JNIEnv *env, jclass cl) {
  printf ( "Hello Native World" );
}

All of this is *similar* to the example in the book but I am not sure what
I need to do to make it work. Any ideas?

Peter Gutowski
email: [EMAIL PROTECTED]
http://www.powervue.com/~peterg