how to find carriage return in string using java
Just like you would identify any other character in a string: look for “\r\n” or “\n” (system dependent).
View ArticleBasic JPEG image resizing in Java
/* JpegResizerDemo.java */ import java.io.FileInputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.IOException; import...
View ArticleLoad an image, scale it to thumbnail size and save it as JPEG in Java
import com.sun.image.codec.jpeg.*; import java.awt.*; import java.awt.image.*; import java.io.*; /** * Thumbnail.java (requires Java 1.2+) * Load an image, scale it down and save it as a JPEG file. *...
View Articlejava.lang.OutOfMemoryError: Java heap space
Problem: The error ‘java.lang.OutOfMemoryError: Java heap space’ is caused when the JVM (Java Virtual Machine) runs out of available memory during processing. This can be caused by: a large number of...
View Articlejava.lang.IllegalStateException in Java Servlet
When response.sendRedirect() is not the last statement in Servlet to be executed and its embedded in between your business logic i.e after response.sendRedirect(), if some function or business logic is...
View ArticleHow to remove white-space from a String
/*** replace multiple whitespaces between words with single blank */ String before=" hi how are you "; String value = before.trim().replaceAll("[ ][ ]*", " "); or String value =...
View ArticleThe request doesn’t contain a multipart/form-data or multipart/mixed stream,...
org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn’t contain a multipart/form-data or multipart/mixed stream, content type header is null If you are iterating...
View ArticleCharacter Conversions from Browser to Database in JAVA
Character Conversions from Browser to Database in JAVA Characters in route to their final storage destination on the World Wide Web, move through various layers of programming interfaces and can cross...
View ArticleHow to Increase Heap Size for Tomcat + Windows
Tomcat can be installed in two different ways and below is the information about how to increase or set the heap size for tomcat server in both scenarios - 1. Folder installation – Create one new...
View ArticleFile upload using Java
First download Apache Jakarta Commons FileUpload library from this link and add into classpath of your Application. Validate HTTP Request Now that you have installed the FileUpload library, you can...
View Article