I have to serialize around a million items and I get the following exception when I run my code:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Unknown Source)
at java.lang.String.<init>(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.B...
Swing is good in many ways, then why do we need JavaFX?
...
We're customizing an Eclipse RCP based tool for a client. They have trouble loading it on one of their computers (it works on others) and have provided the following error log.
!SESSION 2009-01-23 12:09:05.593
----------------------------------------------- eclipse.buildId=unknown
java.version=1.5.0_12 java.vendor=Sun
Microsys...
I am in a situation where I need to expose a Java method as a web service, and I need to choose the technology to do so and I am basically a bit bewildered.
The requirements are:
Must be runnable in an IBM Java 5.
Must be deployable as a web application inside an embedded Jetty (currently version 6)
Must be detachable from an IDE (has...
I'm trying to do some Socket programming in Java, and I'm using the BufferedStreamReader.read(char[]) method.
the java doc states:
Reads characters into an array. This
method will block until some input is
available, an I/O error occurs, or the
end of the stream is reached.
Only it's not blocking on input.
can somone point ...
I have some code that I want to measure the speed of while it runs continuously in automated regression tests. The purpose of this would be to alert me to changes made to the code which have had a negative impact on performance.
In pseudo-code, I want something like this:
cpuTimer.start
runTest
cpuTimer.stop
diff = cpuTimer.getDuratio...
So we ran into an interesting issue today. We have a JEE (J2EE) web app that uses a bunch of 3rd party jars. This includes Hibernate.
We use the java logging api that comes with the SDK for logging purposes. Typically we are pretty thin on logging but we ran into this issue with one of our 3rd party jars using log4j to create it's own l...
How can I make a modal JDialog without buttons appear for the duration it takes a Runnable instance to complete and have that instance update a progress bar/message on that Dialog.
Clearly spaghetti code might be this working, but I'm looking for a clean design if one exists.
Thanks.
...
I was just wondering...official javadoc says that it returns a double that is "equal to a mathematical integer", but then why shouldn't it return an int?
...
In order to use the WorkerPool (Javascript Threads) class and functionality in GWT/Gears, do I need to write my code in both Java and Javascript? Upon inspection of WorkerPool - Getting Started and the sample WorkerPool application in the GWT-Gears-1.1 download package it seems that I need to. It seems that the Java code is used to dem...
Hello,
I'm an entry level programmer so please bear with me and be descriptive in your responses.
I am trying to use a Java API given as a .jar file in my C# .net application. I don't know much Java, but this .jar file says "no main-class manifest attribute" when I try to run it so this means its a library? This Java API also comes w...
I'd like to make use of ProgressMonitor's functionality but I don't want to give the user the option of canceling the action. I know if I don't call isCanceled() then the button press has no effect, but I'd prefer not to have the user believe the program is unresponsive.
How shall I go about doing this?
...
Should I initialize class fields at declaration like this?
public class SomeTest extends TestCase
{
private final List list = new ArrayList();
public void testPopulateList()
{
// Add stuff to the list
// Assert the list contains what I expect
}
}
Or in setUp() like this?
public class SomeTest extends ...
In a eclipse a "//TODO" marks an area in code as a task for later consideration.
Is there a way to add other expressions that will do the same. For example if i want to use "//myprojectname".
...
I'm using Mockito to write a unit test in Java, and I'd like to verify that a certain method is the last one called on an object.
I'm doing something like this in the code under test:
row.setSomething(value);
row.setSomethingElse(anotherValue);
row.editABunchMoreStuff();
row.saveToDatabase();
In my mock, I don't care about the order ...
I wrote a method to convert a given number from days to milliseconds:
private long expireTimeInMilliseconds;
...
public void setExpireTimeInDays(int expireTimeInDays)
{
expireTimeInMilliseconds = expireTimeInDays * 24 * 60 * 60 * 1000;
}
I had a hard time to figure out what I did wrong. Now my question:
Is that error so obvious ?
...
If the user name and password does not match it displays a alert but if i click ok to the alert the form is logged in.Can any one tell me how to avoid it?Thanks.
<html>
<f:view>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h:form id="loginForm">
<h1><cen...
Hi,
Is there a way to customize XML serialization in JAXB, in the same way that it's possible using IXmlSerializable in .NET? (i.e. the ability to directly control serialization of an object using the equivalent of an XmlReader/Writer).
I've taken a look at XmlAdapter and @XmlJavaTypeAdapter, but they just seem to be used to transform ...
I am trying to find data within a HTML document. I don't need a full blown parser as it is just the data between one tag.
But, I want to detect the 'select' tag and the data in between.
return Pattern.compile(pattern,
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE |
Pattern.DOTALL);
/// E...
Hi,
I am trying to build a java drum machine that needs to play WAV sound samples of the various drum parts (bass drum, snare, etc). Because I need to play the sounds in a tight sequence, I need high performance. Currently I'm using:
import sun.audio.*;
import java.io.*;
public class MusicPlayer {
private String filename;
pu...