I try to create project as it is said in tutorial - play new myproject -> Java project
Then I open it with IntelliJ and the target/scala-2.10/src_managed/main/controllers/routes file is all in errors. It cannot resolve nor package nor RverseAssets.
I didn't mind it until I needed to add some dependencies to my project. My Build.scala file could not be compiled. By the way, I had to create this file manually, it wasn't created for me.
I have Play 2.0 Support and Playframework support plugins installed.
EDIT Forgot to mention. I run command idea from the project root folder once it was generated
play idea marks wrong folders as Sources Roots. Unfold target/scala-2.10/src_managed/main in Project View. As you can see, controllers and views are marked as a Sources Root. Right-click on each and choose Mark Directory As/Unmark As Sources Root. Then right-click on main folder and choose Mark Directory As/Generated Sources Root.
Here is all well described how to create a new project and open it in IDEA
a documentation
You must use a console play:
idea with-sources=yes
Later the project already open in IDEA
Related
I'll start this off by saying that I'm not a Java dev, I work in a .NET software house, but somehow we have ended up needing to modify some legacy java code.
So I have a project which I've opened up with IntelliJ IDEA Ultimate 2016.2. As far as I can tell this doesn't use Maven or Gradle or any other dependency management tool, and as I have no idea what I'm doing with Java projects I'm not going to start trying to understand that now.
I'm trying to add the Amazon AWS SDK to my project so I can upload some files to an S3 bucket. I've downloaded the SDK from the AWS site, and extracted the jar files into the lib folder of my project root. I've tried numerous ways of adding these as dependencies, right click the jar files and add as library, go into settings, modules, dependencies, click the plus and add the jars etc. When I build the project it builds fine, and intellisense if picking up the classes and methods when writing the code to utilise the SDK.
However, as soon as I run the app, I get a "java.lang.NoClassDefFound" for the com/amazonaws/AmazonServiceException package as the containing class is instantiated.
This could well be something to do with the "CLASSPATH" that I hear so much about (but don't fully understand), but my understanding was that IntelliJ handled this when adding the jars as a dependency. I've also tried adding all the jars from the "third-party" directory from the downloaded AWS zip file, and adding those as dependencies as well, but it still doesn't want to work.
Incidentally, I'm adding the jars to the lib folder so they are included in source control.
Any suggestions on how to use the AWS SDK without using Maven or Gradle?
Cheers
What I've done is to manually add all the jar files into the External Libraries.
Go to File > Project Structure
In the left window pane, choose Modules under Project Settings
Click on the Dependencies tab
Click on the + sign and select 1 JARs or Directories
Navigate to the folders containing the jar files (include third-party dependecies also) and click OK
See My IntelliJ screenshot
I'm currently doing this tutorial on Hibernate over here http://www.javatpoint.com/example-to-create-hibernate-application-in-eclipse-ide and I downloaded the hibernate.zip and oracle.jar files, tried to add them to the project through right clicking on the project -> build path -> configure build path -> add external jars and selecting the jars, but they are not getting imported in a "Referenced library", they just appear as stand alone .jar files that don't to anything and can't be referenced to.
How can I make them "go" into the Referenced Libraries? That folder isn't even created when I import the jar files.
Thanks!
You should use Maven for handling your dependencies and let Eclipse & Maven together take care of downloading and organizing your dependencies. You won't even need to download the jar files manually anymore.
This is the basic usage of Maven with Eclipse:
http://www.tech-recipes.com/rx/39279/create-a-new-maven-project-in-eclipse/
In case you're totally new to Maven, i'm happy to provide further help via comments.
I suppose your Eclipse perspective is selected "Resource", not "Java" or "Java EE".
After you change the perspective to "Java", you will see the Referenced Libraries.
Check this Option : Right click Project >> Show In >> Project Explorer
Just new to IntelliJ Idea. I have maven project which has few generated source java files.
When I import that project Idea complaints about generated source files are missing but I can see those files under target/generated-sources. How can I add those files in the classpath.
You can go to Files > Project Structure and then choose your module and on the sources tab you can navigate to the generated-sources dir and click Mark as > Sources:
Additionally, folder could be assigned to the specific type from the Project panel via mark directory as context menu.
To have maven do it automatically, look here: How to create folder for generated sources in Maven?
If you are using Springboot Application.
just follow the step in IntelliJ.
Right-click on project folder.
Select maven.
Generate source and update the project folder
I have seen several of this question asked here, but none have fully been answered to my necessity. I have a file I want to create a jar file with so I can simply place it on my desktop and run it. I think I understand the process up to using Process Structure, then I am lost.
Basically, you can generate an artifact in IntelliJ from the build menu -> build artifact.
Dependending on your project, possible artifacts may be found automatically or not (if you use a "build tool" like maven, ant or gradle).
In case of a build tool, check its documentation to find how to generate a jar file from it.
If you're using a pure IntelliJ project, select your project root and hit F4, it will open its settings. In Artifacts, you'll have to add a new jar (the green + at the top of the window). Select "From modules and dependencies...". Then, you'll have to select the module to use and its main class. It should be enough. Then, you'll just have to build the needed artifact. The jar file will be generated in the folder defined in the configuration (Project settings->Project, Project compiler output in case of a single module, otherwise it will be generated in the module's folder)
When you're looking for a feature in IntelliJ, don't forget to use ctrl+shift+A to search it by its name.
Hope it helps
I am trying to add a JAR to libs for another project and then use resources from the JAR inside of that project but I am getting
java.lang.NoClassDefFoundError: com.xxxxx.dylib.R$drawable.
The JAR contents are:
com.xxxxx.dylib
res
res.layout
res.menu
res.values
When the library project is added as a dependency it works but when the JAR is used there is no R.java generated. I believe this is the problem. Is it possible to use resources from a jar within a project?
Resources cannot be packaged into jar. Pure java class that do not refer to resources can be packaged into jars.
You need to make the project that you need to refer to as a library project and then refer the same in your android project.
http://developer.android.com/tools/projects/index.html
If you want to use command line
http://developer.android.com/tools/projects/projects-cmdline.html
If your using eclipse follow the below link.
http://developer.android.com/tools/projects/projects-eclipse.html
You can right click on the project that you want to refer, goto properties. Choose Android and check Is Library.
Now to refer the library project in your android project.
Right click on your android project, goto properties, choose android, click add browse the library project and the same.
JAR files package only the Java code you have, and not the resources.
If you want to use the resources in your project, you will have to take the entire library project, mark it as a library and then add it to your main project as a whole.