Jar file import problem in java service

Hi,

I am trying to import jar file into my java service through the shared tab. I have kept the jar files in \IS\packgename\code\jars.
When the service is complied it is throwing an error

“.” expected
import myjar.jar;
^

Please let me know how can i get remove this…

Thanks in advance. …

Sunny

Sunny,

You cannot import jar files in the shared tab. Instead, import the class(es) that is/are contained in the jar file that you want to reuse in your java service. Say your ‘myjar.jar’ contains a class ‘myclass.class’ the provides functionality you require in your Java service, you enter ‘myclass’ in the shared tab.

Regards,

Koen

And you should only specify the package or class, without “import” and semi colon.

If it still doesn’t found de .jar, you may place it at IS\lib\jars

Sunny,

One quick way to see what classes a jar file contains is to open it in with a tool like WinZip. The filenames shown are the classes. You will need to prepend the package name which you can get by replacing the slashes in the folder names with periods.

For example, jms.jar contains the Java Messaging Service (JMS) classes. If you open this file in WinZip, you will see a file called “ConnectionFactory.class” in a folder named “javax/jms”. The resulting class to import would be “javax.jms.ConnectionFactory”.

You can do something similar from the command line using the command

HTH,

Mark