How to rename/refactor a whole libgdx/java project in eclipse - java

Ive made a game with the libgdx framework in eclipse and I want to copy this project in the same workspace so I can make changes to this whilst viewing the original code.
I have tried refactoring before but it all messed up somehow and I ended up having to start a new project and copying over every class ( took a while )
Is there a way to rename the projects in a better way or how do you rename them properly as I obviously did something wrong.

In package explorer
Right click on project
Click Refactor > Rename or press Alt+Shift+R
Give new name

Related

Intellij right-click 'New' is not showing 'Class'

Related: IntelliJ does not show 'Class' when we right click and select 'New'
In the above accepted answer, it says the "New" does not give the option for Java Class because it was not the source root (blue directory).
However, as you can see, even though where I am right-clicking is source root, indicated by blue box, it is not giving me the option for Java Class
Any idea why?
This directory is imported from git so it did not follow the usual "Create Project" for java directly from Intellij
You are right clicking in the wrong spot -- youre "too high" up the tree. Go to where you code is (as in the package under "src") and try it there and you will see the option for a New Class.
EDIT: You don't need to be in the source root. You need to be in the source directories themselves. The blue dot I believe is a git status indicator. What you want is an entirely blue folder.
Go down under "src". Likely under "src" then "main" then "java", and you're there (that's blue for me) and then you will see your package folders. Below those are where you likely want to be adding classes.
As many mentioned above you can right click on the folder you would like it in. In your case:
If you push Alt+1, it might be easier for you to right click
src > New Java Class
Alternatively you can push:
Alt+1 (Project View)
Alt+Ins
or
Ctrl+Alt+Ins
1) Right click on src
2) Click New > package
3) Name your package and press OK
4) Right click the newly made package
5) New > Java Class
If the folder where we are trying to create the class is not marked as source or test then the option is not available.
Right click the project and go to project structure then under project settings -> Modules, Select the folder where you wanted to create class and mark as Source or Test appropriately and then click apply and ok.
Now you will see the change of color of the folder/package(Sources->Blue, Test->Green) and you will get the option to create the class.
This worked for me.
I know this is an old thread, but it happened to me because my gradle files were not synchronized. So if you are within a team working on same project and face this issue, make sure to run gradle sync.
You should go inside java project then you can create java class.

I've been coding with notepad++ and now I'm getting into Eclipse IDE and I'm having trouble with my older projects

So,
I have been coding Java last semester (college) and we've always done it in Notepad++ , compile and execute by CMD (very simple programs though) and now I want to start codding in Eclipse, since I heard that it saves you a lot of time in syntax and gives you a heads up on typos and errors (Also I'm tired of compiling and executing by console). But the thing is that I usually have my code into two folders (model and interface) and use the
package modelo;
package interfaz;
And now I execute eclipse and open these files, but it doesn't seem to work, I mean the code shows up and I can edit, but it wont show help or even let me execute the code. I know it must be a very noobie question but I can't seem to make it work.
Update:
This is what i get when i import my "project"
This is the error
The project is not configured as Java project:
Create a Java project via File > Other...: Java > Java Project
Copy the content of the src folder into the src folder of the new project
In the new project, open the class that contains the main method and click the Run button
maybe eclipse didn't figure out which main you want to run.
try right click on Menu.java -> run as -> 1 Java Application
You need to create a project in Eclipse first, then add packages and classes in that project, make sure that the JDK in classpath is configured correctly

Can't open file in java-eclipse neon

I am just starting off in Java and trying to follow buckythenewboston on you tube. I have java and eclipse neon both downloaded correctly. However, when I create a new project like he showed in the video, I click finish and nothing shows up, in the video it showed on the side there should be a like java symbol with the name of the project I created. Well nothing happens it is blank on my screen. I tried opening a file from the work space in my C drive and that doesn't work either as nothing shows up so I can create a class. I know there is a couple of forum questions with similar title but that is different I think as they can at least get code in where I can't. Any explanation as what is going on would be helpful. I also tried to go to file-import-existing project... but the existing project part isn't an option.
Thanks in advance.
go into your workspace directory and delete .metadata folder, then restart eclipse
Close all perspectives and open a new one, the one you like.

IntelliJ IDEA error: not able to create a new project

I am having trouble creating a new Java program. I am using IntelliJ IDEA 15.0.1, and when I right click and select new, it only allows me to make a "File", which does not allow me to code.
Please help! Thanks!
I ended up making a mistake. What you have to do, is go to file at the top left corner, and click Open. Make sure you go to the Java file, not the src file/anything else. It should work from then.

Eclipse Folder Structure

my Workspace on Eclipse is currently set-up so that it has a Folder Structure, like this:
I made it like that on accident but I prefer to use it and I need to make a new Workspace soon, because I don't want to delete all my projects.
Does anyone know how to make Eclipse be set-up like this with a folder structure instead of like this:
Click the small down arrow (triangle) at the top right of the view and select 'Package Presentation > Hierarchical' in the menu that appears.

Categories