I'm trying to do a Google App Engine project on OS X (latest and greatest). I'm using classes from javax.crypto, and I'm seeing an AccessControlException thrown when I try to initialize an instance of the Mac class. Here's the stack trace:
WARNING: Nested in java.lang.ExceptionInInitializerError:
java.security.AccessControlException: ac...
This is a followup to my own previous question and I'm kind of embarassed to ask this... But anyway: how would you start a second JVM from a standalone Java program in a system-independent way? And without relying on for instance an env variable like JAVA_HOME as that might point to a different JRE than the one that is currently running....
I'm trying to build a Java NIO-based socket server using Apache Mina. I really need to know the port of the remote host, not just the IP address, and it seems that Mina only exposes a SocketAddress (which can be downcast to InetAddress) object. I can get the IP address from InetAddress, but I normally use Socket.getPort() to get the po...
I have a java program which creates a lock file to ensure that no other executions run at the same time as it. If the program runs it creates the file, and upon exit, either successful or via an exception, the file is removed. But if the user hits Ctrl+C, closes the terminal, or in some other way interrupts execution, the file is not d...
I thought I'd ask in case someone else has run into this before.
How would you go about showing the user's file directory structure in a Java applet, something like Windows Explorer?
Would I have to create a JTree and manipulate that, or is there an easier way?
...
The standard example for implementing LRU Cache in Java points to the example depot url
http://www.exampledepot.com/egs/java.util/coll_Cache.html
How is removeEldestEntry called by default after just adding a new entry in the code snippet below?
final int MAX_ENTRIES = 100;
Map cache = new LinkedHashMap(MAX_ENTRIES+1, .75F, true) {
...
Hey all,
I need to write a mobile application (midlet) that will run on Nokia 6600 (SDK 60 2nd Edition CW).
the application's goal is to detect power interruptions(whenever there is no more electrical power going into the battery) and log them.
this mobile application will be comprised of two modules :
1) a J2ME module, mainly for in...
I use JNDI context to create datasource for JDBC drivers in Tomcat's context.xml file like this,
<Resource name="db/test"
type="javax.sql.DataSource"
driverClassName="com.test.jdbc.Driver"
url="jdbc:fastdb://localhost:3306/session_db?autoReconnect=true&connectTimeout=5000&socketTimeout=5000"
...
So recently I learned that in order to serve static files with a Last-Modified header from Google App Engine, I had to write my own (simple) servlet to do that. OK fine, I went and did it, results can be viewed here.
But now I find that File.lastModified() is always returning the same value, no matter that I have touched the file, even...
Hello,
Could anyone please tell me the meaning of API in following paragraph, that's actually about Transfer Object:
If it's likely that a business service
might be asked to send or receive all
or most of its data in a big,
coarse-grained message, it's common
for that service to provide that
feature in its API.
Thanks in...
Does anyone know what compression to use in Java for creating KMZ files that have images stored within them? I tried using standard Java compression (and various modes, BEST_COMPRESSION, DEFAULT_COMPRESSION, etc), but my compressed file and the kmz file always come out slightly different don't load in google earth. It seems like my png i...
In the context of an MVC application (using Spring MVC in this case), given that I have some image paths stored in a DB. How can I display these in the view?
Is it the controllers job to load them and then pass them to the view? If so, how is this done in Spring MVC using JSP?
Thanks
...
I have some data from server which looks like this. Each row is an array so the data comes as an array of arrays:
net Person age
net Person height
net Address streetname
org Company name
org Company location
com School color
com School number
From left to r...
I have several classes that need to load some properties files, and I was wondering what are the best practices to accomplish this. I thought of two basic approaches:
Hardcode the properties file name in each class, and then use the Properties class to load from a FileInputStream, which can be problematic if someone decides to change t...
Ive been looking for examples how to send messages using jelly + soap but they are very scarce. Anyone can provide a template of how to do this?
...
Peeps,
I'm hosting our dev env on a virtual server over at Mediatemple - the $50 bucks a month kind. Our application does some fairly memory intensive processing and on the last run, ran into the OutofMemError.
Apparently increasing the JVM size using the usual methods of setting JAVA_OPT or CATALINA_OPT in the setenv.sh file doesnt...
I have a question about styling Icefaces. I have a minimal application that can use Icefaces components, but when I use them and view the page, the components are not styled (for example the buttons have the default look and tabs have no look at all, no images, nothing). I was wondering why that is and what I should do so I would get the...
I'm working on a project at the moment that we're using junit to test, but as its still fairly early stages a lot of features aren't yet implemented, though they already have tests written for them
this means these tests (obviously) always fail
I was wondering if anyone knew a way to get JUnit to pass the test while displaying a warnin...
We're using JUnit 4 to test: we have classes that don't are a subclass of TestCase, and they have public methods annotated with @Test. We have one file with many @Test methods. It would be nice to be able to run a subset of them via Ant from the command line, in the style of this recipe for JUnit 3:
ant runtest -Dtest=MyTest -Dtests=tes...
I'm using Netbeans.
When I run the program below, I get this as output [I@de6ced! How come?
import java.util.Arrays;
import java.util.Vector;
public class Test {
public static void main (String[] args) {
int[] a = new int[1];
a[0] = 5;
Vector<Integer> a1 = new Vector(Arrays.asList(a));
System.out.println(a1.element...