I am a student and we have an assignment where we collaborate on a github shared repository. Me and another student in our group have the same problem: On our computers IntelliJ cannot find the Main class and compile it.
On my other projects, running Mains is not a problem and therefore I can't find any help through the search results I get from Google and Youtube.
Can't even click run since the run configurations are weird too, but I fixed that before and the Main class-problem remained. That problem came back now since I've tried to re-clone the project a few times now... The other 3 students in the group can run Main. I don't know if it has anything to do with it but we don't have a src -folder, is that confusing the compiler or anything?
Would really appreciate some help.
Picture: It doesn't compile.
don't know if it has anything to do with it but we don't have a src -folder, is that confusing the compiler or anything?
It can be for IntelliJ, managing a Java project.
Check if you can define your 'sample' folder as a source root, which would force IntelliJ to consider the sources inside sample as a program to compile.
Related
This has happened many times on many projects and it makes development difficult!
I work with a group of engineers. I often import a project someone else has saved into, say:
c:\git\newproject
The files are there in "c:\git\newproject", so I start code development, doing builds etc.
But my changes are not in "c:\git\newproject"! (?) Instead they are in
c:\Users\<myname>\<workspace name>\newproject
WTF? The builds will be there too. So I look in the project resources. It says:
PROJECT_LOC "c:\Users\<myname>\<workspace>\newproject"
No, that's wrong. I can't push that! Why was it set this way? How can I change it?
As you can tell, I'm getting very frustrated. It's happened to me many times and no one I talk to has any idea why.
You obviously imported the projects via the Existing Projects into Workspace import wizard with the option Copy projects into workspace.
Better use File > Open Projects from File System... which also works for non-Eclipse projects.
first off thanks for any help! I am relatively proficient at programming in languages like python, but that's not going to stop me from asking a dumb, and probably very basic question about JAVA
I am working on some satellite orbit research for graduate school, and I am using the maven compiled java project OREKIT. Information on OREKIT can be found here;https://www.orekit.org/site-orekit-9.2
I believe I have built the project correctly using the steps to import a maven project into eclipse, but I am having issues getting any of the included tutorial programs included to run. The first errors I get are "Error: Could not find or load main class" and then followed by the name of whichever tutorial script I'm attempting to run.
MY attempt at solutions, which have not worked are as follows: First I attempted to create an entirely different java project with a main class and import the scripts I wanted to run, but I think this created more problems than it solved. Secondly, in the OREKIT project folder which was created with the maven building, there is a src folder. I right clicked and set it as the source. It contains a "main" folder with various contents but still the errors persist.
I probably am asking something extremely simple, and googlable but I haven't figured out what to google or what to do to fix my problem. If anyone has some suggestions I would be extremely grateful!
Thanks a ton!
Following is a question that is posted on http://dev.eclipse.org in April 2003. The original question is:
Hi all,
in eclipse i have created several java
projects representing different
modules for one web application. i'd
like to configure one output folder
for all of these projects. Any time i
build a subproject the content of the
output folder is deleted, so i loose
the classes of all other subprojects.
I think there must be a switch or
something like that to tell eclipse
not to clear the content of the output
folder when it builds a project - but
i just can't find it.
Thanks for your help!
Alex
I am trying to see if I could get a definitve answer for this question. I have tried to find out to see if this question has already been addressed and I was not able to find any except for the following answer:
Window-->Preferences-->Java-->Compiler-->Build Path
The above answer did not help me much.
Hmm... I think this approach will bring more trouble than it's worth. Sure it's a priori a quick and dirty fix to integrating your projects together but you are only pushing the problem forward. It is good practice to keep your modules as isolated as possible from each-other, trying to merge the compiled code in a single location is working against the way the IDE was designed and will only bring trouble.
I would recommend that you look into maven to build and package your modules. Then referencing them is just a matter of adding a declaration in the project that requires it and you are integrated. Of course you will need to learn it but it provides a good base of conventions that when followed yield almost effortless integration. Plus reusing some modules in another project becomes trivial so you gain in all fronts.
To answer the other question in the thread when they wish to make a tree of related projects it is possible though somewhat clumsy. Eclipse will always present projects as a flat list, however the folders can be arranged in a tree nonetheless. Just specify a custom location when creating a project or import the project from the sub-folder. Again here Maven can help a lot with it's concept of modules.
As eugener mentioned in his comment, there are plugins for maven that will make most of these tasks trivial. You may find all you are looking for just by exploring the gui, this said, reading the maven literature will give you good insight on how it works and what it can do for you.
For my project, due to the long build and regression times, it is extremely common for me to have up to 4 different sandboxes at different NFS locations. Moreover, people can't share eclipse project definitions between each other. I'd like to be able to check in project definitions into the repository so that when I check out a new sandbox, eclipse knows that all project definitions are relative to the top directory of the sandbox. Can I do this?
( Note: as a first approximation, I'm not too concerned about merge issues. I just want to get rid of the overhead of recreating a project definition each time I check out a different sandbox. I'll worry about merging project/configuration files some other day.. I realize that if you had multiple people somehow sharing a project configuration, things like breakpoints and run commands could proliferate uncontrollably.)
I think the Eclipse project set files can help you here:
http://wiki.eclipse.org/PSF
I am using Eclipse 3.5 for several different Java/JSP projects. All of our project code is stored in Subversion. I use the Subclipse plugin to update / commit code. This works great for all projects except one. There is one project where almost every time I do a SVN update, the entire project becomes riddled with Java compile errors. Most of the errors are complaints that it can't find other class files within the same project. To resolve this, I have to go to Project > Clean and manually clean out the project, which takes a little while to run. Everything compiles just fine after this, but it is a bit of a pain to have to manually clean the project every time I do a SVN update. And this only happens for this one single project.
Anyone experience something like this? I am not even sure where to look to figure out why the project needs to constantly be manually cleaned. Is it possible that someone else is checking in a file that breaks my project build in Eclipse? If so, what file(s) should I look for?
First, excuse me if I say something obvious, but you didn't give any details of your project configuration, nor described your previous attempts at solving this issue. So, maybe you've already tried everything I'm going to suggest... ;-)
Off the top of my mind, I'd check whether someone else is committing compiled classes, instead of sources only.
Other than that, it depends on your configuration: I'm assuming that you've got the "Build automatically" flag checked, that you're building through Eclipse only (and not, for example, through Ant, letting maybe the Ant build put its output somewhere in your classpath), and that you're not versioning jars nor your .classpath file.
I suggest (if you're not doing so) to perform your SVN updates going through the Synchronize view (Team -> Synchronize with Repository), in order to see at a glance what kind of incoming changes you've got, to better distinguish cases when your project gets messed up from cases when it doesn't.
Some one already explained that, may be someone else also committing the compiled classes , and the class paths are getting conflicts. Fist know this info from your collegues and proceed. I didn't come across this situation. sorry.
How are you storing the project on SVN? Are you storing the entire Eclipse project or just source code, structure, etc? If you're not storing the entire project I'd suggest doing that as it makes it easier to work with (unless you've got somebody using a different IDE). Without some more information it makes it hard to diagnose, but it certainly sounds like somebody is committing compiled class paths. You should check the SVN history to confirm.