Skip to content

Tag: java

Saving to properties file escapes :

Does anyone know why the colons are getting escaped when I store the properties file? I’m doing this: And storing using: It’s working but the output has colons escaped for some reason: Anyone know a fix? Answer In properties files, both of these are legit: So both = and : must be escaped. Now, if …

Access file in jar file?

I need to be able to access a file stored in a compiled jar file. I have figured out how to add the file to the project, but how would I reference it in the code? How might I copy a file from the jar file to a location on the user’s hard drive? I know there are dozens of

How to import java libraries in jsp code?

I have the following jsp code. I want to add libraries such as java.io. How can I do this? Answer You are almost right, but you need to close the import tag, like this: To declare multiple imports you can either duplicate that entire tag, like so: or use a comma-separated list: For a multitude of reasons, tho…

Ignore Assertion failure in a testcase (JUnit)

Currently, I am writing the automation testing using java and selenium rc. I would like to verify all the contents present on the user interface, the function is ie below: The function is supposed to return a String containing information about the testing. However, the function stopped once an assertion erro…

Why is my Eclipse Java package being treated as a folder?

My Eclipse Java package is treated as a folder; can anyone suggest what’s wrong? Answer Worst case, you’ll have to delete the folder and recreate as a java package. Save the Java classes somewhere else in your Java project by refactoring Delete the folder and the underlying folder structure Create…

Java heap space (java.lang.OutOfMemoryError)

In my project, I have a module to upload multiple image and create the thumbnails for it at once. For uploading, I am using JavaFX and for creating thumbnails, I am using Java. I wrote upload code and call of thumbnail creation function inside a for loop. If the number of uploading images is more than five, I…