Runtime Error in JavaHelp - java

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):

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.

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

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?

Making custom Android keyboard via Eclipse tutorial; errors about R references won't go away

I guess I can't follow these instructions (but I've never used Eclipse before).
Here's my Eclipse Luna (2; 4.4.2) project structure, including a look at the file (SimpleIME.java) with the two errors (R cannot be resolved to a variable) (I have cleaned the project; rebuilding is automatic.):
There are two identical AndroidManifest.xml files. One that I created and one that Eclipse (or whatever) created.
The project has no Activity by design but Eclipse created one anyway, so I deleted it (with preview; only one reference (itself) was found).
Here's R.layout.keyboard:
Here's R.xml.qwerty:
So... what should I do? I cut and pasted entire contents of files and even file names, so typos shouldn't be the culprit, but maybe the structure is messed up. There's no structure shown at this otherwise excellent tutorial (first link).
Normally Eclipse and also Android Studio has problems to resolve the R resources if there is somewhere an exception.
Save all your classes and try to clean and build again. Normally it should give you an exception which resource is wrong. (Any image with wrong name, upper case name of image, any .xml file with exceptions.)
The cause is that the Android tools can only compile and create the R file if it is able to resolve all resources, and their identifiers.
If you tried clean and build. please post the error which will occur. (I made the experience that Eclipse has some issues to show the error marker on the specific resource file)
On a side note: Why do you still use Eclipse?

Android : The Missing R

I have seen alot of cases of "R cannot be resolved to a variable". Though my case is odd.
It was working perfectly about 15 minutes ago and within that frame, R has now vanished and cleaning the project won't cut it.
I have also ensured that all of my SDK parts are up to date before and after the incident. And the problem still occurs.
Can anyone figure out a solution as to why it would disappear just like that? Even though the SDK was up to date before R vanished?
And another question. Why does this R file cause so much trouble? (I am using Eclipse btw)
This can certainly be a nuisance.
Make sure any R. imports haven't sneaked their way in. Your imports should be bereft of any 'R.'
If you have changed your package name recently, ensure that AndroidManifest.xml is still pointing to the correct package. Using eclipse to refactor does not guarantee the manifest will update.
A side note, if you have errors in your xml files (layouts etc) this will cause a Resource error. Not all errors will be caught by eclipse, so you have to go through those files with a fine comb.
Sometimes simply cleaning, closing and restarting eclipse can help.
Check if you've recently added some music or pictures (any type of resource generally) to your res folder structure. Name of resource must be in lowercase completely, must not start with number...
Also look at the output in the eclipse console. It sometimes show error messages if it can't generate R.java

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