Re: Java shell

2000-03-16 Thread Seth M. Landsman

On Thu, Mar 16, 2000 at 01:28:01PM -0500, Timothy Reaves wrote:
> I saw - somewhere sometime - a java shell application, that would
> let you interactively execute java code.  I've lost the link.  Can
> someone provide some assistance?

http://www.beanshell.org/

-Seth
-- 
"It is by will alone I set my mind in motion"

 PGP signature


Re: RMI Problems

2000-03-16 Thread David Marshall

[EMAIL PROTECTED] wrote:

> I have been attempting to get an RMI Client and Server to run using
> 2 Linux boxes running Red Had 6.1 (one dual boots 95).  The Client
> and Server are "textbook" examples.
>
> I have run them succesuffly on Win95, WinNT and Solaris
> networks. When I run both on the same linux machine, it works.  In
> addition,  when I run the Server on the Win95 box and the Client on
> the Linux box the program works but when the Server is on the Linux box I
> get the same error message that I get when the client is on one linux box
> and the server is on another:
>
> java.rmi.ConnectException: Connection refused to host: 127.0.0.1;
> nested exception is: java.net.ConnectException: Connection 
> refused.net.ConnectException: Connection refused at

> My questions are
> 1) Has anyone EVER gotten RMI to work properly between multiple
> linux machines?  If my analysis is correct, it should never work.

RMI on Linux works fine.

>
> 2)Is there something I could do on the Server side to get it to return the
> correct address 192.168.0.2 to the client?

I suspect you don't have an RMIRegistry on Linux - I can produce an identical
stack trace by running an RMI client app and pointing it at an RMI Registry
that isn't running.

Choose one of your Linux boxes to act as your RMIRegistry and then start the
registry in the background via:

rmiregistry &

Also make sure that your server's bind() call and client's lookup() call are
pointing at the same registry ('rmi://registryHostName/yourObjectBoundName' if
your using URL style.)

--
David Marshall   email: [EMAIL PROTECTED]
VM Systems, Inc. phone: 1-941-596-2480
Naples, FL USA   fax:   1-941-596-2483




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



Re: Java shell

2000-03-16 Thread Mo DeJong

Do you mean Jacl? It is a Tcl port written in Java. The homepage is at
http://www.scriptics.com/java

With Jacl, you can allocate Java objects and call methods on them like
this.

set str [java::new String "I am a Java string"]
set hc [$str hashCode]

It is very cool stuff.

Mo Dejong
Red Hat Inc.

> I saw - somewhere sometime - a java shell application, that would
> let you interactively execute java code.  I've lost the link.  Can
> someone provide some assistance?
> 
> Thanks.
> 
> 
> --
> 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: exec() on Linux

2000-03-16 Thread David Marshall

[EMAIL PROTECTED] wrote:

> Hi:I got a java application that uses exec("nativeApp.exe") to start a
> native application.  It works fine on NT.  But on Linux exec("a.out")
> gets an exception saying a.out could not be found.  a.out is placed in
> the same directory as java app does.  What I missed?Thank you.Lee

Lee,

Either:
- ensure that the current directory is part of your PATH, or
- invoke as exec("./a.out");

--
David Marshall   email: [EMAIL PROTECTED]
VM Systems, Inc. phone: 1-941-596-2480
Naples, FL USA   fax:   1-941-596-2483




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



Re: Java shell

2000-03-16 Thread vladimir

JPython allows this, I think.

---Vladimir

Vladimir G. Ivanovichttp://www.leonora.org/~vladimir
2770 Cowper St. [EMAIL PROTECTED]
Palo Alto, CA 94306-2447 +1 650 678 8014

"TR" == Timothy Reaves <[EMAIL PROTECTED]> writes:

  TR> I saw - somewhere sometime - a java shell application, that
  TR> would
  TR> let you interactively execute java code. I've lost the link. Can
  TR> someone provide some assistance?

  TR> Thanks.


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


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



Re: Java shell

2000-03-16 Thread Weiqi Gao

Mo DeJong wrote:
> 
> Do you mean Jacl? It is a Tcl port written in Java. The homepage is at
> http://www.scriptics.com/java
> 
> With Jacl, you can allocate Java objects and call methods on them like
> this.
> 
> set str [java::new String "I am a Java string"]
> set hc [$str hashCode]
> 
> It is very cool stuff.

And don't forget rhino (http://www.mozilla.org/rhino, JavaScript):
  js> c = java.awt.Frame;
  js> o = new c("Frame");
  js> o.show();

and Kawa (http://www.gnu.org/software/kawa/, Scheme):
  #kawa:1# (define f (make ))
  #kawa:2# (invoke f 'show)

Although I'm sure the Beanshell is what the original poster wanted.

-- 
Weiqi Gao
[EMAIL PROTECTED]


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



Re: Java shell

2000-03-16 Thread Dimitrios Vyzovitis


Timothy Reaves wrote:
    I saw - somewhere sometime - a
java shell application, that would
let you interactively execute java code.  I've lost the link. 
Can
someone provide some assistance?

jpython is  definitely what you are looking for.
Really simple and intuitive.
You can even mix java and python objects (python classes that inherit
java classes ;-).
Furthermore, JPython can be the best debugger you can think of.
-- dimitris 
   mailto:[EMAIL PROTECTED]
 


Re: RMI Problems

2000-03-16 Thread Alexander V. Konstantinou

Sounds like you're exporting an RMI URL with //localhost (127.0.0.1) from
one machine.  If you're constructing the RMI URL by invoking the InetAddress
getLocalHost() method, that may be returning the loop-back interface
address.  I thought this problem was solved with the latest JDK, but
you can work around it, by changing the order in which the IP addresses
are defined in /etc/hosts (move your eth0 name/IP address first).

Alexander

On Thu, Mar 16, 2000 at 04:15:45PM -0500, David Marshall wrote:
> [EMAIL PROTECTED] wrote:
> 
> > I have been attempting to get an RMI Client and Server to run using
> > 2 Linux boxes running Red Had 6.1 (one dual boots 95).  The Client
> > and Server are "textbook" examples.
> >
> > I have run them succesuffly on Win95, WinNT and Solaris
> > networks. When I run both on the same linux machine, it works.  In
> > addition,  when I run the Server on the Win95 box and the Client on
> > the Linux box the program works but when the Server is on the Linux box I
> > get the same error message that I get when the client is on one linux box
> > and the server is on another:
> >
> > java.rmi.ConnectException: Connection refused to host: 127.0.0.1;
> > nested exception is: java.net.ConnectException: Connection 
> > refused.net.ConnectException: Connection refused at
> 
> > My questions are
> > 1) Has anyone EVER gotten RMI to work properly between multiple
> > linux machines?  If my analysis is correct, it should never work.
> 
> RMI on Linux works fine.
> 
> >
> > 2)Is there something I could do on the Server side to get it to return the
> > correct address 192.168.0.2 to the client?
> 
> I suspect you don't have an RMIRegistry on Linux - I can produce an identical
> stack trace by running an RMI client app and pointing it at an RMI Registry
> that isn't running.
> 
> Choose one of your Linux boxes to act as your RMIRegistry and then start the
> registry in the background via:
> 
> rmiregistry &
> 
> Also make sure that your server's bind() call and client's lookup() call are
> pointing at the same registry ('rmi://registryHostName/yourObjectBoundName' if
> your using URL style.)


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



Re: RMI Problems

2000-03-16 Thread ice

Date forwarded: Thu, 16 Mar 2000 18:16:20 -0700 (MST)
Date sent:  Thu, 16 Mar 2000 20:16:10 -0500
From:   "Alexander V. Konstantinou" <[EMAIL PROTECTED]>
To: David Marshall <[EMAIL PROTECTED]>
Copies to:  [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject:Re: RMI Problems
Forwarded by:   [EMAIL PROTECTED]

> Sounds like you're exporting an RMI URL with //localhost (127.0.0.1) from
> one machine.  If you're constructing the RMI URL by invoking the InetAddress
> getLocalHost() method, that may be returning the loop-back interface
> address.  I thought this problem was solved with the latest JDK, but
> you can work around it, by changing the order in which the IP addresses
> are defined in /etc/hosts (move your eth0 name/IP address first).
> 
> Alexander
> 


THANK YOU!!!

I just changed the order of the entries in the /etc/hosts file so that 
the entry for the localhost is the last entry (it had been the first 
entry) and now the client on the other machine works (ie no longer 
thorws the exception from trying to connect to 127.0.0.1 instead of 
192.168.0.2 

Thanks again and thanks to everyone who responded to my post.



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



Re: RMI Problems

2000-03-16 Thread Chris Abbey

I think you're hitting one of the problems with RMI on multi-homed machines,
the stubs hold a liveref object which contains an address and a port. On a
machine with multiple addresses you sometimes endup shipping a stub that
contains an address on the "wrong" interface. Take for example my setup
where I have a machine called "fw" (for the obvious reason) which has
two eth interfaces (eth0 = 10.0.0.1 and eth1 = 24.x.x.x dhcp assigned).
the sequence is that the rmiregistry binds 0.0.0.0:1099 (all interfaces,
fixed port) then the server process binds either 10.0.0.1:0 (asks for a
random port from opsys) *or* 24.x.x.x:0 (again random port) and exports all
it's objects on that endpoint (address/port combo). When it binds an object
into the registry the stub is stored in the registry, it contains three
pieces of identifying information: address, port, and object id. When this
info is handed to a client on the same machine you're OK, but when this stub
is handed to remote clients then they don't know how to reach the object.
In my case the server was exporting on the external address so I simply
had to define a route from the internal interface to the external address.
Now when we hit this at work it was the opposite case, the address chosen
was the internal address... which meant no one could reach the server from
outside the firewall (which no one thought to test untill the last #$%@#
minute of course!). "Fortunately" we were on NT and it is trivial to change
the binding order on NT (as in any nt admin could point-click-grunt their
way through it) but, I can't figure out how to do this on Linux. What you're
seeing is similar, except that instead of an external interface it's the
loopback interface that's being bound for the rmi server.

to your questions:
1. yes. this isn't a linux problem perse... rmi is borked in this regard,
 the difficulty I see in configuring this aspect of linux doesn't help.
 I routinely have several servers up and running in a cooperative
 network, all linux boxen clients on several machines talking to all
 of the servers - of course in this case each box has exactly ONE
 interface, eth0
2. if you can get it to bind your network interface instead you'll be good
 to go.
3. it's sun confidential material, sign the contract and you can see it if
 you want... it ain't pretty - trust me.


  cabbey at home dot net <*> http://members.home.net/cabbey
   I want a binary interface to the brain!
Today's opto-mechanical digital interfaces are just too slow!


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



two questions about Sun's JDK 1.2.2

2000-03-16 Thread Tomoyuki Kosimizu

Hi,

I have two questions about Sun's JDK 1.2.2 for Linux.

1. java.awt.TextArea does not wrap text. And it cannot show Japanese 
   even if java.awt.List can. Why?

2. java.text.SimpleDateFormat is seemed odd.

import java.text.*;
import java.util.*;

class test {
  public static void main(String[] args) throws Exception {
String DATE_PATTERN = "/MM/dd HH:mm:ss zzz";
DateFormat fmt = new SimpleDateFormat(DATE_PATTERN);
fmt.setTimeZone(TimeZone.getTimeZone("GMT"));
String str = fmt.format(new Date());
System.out.println(str);
System.out.println(fmt.parse(str));
  }
}

result:

% export LANG=ja_JP.ujis
% java test
2000/03/16 07:10:27 GMT+00:00
Thu Mar 16 16:10:27 JST 2000
% export LANG=C
% java test
2000/03/16 07:11:46 GMT
Thu Mar 16 16:11:46 JST 2000

"GMT+00:00" seems not match the pattern. Is it correct?

Tomoyuki Kosimizu
[EMAIL PROTECTED]


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



Re: exec() on Linux

2000-03-16 Thread TrentJarvi

The current directory is usually not in your path.  Try exec("./a.out")

---
Trent Jarvi
[EMAIL PROTECTED]

On Thu, 16 Mar 2000 [EMAIL PROTECTED] wrote:

> Hi:
>  
> I got a java application that uses exec("nativeApp.exe") to start a native
> application.  It works fine on NT.  But on Linux exec("a.out") gets an
> exception saying a.out could not be found.  a.out is placed in the same
> directory as java app does.  What I missed?
>  
> Thank you.
>  
>  
> Lee
>  
> 


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



exec() on Linux

2000-03-16 Thread Lee_Xing



Hi:
 
I got 
a java application that uses exec("nativeApp.exe") to start a native 
application.  It works fine on NT.  But on Linux exec("a.out") gets an 
exception saying a.out could not be found.  a.out is placed in the same 
directory as java app does.  What I missed?
 
Thank 
you.
 
 
Lee
 


Re: Java shell

2000-03-16 Thread Rob Saul

Timothy Reaves wrote:
> 
> I saw - somewhere sometime - a java shell application, that would
> let you interactively execute java code.  I've lost the link.  Can
> someone provide some assistance?

Perhaps you're thinking of http://www.beanshell.org ?

--
Rob Saul |


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



Java shell

2000-03-16 Thread Timothy Reaves

I saw - somewhere sometime - a java shell application, that would
let you interactively execute java code.  I've lost the link.  Can
someone provide some assistance?

Thanks.


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



RMI Problems

2000-03-16 Thread ice

I have been attempting to get an RMI Client and Server to run using 
2 Linux boxes running Red Had 6.1 (one dual boots 95).  The Client 
and Server are "textbook" examples.

I have run them succesuffly on Win95, WinNT and Solaris 
networks. When I run both on the same linux machine, it works.  In 
addition,  when I run the Server on the Win95 box and the Client on 
the Linux box the program works but when the Server is on the Linux box I 
get the same error message that I get when the client is on one linux box 
and the server is on another:

java.rmi.ConnectException: Connection refused to host: 127.0.0.1; 
nested exception is: java.net.ConnectException: Connection 
refused.net.ConnectException: Connection refused at 
java.net.PlainSocketImpl.socketConnect(Native Method) at 
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:301) at 
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:121) 
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:108) at 
java.net.Socket.(Socket.java:265) at 
java.net.Socket.(Socket.java:94) at 
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDir
ectSocketFact ory.java:25) at 
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIM
asterSocketFact ory.java:120) at 
sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:493) 
at 
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:1
90) at 
sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:17
4) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:83) at 

Many of you will probably recognize this as a frequent problem that has 
been discussed before and will probably offer several solutions:
1) Fix the .java.policy file. 
I have allready tried this and it did not fix the problem. Currently the 
.java.policy file on both machines reads like this:
grant {
permission java.security.AllPermission;
permission java.net.SocketPermission "*:1024-65535", 
"connect,accept,resolve";
permission java.net.SocketPermission "*:80", "connect"; 

};

2) Remove the skeleton files from the client.
I allready tried this and it did not fix the problem.
3) Specify the port number in the clients Naming.lookup call.
I allready tried this and it did not fix the problem.
I have added some debug code to the PlainSocketImpl class to see 
what the socketConnect method is trying to connect to and found some 
interesting results:
On the server side, when the server is started up first a connection will 
be made to 192.168.0.2 (the server) port 1099 then a connection will 
be made to 127.0.0.1 port 1184 (this will vary each time the server is 
started)
On the client side, first a connection will be made to 192.168.0.2 port 
1099 then a connection will be attempted to 127.0.0.1 port 1184. At 
this point the exception is raised.
What I think is happening is that every time a Remote object is started, it 
connects to the port 1099 and is assigned a port. When a client attempts 
to do the naming.lookup it contacts the server machine and requests the 
location of the remote object from port 1099 on the server machine.  
The server machine then returns the machine name and port number 
where the remote object is running and the client then connects to there.
Unfortunatly the server appears to be returning 127.0.0.1 as the location 
of the remote object when it should be returning the actual address 
(192.168.0.2).
My questions are 
1) Has anyone EVER gotten RMI to work properly between multiple 
linux machines?  If my analysis is correct, it should never work.
2)Is there something I could do on the Server side to get it to return the 
correct address 192.168.0.2 to the client?
3) Where do I find the source code for 
sun.rmi.transport.proxy.RMIDirectSocketFactory?




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