intelliJ 9 cannot find class I specify in web.xml - intellij-idea

I am trying to get logdigger to work in my java app that uses google app engine. I have tried putting my jar files in the src/ directory, lib/ directory, and no matter what I do, it can't find the class. The only thing that it finds is the com.google.appengine stuff. I have tried messing with my dependencies and it's not working. Has anyone done this before and gotten it to work? I am not sure how to modify the classpath through intelliJ (however in the project settings I have the jars linked as a dependency under the modules section).

You probably need to look at the artifacts for your project. IntelliJ separates runtime assembly of WARs into the artifacts section. Look and see that your WAR file is assembled properly. I'm guessing that you don't put the contents of the /lib directory into the WEB-INF/lib of your WAR. The compiled output ought to go into WEB-INF/classes. All other output belongs in the root of the deployment.

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.

Some classes can't be resolved when compiling Apache Drill?

I built the Drill project according to the wiki specification
but, the project has some errors. Some classes (BigIntVector, BitHolder,BigIntHolder) can't be resolved and the workspace don't really contain these class files. Any suggestions as to what's going on?
These clases are generated during build.
exec/java-exec/target/generated-sources/org/apache/drill/exec/expr/holders/BigIntHolder.java
There is a problem in that the Maven import into eclipse results in target/generated-sources/org being added to the Source Folder build path. I have found that in the two cases, comon and java-exec, if you remove these folders from the source folder build path and add them as target/generated-sources this will help.
This is a workaround, there is obviously a misconfigured pom.xml somewhere.

What is a working directory in Intellij IDEA

I created a Maven project and imported it in Intellij IDEA.
In a run configuration, there is a field "working directory", which points to the root of Maven project.
If I change this folder, it doesn't seem to affect anything. So what is it?
This is the directory that is set as the Java user.dir system property. If you have any code that creates relative files or directories, it will be relative to this directory. So for a well designed application (i.e. resolves resources from the classpath and is configurable for output directories) this will not be a factor. There is also some importance to this value in maven projects, especially multi-module maven projects. This directory specifies the directory IDEA will read the POM from.
If you are unflamilar with what the Java user.dir is, there is some discussion available here and in the class level Javadoc for the File class.
In addition to answer given by #Javaru if you want to update or view your working directory in IntelliJ IDEA go to:
Run | Edit Configurations | Configuration Tab | Working Directory
From the IntellJ help Run/Debug Configuration: Maven
Working directory Specify the path to the Maven project file pom.xml.

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 .

Netbeans does not see custom *.tagx in my Maven war dependency

I have this scenarion in my project:
Maven2 for dependency management
One project 'common-web' (war) contains all images, css files, js files, layout files etc. It also contains custom tags (*.tagx files) that we use in our project. They are located in WEB-INF\tags direcotry.
Second project (also war) has dependency on common-web, we use those custom tags in our *.jsp files by importing them in this way:
<%# taglib prefix="custom" tagdir="/WEB-INF/tags" %>
This works great in runtime, but is a big problem during development, because NetBeans does not see those custom tags and does not give me Intellisence.
In Eclipse I managed to work around this issue by linking tags directory in this second project. Can I do something similar in NetBeans? Or is there any better way to work around this issue?
I'm no NetBeans export so apologies if this makes no sense, but I understand from this article that it will discover taglibs in referenced jars.
Would it be possible to move the shared tags into a jar and reference it in both wars instead of trying to have one war reference another? If the taglibs jar project is deployed to the Maven repository it would be managed by Maven and available to both projects.