I want to program in C using Eclipse and I am asked to give a workspace directory when I launch Eclipse. I read that the workspace is where you store your projects. But when I write a .c program and have its .exe file in the same place, I will want to have it in "Documents" or similar and not under C:\users\something. Will all my codes and files be stored there? How should I understand this workspace-directory question?
Sorry, I'm not used to this as I come from Notepad++.
Eclipse's workspace directory is where your projects are stored during development. So your main source code is here, but also all your doco, Eclipse config, test files, executables, etc.
When your project is complete and you are ready to deploy, you can put your executable wherever you want, eg. your "Documents" directory or C:\Program Files.
Responding to your comment, you can also put the source code (.c) wherever you want too. But it would be unusual to deploy source code.
Related
My professor wants all assignments submitted as an archived folder and wants the program to be able to run on his Eclipse when he grades them. The program is a simple one with one folder that has to contain just one class with the main method.
I am using IntelliJ.
I followed Jetbrains faq on exporting files as Eclipse-compatible using Files --> Export : https://www.jetbrains.com/help/idea/exporting-an-intellij-idea-project-to-eclipse.html
It looks like the files were successfully converted as my folder directory looks similar to what the website. A screenshot of my directory after exporting: https://imgur.com/a/qQY4lUH
I am not sure what to do here as I am not familiar with the Eclipse ".classpath" and ".project" files that were created as well as the .eml and .iml files. I don't know what to do with them.
I was thinking of just copying them into a new folder called "ReviewNW" and archiving them and submitting that folder. I don't know if that would be enough for Eclipse to run my program. Is there something else I have to do from here?
Additional question: I have since changed some things in my program. Now when I try to use File --> Export, IntelliJ gives me an error and says I "cannot export files already exported to eclipse-compatible format". What if I make some changes to my class files in my src folder and need to export those changes again? I think I would need to manually delete each of those Eclipse files and export again or is there a simpler way?
Thank you!
This might be a dumb question, but I have a project I am trying to edit a few files for and using eclipse 4.20.0 as an IDE.
When I try to import the directory in eclipse, it creates a completely separate eclipse workspace directory and stores the files in there for my editing. (When I make changes, files in the eclipse workspace directory are changed, but not the original directory)
Is there a way to open the original directory in Eclipse and edit files directly in there? Or am I going to have to work inside the directory eclipse created and then manually move the files over every time to test them again?
I swear I've done this before, but it's been a few years so I might just be importing the directory wrong.
If you are only making a couple changes, just clicking on the .java class you need in your explorer and "Open With... -> Eclipse IDE" will allow you to edit the specific file without opening up a new project. If you are trying to open the project and work on all the files at once, File > Open Projects from File System usually works pretty well on eclipse. If you are opening another eclipse project, just click on the folder where the .project is stored when opening, not necessarily clicking into the folder itself.
I've just ported a C++ system from codeblocks to eclipse. I now wish to put the workspace under source code control. I don't know if I have set this up correctly. The directory structure looks like
toplevel
+--.metadata
+--very big file structure
+--project1
+--.project
+--.cproject
+--various cpp/h files
+--project2
+--.project
+--.cproject
+--various cpp/h files
What I would like is to be able to checkout everything on a different machine, start up eclipse, point it to the workspace and pick up all the projects. I know I have to keep the .project and .cproject files but what do I need to keep in .metadata or have I got the entire structure wrong?
Edit I found Where in an Eclipse workspace is the list of projects stored? which recommends .metadata/.plugins/org.eclipse.core.resources/.projects but there is a structure under each project folder containing .markers .indexes and properties.index. Do all these need to be kept? I had a bad experience with codeblocks where I kept the layout file and even though I finally deleted it, it was stuck in the source code control system forever.
I would discourage you from putting .metadata folder into source code repository. It is a very complex and large folder that contains internal plug-in data. It is very hard to keep it in the repository.
The recommended way is to store only the project folders (project1 and project2) in the repo along with .project, .cproject and .settings. You can then import them using subversion or git on any other machine.
I have lost files mysteriously a few times from my Eclipse workspace folder, and previously I assumed that I must have deleted them, but this time I know for sure that I didn't.
I entered a folder for a Java project. I listed the files. There were several text files. I then opened one in gedit to look at it. As far as I remember, I then did something in libreoffice Calc (to a spreadsheet file in a completely separate location), then I made some changes to the Java file in Eclipse. It would then have been automatically compiled. I then went back to the terminal to execute the program, but it wouldn't run. Listing the files shows that the reason it wouldn't run is that all the text files have disappeared and so has one of the .jar files (called stanford-parser.jar) but not another. I've searched my computer for these files and I can confirm they've gone.
A screenshot from my terminal illustrates this.
Can anyone help me to understand how this is happened, so I can avoid it happening again? Could compilation delete the files?
You seem to be storing source files in the bin directory of your Eclipse project, which is probably the target directory used by Eclipse to put the compiled classes. Store your sources in the source folder. The target folder is completeley deleted by Eclipse each time the project is cleaned up.
Note that non .java files stored in the source directory are automatically copied to the target directory by Eclipse. They're considered as resources that must be available at runtime in the compiled application.
I noticed when I import a file, the file is copied to the work space, but can I just create a file link in a Eclipse project? So when I modify the files in Eclipse, the files in the linked location is modified. In this way, I can version control the files using SVN. And I don't need to copy the modified files back to its dedicated directory when deployment.
The following is a more detailed description of my problem:
I have a cgi application located and runs in apache. The app runs with diff configuration files for different 'projects' which is more like showing different dataset with its corresponding configuration file. My task is to write the configurations files which will require some perl callback functions, css files and images. All these files have their own dedicated directories located in different places in the company server which i have not much control with.. So far, I just use command line to modify files and keeping old copies for version control. If I can do something like my above description, I will be able to have a central place to work on and do SVN. Or do you have a better idea how I should set up my work environment?
Thanks heaps in advance.
Yes you can,
File -> New File -> Advanced (at the bottom) -> Link to file in the file system
Manu
I have figured out a way to conveniently to version control files from different places and can deploy them to the correct directories after modified. It's ....... using..... the ANT build file... I just have all files imported to a single project and use an ANT build to distribute them back to their corresponding destination.
Use svn:external http://svnbook.red-bean.com/en/1.0/ch07s03.html
One drawback though, you have to update your other projects once you commit a shared files.