# Can't import jar file

**URL:** <https://forum.katalon.com/t/cant-import-jar-file/57225>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [August 5, 2021, 3:01pm UTC](https://forum.katalon.com/t/cant-import-jar-file/57225 "2021-08-05T15:01:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter.hevesi](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/peter.hevesi/32/17756_2.png) [@peter.hevesi](https://forum.katalon.com/u/peter.hevesi)\
**Post date:** [August 5, 2021, 3:01pm UTC](https://forum.katalon.com/t/cant-import-jar-file/57225/1 "2021-08-05T15:01:31Z")

</div>

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](https://forum.katalon.com/uploads/short-url/f1S56jYi429rmPkddisGzb5hx18.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 🙂

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [August 5, 2021, 11:04pm UTC](https://forum.katalon.com/t/cant-import-jar-file/57225/2 "2021-08-05T23:04:41Z")

</div>

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:

 ![スクリーンショット 2021-08-06 7.50.59](https://europe1.discourse-cdn.com/katalon/original/3X/e/e/ee96b16658f8d70e5ec15e6689a102a3c6198c06.jpeg)

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.

- [JAR File Specification, Oracle](https://docs.oracle.com/en/java/javase/11/docs/specs/jar/jar.html)

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](https://docs.oracle.com/en/java/javase/16/docs/specs/man/jar.html) bundled in the JDK
- the [`jar` task](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html) 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.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [August 5, 2021, 11:07pm UTC](https://forum.katalon.com/t/cant-import-jar-file/57225/3 "2021-08-05T23:07:40Z")

</div>

> [@peter.hevesi](#):
>
> I am a newbie in Java world, therefore I don’t really understand the strange package system and also jars.

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](https://www.amazon.com/Core-Java-I-Fundamentals-Cay-Horstmann-ebook-dp-B07G8DHTSZ/dp/B07G8DHTSZ/ref=mt_other?_encoding=UTF8&me=&qid=) 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](https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html) 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.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [August 5, 2021, 11:12pm UTC](https://forum.katalon.com/t/cant-import-jar-file/57225/4 "2021-08-05T23:12:49Z")

</div>

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

- [Getting Started with Gradle](https://docs.gradle.org/current/userguide/getting_started.html)

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

- [https://github.com/kazurayam/kazurayam-ks-plainreport/blob/master/build.gradle](https://github.com/kazurayam/kazurayam-ks-plainreport/blob/master/build.gradle)

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

```auto
$ 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.

---

<div class="post-metadata">

**Author:** ![peter.hevesi](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/peter.hevesi/32/17756_2.png) [@peter.hevesi](https://forum.katalon.com/u/peter.hevesi)\
**Post date:** [August 6, 2021, 7:11am UTC](https://forum.katalon.com/t/cant-import-jar-file/57225/5 "2021-08-06T07:11:59Z")

</div>

Thank you for your help [kazurayam](http://forum.katalon.com/u/kazurayam) 🙂

> [@kazurayam](#):
>
> 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.

Not at all, I am kinda newbie to Java, but I am experienced programmer in .NET world 😃  
And I would never do something as dummy as just zipping it and renaming to .jar, don’t worry 😃  
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 😃 Nothing worked so I’ll try Gradle or I must discover what I am missing in producing valid jars 🙂  
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.

> [@kazurayam](#):
>
> 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.

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:

> [@Perfect Data Binding Workaround / Work With Any Data Type Easily](http://forum.katalon.com/t/perfect-data-binding-workaround-work-with-any-data-type-easily/57175):
>
> > **MY INFO**
> >
> > Windows 10 21H1 64-bit Katalon Studio 8.0.5.208
> 
> Hi, I have a serious problem with Katalon Studio, that it binds all Variables to Test Cases as String and totally ignores selected Data Types. This appears to be true whether or not the “Bind to test case as String” checkbox is selected on the data file. I found other guys here on Forum or elsewhere on the Internet that said, that they couldn’t make it work neither, so I am convinced this isn’t actually working for anybody. But it is a seri…

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 😃

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

---

<div class="post-metadata">

**Author:** ![peter.hevesi](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/peter.hevesi/32/17756_2.png) [@peter.hevesi](https://forum.katalon.com/u/peter.hevesi)\
**Post date:** [August 6, 2021, 12:11pm UTC](https://forum.katalon.com/t/cant-import-jar-file/57225/6 "2021-08-06T12:11:23Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [August 6, 2021, 12:12pm UTC](https://forum.katalon.com/t/cant-import-jar-file/57225/7 "2021-08-06T12:12:57Z")

</div>

Closed on August 6, 2021, 12:12pm UTC


