Thursday, August 01, 2013

How to change a file extension in NetBeans

My friend Bruno Borges has asked NetBeans team to fix an issue about supporting extension changes in files during renaming. Looking about it I have found that NetBeans already support extension changes, not during renaming but it can be achieved using Properties view. I agree that it is a little bit hidden, so the idea here is write some words about it and make the user's life a little bit easier.

Basically what you need to do to achieve this is open Properties view in Window > Properties menu or using the shortcut Ctrl + Shift + 7. After that, select your file directly in Projects, Files, Favorites or even by opening it in the editor. Now, if you select a XML file for example, your Properties view should be something similar as the image below.

Now you can change the Extension property and the file type will be change as expected. I hope this little tip can help you.

Happy coding!


Richard said...

I can't make it work for the xhtml files.

Michel Graciano said...

Thanks Richard. I will investigate it further and if necessary file a issue.

Álvaro G. Vicario said...

Certainly, this is the problem with most IDEs (not only NetBeans). They're so busy implementing code generators and unit testing frameworks that they don't even notice how rough their basic file editing features are.

Nice trick!