After years of working OK, I’m suddenly getting this message when trying to start the JVM: I tried uninstalling, and got a message saying a DLL was missing (unspecified) Tried re-installing, all to no avail. At the same time, when trying to start Scala I get: Checked %JAVA_HOME% and %path% – both …
JDBC connection to SQL Server 2005 Instance running on remote machine
I am trying to connect to sql server 2005 instance running on a remote machine from my spring web application. This web application is running in tomcat server. Earlier When I connected to sql server 2000, it worked fine. I used msbase.jar, mssqlserver.jar, msutil.jar to connect to sql server 2000. My connect…
URL decoding: UnsupportedEncodingException in Java
What I understand from the documentation is that UnsupportedEncodingException can only be thrown if I specify a wrong encoding as the second parameter to URLDecoder.decode(String, String) method. Is it so? I need to know cases where this exception can be thrown. Basically, I have this code segment in one of m…
JaxbRepresentation gives error “doesnt contain ObjectFactory.class or jaxb.index”
I am trying to create a sample test application which converts an object to JaxbRepresentation. But when I try to run this, it gives me an error. Main.java file TestResource.java file SampleResponse.java file When I run this on the server, it throws the following error: Please someone help!!! Answer To get ri…
opencsv in java ignores backslash in a field value
I am reading a csv file using opencsv. I am ignoring the first line of; the csv file is tab separated with some values enclosed in double quotes. The problem occurs when I read the values of a column that has the ” character, this is stripped out of the value. For example in original file: It becomes as…
is there a ‘block until condition becomes true’ function in java?
I’m writing a listener thread for a server, and at the moment I’m using: With the code above, I’m running into issues with the run function eating all the cpu time looping. The sleep function works, but it seems be a makeshift fix, not a solution. Is there some function which would block unt…
java: save string as gzip file
I’m java beginner, I need something like this: String2GzipFile (String file_content, String file_name) String2GzipFile(“Lorem ipsum dolor sit amet, consectetur adipiscing elit.”, “lorem.txt.gz”) I …
Java heap space in a looped function
Hi I have a java application that is processing a number of records from a database. Now after processing about a 160 of these the java runs throws a “OutOfMemoryError: Java heap space”. Due to this I updated the entire function in order to only process 150 records at one go, which works fine when…
RetentionPolicy CLASS vs. RUNTIME
What is the practical difference between RetentionPolicy.CLASS and RetentionPolicy.RUNTIME? It looks like both are recorded into the bytecode and both may be accessed at the run-time anyway.
Java Scanner String input
I’m writing a program that uses an Event class, which has in it an instance of a calendar, and a description of type String. The method to create an event uses a Scanner to take in a month, day, year,…