My IntelliJ Project Creation isn't providing me with any structure - java

In the past 24 hours, I've started having an issue with my IntelliJ not properly structuring projects for me when I create them from a template as a basic java project. I'm not sure why it's doing this, but as you can see in the image, there is absolutely no structure in my project, no src folder or anything. The path is correct on the header bar of the application, but nothing shows in the actual project view.
I thought it might be an issue with the project waiting to load, but I've waited 20+ minutes and nothing seems to change.
Also, if I try to edit the code in the Main class, I get a non-project file protection pop-up, and if I try to run it, I get an Edit Configuration pop-up.
Does anyone know how to fix this and make it work like it should?

Related

Eclipse: Could not find or load main class classnotfoundexception (with fix)

I have had this problem for years and years now where Eclipse would sometimes, seemingly for no reason, throw this error:
Error: Could not find or load main class [main-class] Caused by: java.lang.ClassNotFoundException: [main-class]
This error fires despite the class being in the file system and having previously worked with no flaws. Project clean does not fix it, and the filepath is completely valid. Consequent Google Searches usually turn up recommending that it's one of those two problems, or that you have to completely delete the project, or create a new workspace - so on.
I'm not sure what the exact cause of this problem is, and I haven't ever really been able to find one neither. However I had found a relatively simple fix for correcting it.
To fix this problem, what I've learned is that for some reason it tends to be Run Configuration itself. What you can do is:
Click "Run" in the toolbar
Click "Debug Configurations"
Create a new Run Configuration (However, don't just copy and paste the old one - for some reason this doesn't always fix the problem for me)
Set it up appropriately for the class, you can however copy the parameters from the old
Save and use that as the new run configuration for your program
This has generally fixed the problem for me most times. Hopefully someday Eclipse will have this properly fixed.
My current Eclipse version is 2021-12 (4.22.0)
I don't know if I did this self-answered question thing correctly, but for those of you who are banging your heads against your keyboard on Google right now trying to fix this, I hope this helps.

Eclipse 2020-12 - I can't create or edit groovy classes (was OK in 2020-09)

Recently Eclipse 2020-09 updated itself to 20200-12. My Java development has been OK. However, this evening, I needed to create a new Groovy class. The editor failed to open - I got an error 'window' (tltle = 'New') that said:
Creation of element failed. org/codehaus/groovy/eclipse/refactoring/core/utils/GroovyTypeBuilder
Opening an existing Groovy file results in the editor area being all grey and open editors have lost focus.
I've spent ages trying to find a solution - and failed.
If someone can help me with this, I'll be immensely grateful as work on my product has ground to a halt!
BACKGROUND
The new-class action creates a .log file. At the end of the log the entry is
Root exception:
java.lang.NoClassDefFoundError: org/codehaus/groovy/eclipse/refactoring/core/utils/GroovyTypeBuilder
Further up the log, I've seen other 'no class def found' entries for:
"org/codehaus/jdt/groovy/integration/LanguageSupport"
"org/codehaus/jdt/groovy/integration/LanguageSupportFactory"
"org/codehaus/groovy/eclipse/refactoring/formatter/GroovyIndentationService"
This is a Maven+Git project that produces a jar file.
Groovy complierversion is 2.5.14.
Maven dependency is groovy-xml-2.5.6,jar, which pulls in groovy-2.5.6,jar
I spent a long time at the start of 2020 working out the pom.xml so that the App's jar file and related folders+files all end up correctly. (I'm a Sunday-driver Maven guy, so once it worked, I was happy to leave it alone).
I really don't want to change versions of Groovy or anything - I don't think it's good practice to change 'infrasucture' in the middle of project.
As I don't know what other information will be helpful, I will provide it on request.

Runtime Error in JavaHelp

This is an issue that I have been running into for months and have been unable to solve it. We have continued to develop our JavaHelp; however, we are at a point where this needs to be fixed and I am out of ideas.
What this is: A Java Application
Folder structure:
-src
--HelpsetProject.java //Main method to launch JavaHelp
--help-hs.xml
--help-idx.xml
--help-map.xml
--help-toc.xml
--Images/ //images folder
--Topics/ //Topics folder for html files
The issue:
The application builds and compiles fine. It launches and runs fine, displaying the help as intended. However, fairly often when launched, the left side (item list/tree) will have a blank line or will be completely blank:
I originally thought that this issue was caused by missing map-toc tags, mistyped/mismatched xml tags/elements and general typos, as I am not the one actually creating these. However, I went over the files, validated and checked XML, double checked that all items on the list link to a file and clicked on every item in the list to see that it displays. The issue still persists, unless I missed something.
Here is the source code on GitHub:
Here you can download the executable and run it several times to see the error for yourself (It really is a chance for it to work/not work):

Refactoring package name breaks entire app

I am trying to refactor my package using Eclipse
org.sheehan.activity
to
org.sheehan.stocks.activity
For some reason my project just blows up when I do this and R doesn't get regenerated. How can I refactor properly?
UPDATE:
I updated my Android Manifest to reflect the change. R still doesn't get regenerated. Even after a clean. The compiler is complaining about org.sheehan.activity.R
I resolved by:
Android Tools > Rename Package Application
If you renamed properly, all your references across your project should have gotten updated. After doing this, clean your project by going to Project > Clean. This should fix it.
Fixing missing reference to R in eclipse:
Refactor -> Rename`
Build -> Clean
Android Tools -> Fix Project Properties
select the base package of your project in the eclipse package explorer, press F2 (Rename), in the rename dialog: SELECT ALL the checkboxes.:
That should do it
The package name doesn't update in the XML files. Specifically your manifest which needs to know the base package.
For more advanced imports and refactors, literally closing the Eclipse IDE can refresh a cache that causes random errors like "End position lies outside document range" or the "what once worked now doesn't hair puller outter errors."
Signs you should close Eclipse when trying to rename things are:
When you import a project, do some refactoring (like trying to change the package name), then delete the project and try again, you will see immediate R.java errors when you didn't before
When you are importing projects that have manually generated R.java files that have custom imports like "com.ns.proj.R" and don't see the name update in Preview
The box that asks if you want to "Rename subpackages" is checked unexpectedly
the code in the "Preview>>" looks as if it's been complied before instead of black and white code with the proper names replaced
you get XML errors in the manifest activity name like this
android:name="com.ns.proj.CustomCocom.ns.proj.CustomControlse="#android:style/Theme.Light.NoTitleBar"
when it should be
android:name="com.ns.proj.CustomControls"
android:style="Theme.Light.NoTitleBar"
There are too many to name obviously, however this is as important as "keep your eye on the ball" in sports. Something that is so easy to forget, yet things like these apply to other software programs like Dreamweaver (e.g. when you use the Dreamweaver "Put" option instead of FTP dragging with FileZilla and you notice your domain isn't updating your changes online). I called Adobe when I first started as a developer 8 years ago because I knew I wasn't doing anything wrong. They said sometimes the generated files to perform the action get corrupted...in other words, IDE's have bugs too!
In general, close the IDE before you off yourself...it could save your life!
Right click in your Project, go to
Android Tools > Rename Package Application
Sometimes if Project > Clean doesn´t work, so Delete /gen and /bin folders of your project.

Error: Unable to fnd class R.java No such file or dir

I keep getting this when trying to start a new project
ERROR: Unable to open class file C:\Users\Levi\Desktop\Android\workspace\Droid1\gen\com\androidbook\droid1\R.java: No such file or directory
I tried changing preferences to alter build path to project, but it still wouldnt work,,,
Is subfolder on desktop a bad place to install Eclipse?
Clean works sometimes and should be tried. I also find that blowing away the gen directory and refreshing will cause it be to rebuilt. Try that as well.
However, sometimes even that doesn't work and I've been forced to remove the project from Eclipse and then re-import it. This, unfortunately, works for me every time if the above has not.
Good luck.
Im also getting that error, running a Project->Clean in Eclipse helps for me.
Project->Clean should certainly fix this (unless your resources won't compile for some seperate reason).
I remember that the first time I ran Eclipse (in mid 2009, can't remember if it was Galileo or Ganymede or whatever) on Windows Vista, it presented several problems that were eventually traced to Eclipse itself being in a directory whose path contained a space...
Usually, the above tips (refresh, clean) work for me. But lately I had a very persistant instance of this error, which was caused by something else:
One of the layout .xml files in res/layout contained a reference to a custom view (org.company.project1.MyView). However, I had changed the package path (org.company.project2.MyView), so the reference had become invalid.
Thus, if everything fails try browsing your layout .xml files for invalid custom element definitions.
Cheers
after spending hours trying to ultimatly discover the issue behind the Class Issue not being found, resolved,or directory not there issue....
sometimes yes the issue is due to a bad binary or xml... as sometime a clean will do the trick or a xml edit will solve the day.. when all else fails.... this may do it..
"create a new workspace"
go into the workspace.... and then
Switch to your old workspace... in the newly formed workspace...
this was my silver bullet. so frustrating to not have a solid answer.
using Version: Helios Service Release 2
Build id: 20110218-0911

Categories