how to add jars?

Hi All…

I would like to import 2 jar files “comm.jar” and “smslib-2.1.3.jar” to my java service… but these files are not in the classpath it seems… i was getting error -" package javax.comm does not exist import javax.comm.CommPort;"
^

please let me know the path where these jars are to be placed…

looking forward for your valuable comments …

Thank you,
Naidu

Hi,

If you want the jar file to be specific for a single package then place the Jar file in following location. change the package name to your specific package.

/IntegrationServer/packages/Package_name/code/jars/static/

After placing the jars you need to restart the Integration Server.

cheers…

Thankyou for you response… But i would like to make the jars files global i.e i they can be imported a java service from any package.

I tried of keeping the jars in the

E:\webMethods711a\jvm\win150\jre\lib\ext
and also in the path
E:\webMethods711a\IntegrationServer\lib\jars

but i was stuck with the same error - " class file does not exist "
i even added the above paths to the classpath in the environment variables.

looking forward for your replies

Thank you,

Packages that use jars/classes in another package should have a dependency on that package. Try doing this.

Cheers
Guna
http://nibodo.com

I’ve been unable to get this to work.

How I think it’s supposed to work:

In package A, jar J is in packages/A/code/jars
Package B has dependency on package A
Java code in package B can use classes from J.

… but whenever I try this, B throws InvocationTargetException.

I also tried putting the jar in packages/A/code/jars/static - with no luck.

I gave up and put all the jars in $IS_DIR/lib/jars - which has the highly undesirable consequence that we have to restart IS whenever the jar is updated.

Jars stored within a package directory cannot be used directly by other packages.

The dependency feature of IS controls the order of package loading only and nothing else.

You could place a jar file within a specific package and then create services to access the functionality from other packages. For example, if there is a foo method in the jar, write a foo service that uses that method within the package (package A). Then services in another package (package B) can call that foo service. In this case, configure package B to be dependent on package A so that A is loaded before B and whenever A is reloaded, B will be reloaded.

HTH.

According to the Developer User’s Guide:

… and in more detail from the Developer 6.5 README (!)

However, I have never persuaded it to work in this way. So maybe Reamon’s statement is more accurate than the WM documentation :proud:

Thanks for the reference. I’ve never been able to make the cross-package JAR file work either. But I’m going to investigate further based on that read me entry. I’ve been wrong before and perhaps I’m wrong on this issue!

Success.

IS 6.5 SP2
JVM 1.4.2_12

Created PackageA with a JAR file in …/packages/PackageA/code/jars
Created PackageB, configured a package dependency on PackageA, version 1.*

Added PackageB:checkVisibility Java service which referenced a class in the JAR in PackageA–I simply created a new object of a class in the JAR.

The Java service compiled successfully right away.

When I ran it the first time, it failed with the target invocation error.

After reloading PackageA and PackageB, the service ran successfully.

Thanks for helping me correct my misunderstanding!

[Edit] And if I remove the dependency from PackageB and reload PackageB, the service fails.

You can check for the dependency parameters, mainly the version parameter. Try with . and if it doesn’t work then better to go for a SR with wm.

Cheers
Guna
http://www.nibodo.com