Can't import jar file

Hello,
I am a newbie in Java world, therefore I don’t really understand the strange package system and also jars.
I’ve created many jars to include in Katalon Studio Drivers folder, but none seems to be working.
But what is wrong with my jars?
Here are 2 jars: Drivers.zip (24.3 KB)
The kazurayam-ks-plainreport-0.6.0.jar created by @kazurayam works just fine, but mine, AhojClass.jar not working at all, and Katalon Studio don’t see neither package nor class inside it. Does anybody can hint me please that thing that I am missing?

Thanks so much :slight_smile:

Thank you for sharing the Drivers.zip file. This tells us many things. The zip file contains 2 files

  • AhojClass.jar, which was created by you @peter.hevesi
  • kazurayam-ks-plainreport-0.6.0.jar, which I @kazurayam created

I opened these 2 *.jar files in my Emacs editor. I could see the contents like this:

You can easily see that the file trees in these 2 files look very different.

I mean, the AhojClass.jar is named as “*.jar” but is not a valid JAR file at all. There is a specification for a valid JAR file must follow.

In fact, people do not really need to study this specification, but people must use appropriate tools that are designed to produce a spec-compliant jar file. These tools include:

  • the jar command bundled in the JDK
  • the jar task of Gradle build tool, Maven, Ant
  • various flavours of create jar features in IDEs (Eclipse, IntelliJ IDEA, VS Code, etc)

@peter.hevesi

How did you created the AhojClass.jar file?

I guess, you opened your directory in Windows Explorer and right-click it, “zipped” it, named it to be “AhojClass.jar” — that is not the way you should take.

1 Like

I see.

Then you should stop playing on Katalon Studio now. Katalon Studio is a UI-testing tool but is not a tool for programming in general. It provides no support for you to create a valid jar file.

You should start studying Java/Groovy programming by reading some good books like Core Java Volume I and web articles.


By the way, you named your class to be Ahoj.AhojClass. This name looks very odd to me. It tells me that you are really new to Java world, hence don’t know the Java Naming Convention at all. According to the standard convention, a package name should be all in lower cases. So ahoj.AhojClass would be better. Also I find a class file named App.class without package. Why you make it sit outside the ahoj package? This makes me guess, you need to study the very basics of Java programming by reading books first. Without enough understandings about the basics, you will spend your time unproductively.

I used Gradle to produce the kazurayam-ks-plainreport-0.6.0.jar file.

The following source of build.gradle would tell you everything you need learn to generate a valid jar.

When I create the jar, I do the following operation in the commandline:

$ cd $projectDir
$ gradle clean build

You should study the build.gradle in detail, and make your own build.gradle to create a valid AhojClass.jar. I suppose that It would take you some weeks to study.

1 Like

Thank you for your help kazurayam :slight_smile:

Not at all, I am kinda newbie to Java, but I am experienced programmer in .NET world :smiley:
And I would never do something as dummy as just zipping it and renaming to .jar, don’t worry :smiley:
Neither I used Katalon Studio for creating jars, but I tried IntelliJ IDEA and also VS Code and actually a also tried jar command bundled in JDK :smiley: Nothing worked so I’ll try Gradle or I must discover what I am missing in producing valid jars :slight_smile:
And I know about lowercase convention, I am just so used to .NET where it is UpperCase so I forgot about it when creating that package. But I have absolutely no doubt, that namespaces works better in .NET than packages in Java.

And I would much rather use Playwright than this Katalon Studio, but my boss want this tool, because even our not-programming colleagues should be able to do testing. But I have no doubt Playwright works much better in it’s internals, and it is very promising, but it lacks any proper GUI Tool like this Katalon Studio. Only 1 tool ony guy recommended me, that can work with Playwright is codeceptjs, but it’s UI tool looks very basic actually.

Not I am trying to improve some things that are not working good in Katalon Studio like dummy variable binding when everything is just a string. I already solved it here:

Now I will try to create reporting system based on yours and few tweaks like these, that’s why I am playing with it. Also those jar uploading I need for something :smiley:

And thanks again, I’ll check all those links you shared :slight_smile:

It’s working now, I created jar in Visual Studio Code using maven, and than I created jar file from there and it’s working without any problems. Thanks again :slight_smile: