Re: Java Bridge Import [message #60964] |
Mon, 23 June 2008 07:41 |
humanumbrella
Messages: 52 Registered: June 2008
|
Member |
|
|
On Jun 23, 10:13 am, Nigel Wade <n...@ion.le.ac.uk> wrote:
> humanumbre...@gmail.com wrote:
>> Hey ~~
>
>> So, I'm trying to re-use much existing Java code in this java->IDL
>> rewrite process. However, if appears that I can only access Java
>> classes if they're jar'd up. I need to be able to access class files
>> without having to Jar them. (This is a huge application)
>
> No, you don't need to jar them. Have you read the IDL manual about how to access
> Java objects? Some of the examples there access individual class files.
>
>
>
>
>
>> Here's what I mean:
>> For example, I have a class "HelloWorld.java" and "HellowWorld.class"
>> in D:\IDLResearch\Bridge\
>
>> This code: javaClass = obj_new('IDLJavaObject$HELLOWORLD',
>> 'HelloWorld.java') returns
>
>> "% Class HelloWorld.java not found
>> % Execution halted at: IMPORTER 3 D:\IDLResearch\Bridge
>> \importer.pro
>> % $MAIN$ "
>
>> My idljavabrc file contains: D:\IDL\Bridge\ and D:\IDLResearch\Bridge
>> -- I've tried it with each.
>
>> Any thoughts ??
>> Thanks in advance!
>> --Justin
>
> The problem you have there is that you have not named your class file correctly.
> The classloader does not want your java source file. Further, the classloader
> locates classes by package name, and '.' is the separator for packages within
> the package hierarchy. What the classloader will be looking for in your example
> is a file called 'HelloWorld\java.class'.
>
> If your java class in not part of a package then you should include the
> directory in which HelloWorld.class resides in the CLASSPATH and specify the
> class 'HelloWorld' in the obj_new.
>
> If your class is part of package then you need to include the base directory of
> package hierarchy in the CLASSPATH and specify the fully qualified class name
> in obj_new.
>
> --
> Nigel Wade
Yes, I did have a typo -- but the ultimate problem was the
specification of the folder w/ a space.
asdf = obj_new('IDLJavaObject$HELLOWORLD', $
'HelloWorld')
with the proper set up in idljavabrc file works.
Thanks!
--Justin
|
|
|
Re: Java Bridge Import [message #60965 is a reply to message #60964] |
Mon, 23 June 2008 07:13  |
Nigel Wade
Messages: 286 Registered: March 1998
|
Senior Member |
|
|
humanumbrella@gmail.com wrote:
> Hey ~~
>
> So, I'm trying to re-use much existing Java code in this java->IDL
> rewrite process. However, if appears that I can only access Java
> classes if they're jar'd up. I need to be able to access class files
> without having to Jar them. (This is a huge application)
No, you don't need to jar them. Have you read the IDL manual about how to access
Java objects? Some of the examples there access individual class files.
>
> Here's what I mean:
> For example, I have a class "HelloWorld.java" and "HellowWorld.class"
> in D:\IDLResearch\Bridge\
>
> This code: javaClass = obj_new('IDLJavaObject$HELLOWORLD',
> 'HelloWorld.java') returns
>
> "% Class HelloWorld.java not found
> % Execution halted at: IMPORTER 3 D:\IDLResearch\Bridge
> \importer.pro
> % $MAIN$ "
>
> My idljavabrc file contains: D:\IDL\Bridge\ and D:\IDLResearch\Bridge
> -- I've tried it with each.
>
> Any thoughts ??
> Thanks in advance!
> --Justin
The problem you have there is that you have not named your class file correctly.
The classloader does not want your java source file. Further, the classloader
locates classes by package name, and '.' is the separator for packages within
the package hierarchy. What the classloader will be looking for in your example
is a file called 'HelloWorld\java.class'.
If your java class in not part of a package then you should include the
directory in which HelloWorld.class resides in the CLASSPATH and specify the
class 'HelloWorld' in the obj_new.
If your class is part of package then you need to include the base directory of
package hierarchy in the CLASSPATH and specify the fully qualified class name
in obj_new.
--
Nigel Wade
|
|
|
Re: Java Bridge Import [message #60966 is a reply to message #60965] |
Mon, 23 June 2008 07:07  |
humanumbrella
Messages: 52 Registered: June 2008
|
Member |
|
|
Got it!
OK -- on the idljavabrc file, when you include another path - you
can't put a space after the ;
So:
WILL WORK: $CLASSPATH;D:\IDLResearch\Bridge
WON'T WORK: $CLASSPATH; D:\IDLResearch\Bridge
Hope this helps someone :P
Cheers
--Justin
|
|
|