How to find location of error from stacktrace alone - eclipse

If I run a java file from my IDE and an exception is thrown, a hyperlink is printed that I can use to view the line of code that threw the Exception.
However, if I run from terminal all I will get is something like this:
at java.util.TreeMap.put(TreeMap.java:531)
with obviously no hyperlink. How do I use the 531 to navigate to the line of code that is responsible for the error?

You can copy/paste your stacktrace to the eclipse console. Your stacktrace will magically become clickable and will open the file in which the error occured, provided eclipse has it in its class path.

Related

Why is an error coming in my untouched build.gradle file?

I was receiving this error in my build.gradle file (under android > app [This is for flutter in Android Studio]). The error is on 'Properties' and 'Gradle Exception'.
How do I fix this error, and is it necessary to fix it?
I haven't tried to change anything, and it was like this by default when I first opened the file.
It's not an error.
If you want to remove the warning in GradleExeption, just remove it and replace it with RuntimeException.

Debugging OfBiz in Eclipse gives MissingResourceException

I downloaded the OfBiz Java application and the following line throws an MissingResourceException:
ResourceBundle res = ResourceBundle.getBundle(settingsResourceName);
The value of settingsResourceName is "cache", but I cannot find any file called cache.properties or cache_en.properties.
Where should I be looking? I'm new to Java. All my research on SO says there should be such a file.
I imported OfBiz in Eclipse using the Import menu option and selecting Existing Project from File System (I'm not in front of my dev machine so I don't remember the exact wording). But I chose the root folder of the downloaded OfBiz.
I then added the appropriate VM Arguments in the Run Configuration to get it to run properly at least. And that's it, on the first Run I got the above error. I think it has to do with a missing class path but I don't know what to add to class path.
Here is the stack trace:
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.ofbiz.base.util.Debug.<clinit>(Debug.java:68)
at org.apache.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:61)
at org.apache.ofbiz.base.start.StartupControlPanel.loadStartupLoaders(StartupControlPanel.java:202)
at org.apache.ofbiz.base.start.StartupControlPanel.start(StartupControlPanel.java:69)
at org.apache.ofbiz.base.start.Start.main(Start.java:84)
Caused by: java.util.MissingResourceException: Can't find bundle for base name cache, locale en
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:773)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:174)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:170)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:166)
at org.apache.ofbiz.base.util.cache.UtilCache.<init>(UtilCache.java:124)
at org.apache.ofbiz.base.util.cache.UtilCache.createUtilCache(UtilCache.java:769)
at org.apache.ofbiz.base.util.UtilProperties.<clinit>(UtilProperties.java:75)
... 5 more
UPDATE:
My mistake, I found two files both called cache.properties in the following folders:
ofbiz-trunk/build/resources/main
ofbiz-trunk/framework/base/config
But these are folders, not packages. I tried putting them in the .classpath but that did not work, I still kept getting the same error.
As suspected, I knew it was because of a missing reference to a class path. After looking at a section on this page: http://www.opensourcestrategies.com/ofbiz/ofbiz_eclipse.php, I learned that I was supposed to go to the Java Build Path and in the Libraries tab, click on Add Class Folder, then point that to ofbiz-trunk/framework/base/config. Which is where I have one of the cache.properties files.

Notepad++ plugin exception

I am developing a notepad++ plugin in c++ by using Visual Studio 2013. I put my plugin's dll to the notepad++ plugin directory. When i try to run my plugin in notepad+ menu, it gives "Unknown exception" with window title: PluginsManager::runPluginCommand Exception. How can solve it? Any help is appreciated.
Thanks.
I have not (yet) found a way to replace or to add more details to the "Unknown exception" message, but I do have a workaround.
For exceptions raised at plugin startup I surrounded the PluginBase.SetCommand(...); call with a try...catch...:
try {
PluginBase.SetCommand(...);
}
catch ( Exception ex )
{
Win32.SendMessage(PluginBase.GetCurrentScintilla(),
SciMsg.SCI_INSERTTEXT, -1,
"Exception at startup in <name of my plugin>: " + ex.ToString());
}
I do not recommend this for the final version of a plugin, but it can help with getting the plugin working. My reasons for not recommending it are:
It catches every exception.
It writes the exception message into the
current buffer. It would be easy to not notice the exception message,
to assume that the plugin worked, and hence to corrupt the contents
of the file being edited.
The same technique can be used with the methods called when the plugin is executed.

Cannot deploy new Liferay theme "The filename or extension is too long"

I'm new to Liferay and Eclipse, and I'm trying to do some simple theme development. However, once I right click my theme (which I just created) and go to Liferay->SDK->deploy I get the following error:
BUILD FAILED
C:\sdk6.2\build-common-plugin.xml:482: The following error occurred while executing this line:
C:\sdk6.2\build-common.xml:993: The following error occurred while executing this line:
C:\sdk6.2\build-common.xml:299: The following error occurred while executing this line:
C:\sdk6.2\build-common.xml:1783: The following error occurred while executing this line:
C:\sdk6.2\build-common.xml:175: java.io.IOException: Cannot run program "C:\jre7\bin\java.exe": CreateProcess error=206, The filename or extension is too long
I was using a longer path for my SDK and JRE7 but reduced it to what you see in the above error message (to no avail). Does anyone know how to fix this problem?
Reconfigure your SDK folder, try to use a label for it without any "." or special char.
For example:
C:\liferay\sdk621\
And tell us your results...it could be a windows/ant path problem...

Error while connecting Eclipse IDE to run the Flex 4.5.1 SDK

I want to run the Flex SDK 4.5.1 on Eclipse IDE. I have followed this http://www.seanhsmith.com/2010/03/29/flex-for-free-setting-up-the-flex-4-sdk-with-eclipse-ide/
step by step and it was same as it was written.
But then when i first built my sample code and ran it, it gave me these errors. I cant figure out what the problem is:
This is the sample code:
and these are the ERRORS:
Loading configuration file C:\Mario's Files\STF\Flex SDK\flex_sdk_4.5.1.21328\frameworks\flex-config.xml
_application_Styles.as(24): col: 38 Error: Syntax error: expecting rightparen before s.
[Embed(_resolvedSource='C:/Mario's Files/STF/Flex SDK/flex_sdk_4.5.1.21328/frameworks/libs/framework.swc$Assets.swf', symbol='mx.skins.cursor.BusyCursor', source='C:/Mario's Files/STF/Flex SDK/flex_sdk_4.5.1.21328/frameworks/libs/framework.swc$Assets.swf', original='Assets.swf', _line='194', _pathsep='true', _file='C:/Mario's Files/STF/Flex SDK/flex_sdk_4.5.1.21328/frameworks/libs/framework.swc$defaults.css')]
^
Any solutions?
Do we have to get a compatible Eclipse-FlexSDK-Flash version??
The ' in "Mario's Files" throws off the parser, because it assumes the path ends there. Your folder names should not have a ' in it, ever. Call the folder "Marios Files" and you're fine.
Read up on String delimiters and escape characters, it's knowledge you will need anyway at some point.
This question might also be off-topic.