Problem with import clause

Hi,

I have a Java Service and I’m try to import a java.util.regex.*, but I always get the following error message:

Package java.util.regex not found in import.
import java.util.regex.*;

Please, could anybody help me solve that problem?

Thank you
Gustavo Almeida

Gustavo, there is no need to post your question on more than one thread.

Either the package doesn’t exist, or you added some extraneous character to the end of your import statement that doesn’t need to be there.

Chris Coyle, sorry about post twice. If the package doesn’t exist what I have to do fix that, I mean, where I’ve to put that package?

On the end of my import statement I just put java.util.regex.* without semicolon.

I am not familiar with java.util.regex, but anything java.util is part of your Java environment. Are you trying to access a package that doesn’t exist? For example, let’s assume java.util.regex came out in Java 1.4. If you are trying to reference this package in a 1.3 environment, it isn’t going to work.

Is it absolutely necessary to use a Java service to accomplish your task? IS can do a lot with regex.

Yes I know, but what I’m trying to do doesn’t work fine with the java service PSUtilities.regex:find that comes with IS.

I checked yesterday and confirmed that I’m using the 1.4 environment, so I don’t know why the IS is complaint about the package!

Do you never saw something like that, with another package perhaps?

And sorry about my English, I’m form Brazil

I haven’t run into this problem. Usually it’s something simple like a spelling mistake.

Sounds like you might be resorting to a Java service solution a bit prematurely.

Have you read Appendix B in webMethods Developer User’s Guide?

Yes, you maybe right, I’ll take a look again in Appendix B e see what I get.

Chris thank you very much, I really appreciate your help.

Sorry if this is redundant but are you sure that the server is running Java 1.4? The compile is done on the server, not on the machine running Developer.

That’s ok Rob Eamon, I’ll take another look at this, but the java service PSUtilities.regex:find that come with WM runs without any problem and it uses the import statement java.util.regex.*

So the server must be using JVM 1.4 or higher.

Perhaps posting a screen shot of the Shared tab of your service might reveal something.

The screen shot, take a look.

Sorry. The screen shot, take a look.

One more time, there is another process blocking the image.

Can you post a shot of your About page in IS Administrator?

How can we use a third party jar/library in a java service?

You can drop the jar in:

  1. ${IS_HOME}/lib/jars

or

  1. ${IS_HOME}/packages/${PACKAGE_ROOT}/code/jars

Although #2 allows you to deploy jars with a package, I find it easier to keep track of where things are by using #1.

Note that these locations do not work for APIs that are part of an “endorsed” standard such as XML parsing (org.xml.sax for example). You will need to put these jars in your ${JAVA_HOME}/lib/endorsed directory. See the following for more info on this special case:

[url=“JDK 19 Documentation - Home”]JDK 19 Documentation - Home