Thread: [tcljava-dev] Please help in loading a class...
Brought to you by:
mdejong
|
From: Georgios P. <pet...@ya...> - 2007-03-13 07:20:19
|
Hi all,
I am using tclblend 1.4.0 to load JVM from Tcl. However, when I try to
load a specific class I got an error:
java::call {enrichment.EnrichmentManager$Test3} main
Class "enrichment.EnrichmentManager.Test3" is not accessible
The same happens with java::new:
java::new {enrichment.EnrichmentManager$Test3}
Class "enrichment.EnrichmentManager.Test3" is not accessible
I also tried:
set dir $creole_BOEMIE_CoordinationDemo_home/Enrichment/enrichment
set fd [open "$dir/EnrichmentManager\$Test3.class" r]
fconfigure $fd -translation binary
set data [read $fd]
close $fd
set class [java::defineclass $data]
set object [$class newInstance]
java.lang.IllegalAccessException: Class tcl.lang.reflect.PkgInvoker can
not access a member of class enrichment.EnrichmentManager$Test3 with
modifiers ""
The class I try to load looks like:
static class EnrichmentManager$Test3
{
public static void main(String args[]) {
...
}
EnrichmentManager$Test3() {
}
}
Is this due to the constructor that is not public?
Any help will be welcomed, as my Java knowledge is limited :-)
Regards,
George
|
|
From: Patrick F. <pfi...@oz...> - 2007-03-13 22:12:12
|
On Tuesday 13 March 2007 07:19, Georgios Petasis wrote:
> Hi all,
>
> I am using tclblend 1.4.0 to load JVM from Tcl. However, when I try to
> load a specific class I got an error:
>
> java::call {enrichment.EnrichmentManager$Test3} main
> Class "enrichment.EnrichmentManager.Test3" is not accessible
>
Have you built the classpath inside the script?
# build tcl classpath
append x $drive/IBM/WebSphereMQ/Java/lib/com.ibm.mq.jar\;
append x $drive/IBM/WebSphereMQ/Tools/Java/base\;
append x $drive/IBM/WebSphereMQ/Java/lib/com.ibm.mqjms.jar\;
append x $drive/IBM/WebSphereMQ/Tools/Java/jms\;
append x $drive/IBM/WebSphereMQ/Java/lib/com.ibm.mqbind.jar\;
set env(TCL_CLASSPATH) $x
puts "\nTCL_CLASSPATH = [ array get env TCL_CLASSPATH ]\n"
Have you imported the required classes?
# import required classes
java::import com.ibm.mq.jms.MQQueueConnectionFactory
java::import com.ibm.mq.jms.services.ConfigEnvironment
java::import com.ibm.mq.jms.JMSC
java::import com.ibm.mq.jms.MQQueueSession
java::import com.ibm.mq.jms.MQQueueSender
# instanciate MQQueueConnectionFactoryI object.
set MQQueueConnectionFactoryI [ java::new MQQueueConnectionFactory ]
Patrick.
|
|
From: Georgios P. <pet...@ya...> - 2007-03-14 07:24:45
|
I am using the Sun JDK. I think that it is more an "access" problem
(i.e. restriction due to private members), than
the fact that the class it is not found due to the classpath. In my
classpath, I have put all used JAR files that are specific
to the application, but no path that relates to the JVM. I am using the
same path as when I run the app from the command
line. From the command line it runs. From tclblend I cannot start it :-(
The intresting think is that I can run classes from the application that
get called from the class that starts the app, but not the
class itself. Also, can anyone propose any sun JVM jar files I need to
put in the classpath to run graphical applications?
(Tclblend 1.3.x didn't need such paths from the JVM, does version 1.4.0
needs such paths?)
Regards,
George
O/H Patrick Finnegan ??????:
> On Tuesday 13 March 2007 07:19, Georgios Petasis wrote:
>
>> Hi all,
>>
>> I am using tclblend 1.4.0 to load JVM from Tcl. However, when I try to
>> load a specific class I got an error:
>>
>> java::call {enrichment.EnrichmentManager$Test3} main
>> Class "enrichment.EnrichmentManager.Test3" is not accessible
>>
>>
>
> Have you built the classpath inside the script?
>
> # build tcl classpath
>
> append x $drive/IBM/WebSphereMQ/Java/lib/com.ibm.mq.jar\;
> append x $drive/IBM/WebSphereMQ/Tools/Java/base\;
> append x $drive/IBM/WebSphereMQ/Java/lib/com.ibm.mqjms.jar\;
> append x $drive/IBM/WebSphereMQ/Tools/Java/jms\;
> append x $drive/IBM/WebSphereMQ/Java/lib/com.ibm.mqbind.jar\;
>
> set env(TCL_CLASSPATH) $x
>
> puts "\nTCL_CLASSPATH = [ array get env TCL_CLASSPATH ]\n"
>
> Have you imported the required classes?
>
> # import required classes
> java::import com.ibm.mq.jms.MQQueueConnectionFactory
> java::import com.ibm.mq.jms.services.ConfigEnvironment
> java::import com.ibm.mq.jms.JMSC
> java::import com.ibm.mq.jms.MQQueueSession
> java::import com.ibm.mq.jms.MQQueueSender
>
> # instanciate MQQueueConnectionFactoryI object.
> set MQQueueConnectionFactoryI [ java::new MQQueueConnectionFactory ]
>
> Patrick.
>
>
|
|
From: Mo D. <mo...@mo...> - 2007-03-14 23:54:00
|
Georgios Petasis wrote: > I am using the Sun JDK. I think that it is more an "access" problem > (i.e. restriction due to private members), than > the fact that the class it is not found due to the classpath. Yes, this message indicates that the access permissions on the class don't allow it to be used. The class or method needs to be public. Mo |