Randall,

Here are a few pointers I can give you:

- Do not use the Inline::Java CLASSPATH option, use the CLASSPATH environment
  variable instead.
- You can use the Inline::Java DEBUG option (set it to any int value
between 1 and 5) to get a better idea of what is going on.
- You can't use the import statement in Perl like in Java. When you
create a Java object from Perl, you must specify the full class name,
i.e. com::starbase::caliber::server::CaliberServer (or whatever the
correct package is)
- You can use *'s with STUDY. You have to enumerate each class
separately. In your case I believe CaliberServer is enough since you
also have AUTOSTUDY enabled.

Try something like this:

=======
#!/usr/bin/perl
use strict; use warnings;

BEGIN {
  print  $ENV{CLASSPATH} ;
}

use Inline (
  Java => STUDY,
  STUDY => ['com.starbase.caliber.server.CaliberServer'],
  AUTOSTUDY => 1,
  DEBUG => 3, # 1-5 is ok
) ;

my $server = 
com::starbase::caliber::server::CaliberServer->new(["cspar333239"]);
my $session = $server->login("admin", "admin");

my $ref_arrayOfProjects = $session->getProjects();
       foreach my $project (@$ref_arrayOfProjects){
         print $project->getName(), "\n";;
       }

==========


Good luck,

Patrick

On 5/10/05, Randall Marbach <[EMAIL PROTECTED]> wrote:
> Hi All
> 
> We use Borland CaliberRM as a requirements management
> system at work. My goal is to use the CaliberRM Java
> API, perl and Inline::Java to generate custom reports
> out of this requirements repository. I am new to java
> and Inline::Java, but what I want to do is reproduce
> the following java program in perl and inline::Java.
> This program simply logs onto the server and prints a
> list of projects stored on the server.
> 
> =======  caltst.java:
> 
> import com.starbase.caliber.*;
> import com.starbase.caliber.server.*;
> 
> public class caltst {
>         public static void main(String[] args)
>     {
>       CaliberServer server = new
> CaliberServer("cspar333239");
> 
>       try
>       {
>         Session CaliberSession = server.login("admin",
> "admin");
> 
>         Project[] arrayOfProjects =
> CaliberSession.getProjects();
>         for (int i = 0; i < arrayOfProjects.length;
> i++)
>         {
> 
> System.out.println(arrayOfProjects[i].getName());
>         }
> 
>       }
>       catch(RemoteServerException rse)
>         {
>         rse.printStackTrace();
>         }
> 
>             }
> 
> }
> 
> ==========
> my classpath is set as:
> 
> C:\CaliberUtil\caltst>set classpath
> classpath=;..\lib\CaliberRMSDK4COM70.jar
> 
> and when I execute the java program I get the
> following desired output:
> 
> C:\CaliberUtil\caltst>java caltst
> X100 Droid
> Automated Teller Machine
> Order Processing
> Company Standards
> Address Book
> EIS_CDD_DEV
> EIS_CDD_SYT
> EIS_CDD_PROD
> EIS_CDSD
> 
> Here is the perl version of the java code:
> =======
> #!/usr/bin/perl
> use strict; use warnings;
> 
> BEGIN {
> #       $ENV{CLASSPATH} = '/Data/Hi/higher.jar';
> print  $ENV{CLASSPATH} ;
> }
> use Inline Java => <<'END',CLASSPATH =>
> '../lib/CaliberRMSDK4COM70.jar',STUDY =>
> ['com.starbase.caliber.*','com.starbase.caliber.server.*'],
> AUTOSTUDY => 1;
> 
> import java.util.* ;
> import com.starbase.caliber.*;
> import com.starbase.caliber.server.*;
> 
> END
> 
> my $server = CaliberServer->new(["cspar333239"]);
> my $session = $server->login("admin", "admin");
> 
> my $ref_arrayOfProjects = $session->getProjects();
>         foreach my $project (@$ref_arrayOfProjects){
>           print $project->getName(), "\n";;
>         }
> 
> ==========
> 
> and this is what I get when I attempt to execute this
> code..
> 
> C:\CaliberUtil\caltst>perl caltst.pl
> ;..\lib\CaliberRMSDK4COM70.jar
> A problem was encountered while attempting to compile
> and install your Inline
> Java code. The command that failed was:
>   "\j2sdk1.4.2_07\bin\javac.exe" -deprecation  -d
> "C:\CaliberUtil\caltst\_Inline
> \lib\auto\caltst_pl_bda7" caltst_pl_bda7.java >
> cmd.out 2>&1
> 
> The build directory was:
> C:\CaliberUtil\caltst\_Inline\build\caltst_pl_bda7
> 
> The error message was:
> caltst_pl_bda7.java:3: package com.starbase.caliber
> does not exist
> import com.starbase.caliber.*;
> ^
> caltst_pl_bda7.java:4: package
> com.starbase.caliber.server does not exist
> import com.starbase.caliber.server.*;
> ^
> 2 errors
> 
> To debug the problem, cd to the build directory, and
> inspect the output files.
> 
>  at caltst.pl line 9
> BEGIN failed--compilation aborted at caltst.pl line
> 15.
> 
> C:\CaliberUtil\caltst>
> 
> =======
> 
> I suspect I am not setting up the parameters to
> Inline::Java correctly. Any help would be deeply
> appreciated.
> 
> TIA
> 
> Randy
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
> 


-- 
=====================
Patrick LeBoutillier
Laval, Québec, Canada

Reply via email to