[e-lang] Re: Java connection :))
Mark Miller
markm at cs.jhu.edu
Tue Nov 9 08:37:00 EST 2004
Peter Dimitrov wrote:
> Hi Mark,
>
> I still struggle to import my own class in E:)) I tried the following after
> I changed the CLASSPATH to point to MyClass.class (this is my class :)))
>
> def mycls := <unsafe:MyClass>
> def mycls := <unsafe:MyClass>()
> def mycls := <unsafe:java.MyClass>()
>
> and many more but still get the same error:
>
> "# problem: Failed: java.MyClass not found" or
> "# problem: Failed: MyClass not found"
>
> How that exactly has to be done?
How did you change the classpath? The recommended way is to invoke rune as
follows:
$ rune -cpa dir ...
or
$ rune -cpb dir ...
where "dir" is the root of a directory tree containing your MyClass.class
under the appropriate package path. (If the directory contains spaces or other
odd characters, be sure to put quotes around it.) The "..." is the remainder
of whatever your normal rune invocation would be, and would be empty for
interactive use. "-cpa" stands for "class path after" and appends the
directory to the class path, putting it last in the search order. "-cpb"
stands for "class path before", and prepends it. You can have multiple such
options in one rune invocation.
For example, if your MyClass.class is in the package foo.bar, and is located
on the file system at c:/x/y/foo/bar/MyClass.class, then you could say
$ rune -cpa "c:/x/y"
? def mycls := <unsafe:foo.bar.MyClass>
If MyClass.class is not in a package, i.e., is implicitly in the empty
package, and if it's located at c:/x/y/MyClass.class, then
$ rune -cpa "c:/x/y"
? def mycls := <unsafe:MyClass>
should indeed work, though I have little experience with package-less classes.
Be sure that MyClass is declared "public".
For more usage info on rune, say
$ rune --help
Especially useful is the option "-show" to see the command line that rune
would have executed, rather than executing it. Each command-line argument is
shown on a separate line, rather than using quotes. If you want to issue a
corresponding command to the Cygwin shell, you'll need the quotes. On my
WindowsXP laptop
$ rune -cpb "c:/x/y" -show
LD_LIBRARY_PATH="c:/Program Files/erights.org/bin/win32/x86"
/cygdrive/c/j2sdk1.4.2_05/bin/java.exe
-cp
c:/x/y;c:/Program Files/erights.org/e.jar;c:/Program
Files/erights.org/bin/win32/swt.jar
-Xfuture
-De.home=c:/Program Files/erights.org/
-Djava.library.path=c:/Program Files/erights.org/bin/win32/x86
org.erights.e.elang.interp.Rune
If you're still having problems, please send me everything I'd need to
reproduce this at my end. Thanks.
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the e-lang
mailing list