Similar to this question. I have been tasked to develop an application using Java to send message strings from my WinXP PC to a nearby mobile phone, using only Bluetooth.
I have found a free Java Bluetooth library (Bluecove) to work with, but it seems that it might not support OBEX under Windows, which as I read is necessary to perform...
I'd like to create a GUI where some of the textfields are resizable horizontaly but maximum width is also specified. For instance the preferred width is 100 pixels, it can be bigger if the window is resized, but the maximum allowed width is 200 pixels. GroupLayout supports this, we can specify the max size in the addComponent method (alo...
I know the end points of a line segment and the distance/size of the perpendicular end caps I'd like to create but I need to calcuate the end points of the perpendicular line. I've been banging my head against the wall using either 45-45-90 triangles and dot products but I just can't seem to make it come together.
I know the points in b...
I have been trying to create an array of a class containing two values but when I try to apply a value to the array I get a NullPointerException.
public class ResultList {
public String name;
public Object value;
public ResultList() {}
}
.
public class Test {
public static void main(String[] args){
ResultList...
Hi All,
when using RunTime.exec(), one can specify the working directory of the subprocess (very useful, if the executed app can only be launched from its location as it access some local config files for instance)
If the external app is a jar file, on can read the manifest in the jar to get information about the main class and the cla...
To make class serializable we do the following:
class A implements Serializable {
transient Object a;
}
And why not:
serializable class A {
transient Object a;
}
Why if we want to make class serializable we implement special interface. And if we want to exclude some fields we use keyword "transient"?
Why special keywords are...
I have a problem playing a sound correctly in Java using the Clip interface.
Playing the sound works using:
clip = (Clip)mixer.getLine(dataLineInfo);
clip.open(audioFormat, byteData, 0, byteData.length);
clip.start();
However there is a memory leak if clips aren't closed.
I have tried adding a line listener before starting the clip,...
Using the JUnit ant task to run my Unit Tests from CruiseControl on Centos 5.4
My jUnit Task forks to run the tests, the majority of which work ok, however I keep getting intermittent failures where the JVM crashes, always with the same error:
[junit] Fatal: Stack size too small. Use 'ulimit -s' to increase default stack size.
I've do...
Okay, this sounds simple, but I tried all the simple things and it still doesn't work properly.
import java.net.*;
import java.io.*;
public class MyServer{
public static void main(String[] args) throws IOException {
int MAX_PLAYERS = 1;
int players = 0;
ServerSocket serverSocket = new ServerSocket(43);
...
I have a problem getting this JPA query to work on MS SQL Server 2008.
The background is as follows: Users create jobs for clients, of which there are many. I am displaying a list of his most recently used clients to the user to make the selection easier.
SELECT DISTINCT c FROM Client c
JOIN c.jobs j
WHERE j.user = ?1
O...
Hi, All!
I have a maven2 project, consisting of root project (with pom packaging) and a set of modules having dependencies on each other. The project is a library with a set of apps built on top of this library. Now the problem.
My library uses some resources which cannot be packed in jar - namely some sqlite databases, and I can't fin...
Scenario is such: I have a webapp that I'd like to run dynamically with the tomcat-maven-plugin's tomcat:run goal. The wrinkle is that I have numerous classpath resources that need to differ between the packaged artifact and the one run off a local workstation.
Failed Attempts:
1.) My first attempt was to use the builder-helper-maven-p...
I'm trying to get some NSS code working and I'm getting this error:
java.lang.UnsatisfiedLinkError: org.mozilla.jss.ssl.SSLSocket.setSSLDefaultOption(II)V
at org.mozilla.jss.ssl.SSLSocket.setSSLDefaultOption(Native Method)
at org.mozilla.jss.ssl.SSLSocket.setSSLDefaultOption(SSLSocket.java:950)
at org.mozilla.jss.ssl.SSLSock...
A web application uses a Java applet that stores a password, submitted by the user, in a private property and uses this property in several public methods.
I wonder if it is possible for another Java applet loaded from the same or different web site to call the methods of this applet or possibly access the private property containing th...
What is the smartest way to get current page name where request came from? By page I mean the real page name that contains current portlet.
...
Is there any binary release of Java 7 (using the Mac/BSD-port project) anywhere? Some blogs (e.g. Building Java 7 on Mac OS X) have a detailed instructions to build the jdk from source, but I was hoping that someone have a binary of it available for download.
The problem with the instructions is that it's quite annoying to get all the ...
Does c# have an equivalent of the Java Runnable interface?
If not how could this be implemented or is it simply not needed?
thanks.
...
Hi all, I saw that exist more then one way to map a Composite Key with JPA.
But in my case is kind of different:
I have a table with only 2 column:
mysql> desc mytable;
+--------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------...
I want to design it such that whenever one of my custom exceptions is thrown, it automatically prints the stacktrace to a file. Is there a method I can override to accomplish this? Doing this would help to reduce a noticable amount of code in my project.
...
Recently I got into a discussion with my Team lead about using temp variables vs calling getter methods. I was of the opinion for a long time that, if I know that I was going to have to call a simple getter method quite a number of times, I would put it into a temp variable and then use that variable instead. I thought that this would be...