I am trying to test the new APL2 feature that enables APL to interact
with Java. When I start the DEMOJAVA function from the DEMOJAVA
workspace, I get the error "DeleteLocalRef unavailable" in the session
and the command window shows the message "Can't load Java library
JVM.DLL". I have a JDK 1.4 installed. Any hints what is wrong?
H.Faber
If you search for JVM.DLL on your machine, where is it?
Doug Aiton - APL Products and Services
I have the same problem. My JAVA is not from IBM, so my PATH is
C:\Program Files\Java\j2re1.4.2\bin\client and I copied JVM.DLL
to WINNT\System32 to be found for sure. Doen's help.
Regards,
Sasha.
Doug Aiton <ai...@us.ibm.com> wrote in message news:<40EAE1A3...@us.ibm.com>...
Btw: I use the original Java from Sun. That should not make any
difference, or does it?
H.Faber
Doug Aiton schrieb:
I don't know if using Java from Sun is "supposed" to make a difference.
I am using Java from IBM on my Windows machines here and I don't see
the problem.
Regards, Doug Aiton - APL Products and Services
Processor 14 and the APL2 interface to Java tries to load the Java Virtual
Machine (JVM) as it initializes. If the JVM can not be loaded, the
interface produces the message you observed and refuses to start. This
causes Processor 14 associations to fail.
In order for Processor 14 to load the JVM, the directories containing the
JVM dynamic load library and the Java system libraries must be available in
the system's search order.
Java is available from several sources. IBM provides Java for free download
for AIX and Linux.
You can download IBM's Java for AIX from here:
http://www.ibm.com/developerworks/java/jdk/aix/index.html
You can download IBM's Java for Linux from here:
http://www.ibm.com/developerworks/java/jdk/linux140
IBM does not provide a free download of Java for Windows. An IBM Java for
Windows is included in several products, most notably WebSphere Studio
Application Developer. Information about WSAD is available here:
http://www.ibm.com/software/awdtools/studioappdev/
Java is available for free download for Solaris and Windows from Sun
Microsystems.
Once you have a version of Java installed, you need to add the Java Runtime
Environment (JRE) to the system's search order. Which directories you use
depends on which version of Java you installed:
If you install WebSphere Studio Application Developer:
REM Add IBM WebSphere JRE's directory to environment
SET PATH=C:\Program Files\IBM\WebSphere Studio\Application
Developer\v5.1.1\_jvm\jre\bin\classic;%PATH%
SET PATH=C:\Program Files\IBM\WebSphere Studio\Application
Developer\v5.1.1\_jvm\jre\bin;%PATH%
If you install a Sun Java:
REM Add Sun JRE's directory to environment
SET PATH=C:\j2sdk1.4.2_04\jre\bin\client;%PATH%
SET PATH=C:\j2sdk1.4.2_04\jre\bin;%PATH%
When you install Java, the installation process may ask you if you want the
JVM installed as the system JVM. If you say yes, it will also install Java
here: C:\Program Files\Java. You could use those directories. I have an IB
M Java as my system Java. I use them like this:
REM Add system JRE's directory to environment
SET PATH=C:\Program Files\Java\j2re1.4.2_04\bin\client;%PATH%
SET PATH=C:\Program Files\Java\j2re1.4.2_04\bin;%PATH%
You only need the JRE directories if you are only going to use Java from
APL2. If you also want to use the Java SDK tools, such as the running
stand-alone Java programs, use the javac compiler, or compile C code that
uses JNI, you must also add the SDK directories to the system's environment
variables.
Here's how to add the Sun Java SDK directories to the search order:
REM Add Sun JDK's directories to environment
SET PATH=C:\j2sdk1.4.2_04\bin;%PATH%
SET INCLUDE=C:\j2sdk1.4.2_04\include;%INCLUDE%
SET INCLUDE=C:\j2sdk1.4.2_04\include\win32;%INCLUDE%
SET LIB=C:\j2sdk1.4.2_04\lib;%LIB%
I apologize that this all seems unnecessarily complicated. The problem is
that none of the Java installers automatically set up the system search
order for using their JREs. We could have included a copy of Java with APL2
and set up the search order during the CSD installation process. However,
this would have added over 50 megabytes to the CSD and we decided that it
was not worh the extra download time.
Thank you.
David Liebtag
IBM APL Products and Services
thanks for your extensive explainations. I followed your instructions
and the javademo workspace now works as expected. The example for the
other way round, where java calls the apl2 interpreter, also works fine.
However, I have not been able to load a (initial) workspace when calling
apl2 from java. I tried the following:
Apl2interp Slave = new Apl2interp(new String[] \
{"-ws","1m", "-input", ")LOAD myws4java"});
and
Apl2object Result = Slave.Execute(")LOAD myws4java");
The first version does not give any error message, but then fails with a
value error when I try to call a function located inside the workspace
that should have been loaded. The second version throws an exception
right away.
As far as I can see, the apl2demo.java example does not load a workspace
for the slave interpreter. Is there a way to do this?
H.Faber
The APL2-Java interface uses the APL2 Programming Interface which has the
same restrictions as the APL2 Runtime Library. These include the
restriction that system commands are not supported. You should package your
workspace into a namespace using the external function CNS. You can then
use the Apl2interp class's Associate method to access objects in the
namespace. For example,
Apl2interp Slave = new Apl2interp() ;
Slave.Associate("NameSpace",11,"FOO") ;
APl2object Result = Slave.Execute("FOO") ;
For more information, consult the chapter on the APL2 Programming Interface
at the end of Part 3 of the User's Guide.