I am New to java and
Just installed JDK and IntelliJ IDEA
I created a project in IntelliJ IDEA
The below picture shows The project structure
However When I edit the file It shows: This file does not belong to the project
And the Main.java file formed is not showing in the project.
The complete structure is as follows
I dont know If this makes any sense But, In the tutorials I have watched, unlike in my case the src folder is present under the project itself.
I would Highly appreciate If someone could help
Related
Edit: The solution to the problem was to uninstall and re-download and install intelliJ.
I am unable to create a class following online tutorials. One method is to expand the project folder and right click src and from there you can create a class, but I am unable to expand the project folder in intellij and therefore am unable to access the src file to create a class. The tutorial video shows an arrow next to the project that you can click to expand the project, but I don't have this arrow. Please help I am new.intellijScreenshot
This is the tutorial I used: https://www.jetbrains.com/help/idea/creating-and-running-your-first-java-application.html
I created the SRC folder like someone suggested and now the project expands, but there still is no option to create a class.
This has to be an issue in the way the project was setup. When you create a new project, IJ creates three things in your project, a src folder, a .idea folder, and a .iml file. Without the .idea folder and .iml file it wouldn't let me create a new class either. Delete your HelloWorld project, and try again. If still no luck, maybe try uninstalling/ reinstalling. Could possibly be an issue with the JDK, I don't mess with that, I just use 11 version 11.0.6.... Hope this helps!
I'm currently working on a groupproject. We're using github to save our code. I have just installed eclipse to work on. I foound to open the project to use import. This has opened the project, except the SRC folder is empty whereas the first SRC folder (the main which was made through github) has several .java files within.
Why is this and how do I go about putting them in. I am unable to work on the code through eclipse at the moment due to this. Thank you, much appreciated.
The easiest way would be to:
clone manually the GitHub repo (in command line)
import the Eclipse project in your Eclipse workpace
Then push to the GitHub repo
Or you can clone the GitHub project through Egit directly,, following this tutorial.
The OP pokeairguy reports in the comments an alternative solution:
create a new project in eclipse like normal.
Then drag the contents of the src folder from GitHub into the folder directory within eclipse.
Then selecting link in the pop up window.
I think it works by thinking its a new project but saves everyone done under the GitHub folder, for GitHub to work.
I am working on a large open source project that is under svn and Maven. As I try to get my head around the various classes and methods contained in the project I realised that I can't search for class names with the usual eclipse search feature (e.g. Ctrl + Shift + T). I can't even modify a class without getting this error:
"This compilation unit is not on the build path of a java project"
.. I kind of guess what that means but I don't really understand why it says that. I mean I just checked out the project from svn and imported it in eclipse like I do usually.
I have also pasted a screenshot to give an idea of where I am in the project when I am attempting these simple tasks.
Can anyone please tell me what is wrong in this project and give me some direction on how to sort this issue?
It seems likely possible that the Subversion files did not include a Java build path for Eclipse and that you have not created one. That will be stored in the .classpath file after you go to Project > Properties and specify the locations of your source folders (possibly among other things, such as libraries).
I have a project whose source code is hosted in svn and I have checked out the source code already say in a folder "myfolder". The directory structure of my code is as follows:
myfolder/trunk/src/ is where my code resides. Now I create a Java project using eclipse using File -> new java project with the location to be myfolder/trunk/src/. When I do this, all the package structure gets changes and I have errors in my sources files.
It would be great if somebody can tell me what is the correct way to do this. I have found some articles on the internet, but the more I read the more I get confused.
Thanks
Vandana
You should have probably chosen to Import Existing Project into your workspace and you should try that instead. It works great as long as you have your .project file defined. To fix the errors you have now, Create a new src folder in your project and point it at trunk\src, so that it correctly recognizes all your Java files.
You probably should use myfolder\trunk as the root of your project, rather than myfolder\trunk\src. As Perception has mentioned, try to "Import Existing Project" first (rather than start a new project and point it at your source).
First, I assume you already have subversive/subclipse plugin installed in your Eclipse and you have used the right URL to import your source code.
Before checkout your source code, you may change your perspective to Java perspective.
Then you only need to use File-Import-SVN(choose SVN as your import source)-Checkout projects from SVN-Next-Give your project a Name-Finish.
If you have problem about installing SVN plugin, reference is http://subclipse.tigris.org/
http://www.eclipse.org/epsilon/doc/articles/epsilon-source-svn/
I have just started playing with Java, and I really like the language. I am using the NetBeans IDE, and I find one odd oversight. I can create a new class in a project, but NetBeans doesn't appear to support any way to import an existing class into a project.
I manage to get it done by going to some other project where the desired class already occurs, and then I copy/paste it into the source code folder of the new project, then change the package name at the top of the pasted file to match the package name of the new project.
Is there a nice direct way to do this from the NetBeans interface?
Thanks for any help on this.
In the Projects window you can expand the project that you are working on. Right Click on Libraries and select Add Project.... You will get a dialog allowing you to select another Netbeans Project with the Java classes that you wish to use.
You have to just make the .jar file of that/those java files which you want to use in another project.
right click on file->export->java->.jar then finish.
Now you can use these jar into your another project.
When you build the java project in netbeans it creates a jar file on the dist folder in the current project directory.
You can use this jar file for the other project as a package by adding this as ADD jar in the next project.I have tried this ,i am using my old project jar file for new project development.
Use the 'Clean and build' your project option from the netbeans application, that creates the 'dist' folder which you are looking for (and obviously can't find because you havn't cleaned&buld)
The netbeans itself creates .jar files and you can add the jar file to the current project you are working on.