Unable to resolve class

When I import this statement to use libraries to perform action on compressed file, I am getting error while running. The error is “unable to resolve class java.util.zip”. Also refer attached screenshot for the error.

Can anyone have idea how to resolve this error ?
Thanks in advance

i think the ‘star’ aka .* import is not supported in groovy script. you have to import the specific class needed in your code


@Russ_Thomas is your screenshot from a testcase or a keyword? as far as i remember i never managed to do a star import in a testcase

It’s a testcase.

ah … ok. so … it means my brain is older than i thought. sorry
@bhavarth33 in this case, make sure the lib you need is availablein the classpath, aka in katalon himself or added as an external lib in the project, and you provide the package name

I was able to resolve this error by importing the specific class name that I want to use.
Here I want to use ZipFile class name so import statement would be ‘import java.util.zip.ZipFile’

Which seems to back up what @Ibus is saying - but I definitely don’t have issues with it.

Could importing statically make a difference? (@Brandon_Hein)

@Russ_Thomas mhm … you may have a point,i think the static did the trick for you.
i never tried in testcases, only import by specific class name.
hidden may be the path of groovy … i have to read again the docs

le: may be related to the scope of the script, i really forgot what the static means

Right. I’m guessing it will be tied into the “effective package” that a groovy Script Class is bound to. (A TC is a Script Class).

Static importing just allows you to reference imported resources as if they were a static class existing within your class. (i.e. it’s simply a quality-of-life feature, and probably doesn’t play a role here).

1 Like