Where are the JarFiles and how can I add them into Selnium? - selenium

Downloaded latest extentreport jarfiles zip folder and extracted them. I see only two folder as displayed in the imageClick here and sub-folders contain lots of class file
I want to add the latest jarfiles to my project. Although, I could make use of Maven Project but wanted to do it manually by adding those downloaded jarfiles. Unfortunately, I could not find any jar files. There are java class files, properties file,pom file etc..but no jar files. Am I missing something or there is some way extract jars or add the META-INF folder to the project
While running the project i'm getting this error below. As I understood, its a runtime error since the class files are not available but its available during compiling
java.lang.NoClassDefFoundError: freemarker/template/TemplateModelException
Please suggest

Related

How to use a JAR file in IntelliJ after downloading?

I want to use the import javax.ide in IntelliJ, specifically exploring MetaClass and seeing what it can do. I've downloaded the JAR (198) from https://download.oracle.com/otndocs/jcp/standard_extension_ide-1.0-fr-oth-JSpec/, and I know I'm supposed to somehow add it to dependencies under Project Settings -> Modules -> Dependencies, but I'm not sure what exactly I'm supposed to add from the downloaded folder. The folder containing javax/ide itself is somewhat buried, but I tried adding different levels of directories and none of them worked. The actual folder doesn't even contain java files, it contains a bunch of htmls so I might just be downloading the wrong thing. Thanks for the consideration
I've downloaded the JAR (198) from
It is not a JAR. This is a .zip archive and it does not contain compiled classes in a form of a JAR. It has only source files.
If you are working with a JAR - you need to add such a jar file which contains the needed for your classes into the module's dependencies.
If you do not have the JAR but only have sources - you can create a separate module from these sources and then use it as a module dependency to the module where you want to use these classes.

Gradle adds external libraries from wrong directory

I am using the fileTree Gradle task to import some external libraries
compile fileTree(dir: 'C:\\Intellij\\cast\\grails-app\\libs', include: '*.jar')
The issue is that when I build my Gradle project it actually pulls JAR files from a different directory C:\\Intellij\\cis\\grails-app\\libs
If I put that same exact fileTree task in any other project it will properly pull JAR files from the CAST directory but in the actual CASTproject it pulls from CIS. I have done a complete text search of the entire CASTproject and there are no references to the CISproject so I have no idea why its doing this. If I modify the contents of the CISlib folder then those changes are reflected when I refresh my CASTproject.
What do I need to do to make sure that when I specify that I want to pull libraries from the CAST directory that it actually does instead of pulling from somewhere else?

Adding Jar files to IntellijIdea classpath

I have created a new Intellij project. But I can't use the third party jars in my project. I have the jars in a directory structure as follows:
repository/commons-logging/commons-logging-1.0.4.jar
repository/commons-lang/commons-lang-2.1.jar
etc.
I want to add them just by pointing to the repository directory, but couldn't find any ways to add them.
But when I am using classes or API from that jars, the editor can't resolve the classes.
I have tried from Project Structure but can't configure it.
Go to File-> Project Structure-> Libraries and click green "+" to add the directory folder that has the JARs to CLASSPATH. Everything in that folder will be added to CLASSPATH.
Update:
It's 2018. It's a better idea to use a dependency manager like Maven and externalize your dependencies. Don't add JAR files to your project in a /lib folder anymore.
If, as I just encountered, you happen to have a jar file listed in the Project Structures->Libraries that is not in your classpath, the correct answer can be found by following the link given by #CrazyCoder above: Look here http://www.jetbrains.com/idea/webhelp/configuring-module-dependencies-and-libraries.html
This says that to add the jar file as a module dependency within the Project Structure dialog:
Open Project Structure
Select Modules, then click on the module for which you want the dependency
Choose the Dependencies tab
Click the '+' at the bottom of the page and choose the appropriate way to connect to the library file. If the jar file is already listed in Libraries, then select 'Library'.
On the Mac version I was getting the error when trying to run JSON-Clojure.json.clj, which is the script to export a database table to JSON. To get it to work I had to download the latest Clojure JAR from http://clojure.org/ and then right-click on PHPStorm app in the Finder and "Show Package Contents". Then go to Contents in there. Then open the lib folder, and see a bunch of .jar files. Copy the clojure-1.8.0.jar file from the unzipped archive I downloaded from clojure.org into the aforementioned lib folder inside the PHPStorm.app/Contents/lib. Restart the app. Now it freaking works.
EDIT: You also have to put the JSR-223 script engine into PHPStorm.app/Contents/lib. It can be built from https://github.com/ato/clojure-jsr223 or downloaded from https://www.dropbox.com/s/jg7s0c41t5ceu7o/clojure-jsr223-1.5.1.jar?dl=0 .

How to generate a jar from a java module in IntelliJ with the dependencies placed in a separate directory?

I have a module for which I want a jar to be created. So, here is what I do:
Adding a jar artifact, using the "From module with dependencies ..." option
In "Jar files from libraries" I select "copy to the output directory and link via manifest"
Leave all the defaults.
After that I can build the jar and all the dependencies would be placed near it in the same directory. So far so good.
Now I wish all the dependencies to be placed in a separate directory near the final jar. So, I repeat the same steps, but this time I create a new directory under the node in the artifact Output Layout tab (using the "Create Directory" button). Next I drag all the dependencies onto the new folder and apply the changes.
On the surface, everything is cool - the dependencies are indeed placed in the dedicated directory, but the MANIFEST.MF file is never updated! It should reference the dependencies via the new directory. As of now, the produced jar cannot be run - its dependencies are not visible.
This is unlike Eclipse, which does make sure the manifest file is correct when exporting a project as jar.
How can I workaround this problem, given that:
I want all the dependencies in a dedicated folder.
I want to use IntelliJ IDEA
I do not want to edit the manifest file manually.
I am using the latest download of the IntelliJ IDEA for windows - 11.1.2, build 117.418
Thanks.
At the moment you have to update the classpath manually in the artifact configuration dialog so that it includes the subdirectory:
I've created an issue for this limitation, please star/vote.

"Duplicate class found" - IntelliJ and .class files

I recently imported one of our company's project into IntelliJ Idea (10.5.1). We build and run the project using an ant build script and IntelliJ supports that just fine.
However, IntelliJ seems to have a distinct problem when the compile output directory equals the source code directory, ie .class files are placed in the same directories as their corresponding .java sources.
(Note that I am aware that is not a proper way to go, but tell my boss that. This project is over 15 years old and correspondingly large, too many things depend on it to be this way, there is nothing I can do about that.)
So once things are compiled, IntelliJ detects the .class files and adds them to the project tree. The problem here is that it considers them class declarations, thus I get a "duplicate class found" message for each and every class. This doesn't make me unable to work, but it is extremely annoying as you may guess.
I tried making the IDE ignore .class files, but apparently that makes it not load any classes at all, including the JRE runtime and anything else located inside of .jar files.
Is there any way to make IntelliJ Idea ignore .class files which are in the same location as their .java sources?
Make sure that you've configured the output directory to the source directory, disable the Exclude of the output directory to see your files.
I coped with this same problem when cloning a project from Bitbucket. To solve it in IntelliJ:
Project Structure > Modules > Source > Source folder > <<"Eliminate the unwanted source folder">>
In my case, I had non-implemented classes in one source folder and a second source folder with the implemented classes (same class names).
I deleted one, built again, and the problem got solved.
Give it a try!