java

Make it pretty: processing an array concurrently

I want to convert this linear loop into a concurrent one: for(Item item : ItemList) { processItem(item); } Is this really the shortest way to do this? class Worker implements Runnable { Item item; Worker(Item item) { this.item = item; } public void Run() { processItem(item); } } ExecutorServic...

NetBeans gui design tool (matisse) seems to use Java 5 instead of Java 6

When trying to open a custom JPanel class in the NetBeans GUI design tool, I get the following error: Warning - Form loaded with errors Error in loading component property: [JPanel]->someScrollPane->somePlainJTable->autoCreateRowSorter No such property exists in the component. The offending code: somePlainJTable.setAutoCreateRowSorte...

Tomcat does not recognize my context

I have a web application and use tomcat-5.5.27, eclipse 3.4 on open SUSE. I use it from eclipse (deploy, run, debug, etc...) I have to set some JNDI resources (datasources) that Tomcat will expose them. These resources are defined now in \META-INF\context.xml. This works fine. But, when I move this file (context.xml) in tomcat-5.5.27/c...

Netbeans problem: Can't add application descriptor, getting null pointer exceptions

When I try to add to the application descriptor in a Netbeans mobile project by clicking on 'Add' in the 'Application Descriptor' panel in the projecct config window nothing happens, netbeans gives a red button on the bottom right indicating an error, clicking on that reveals this: java.lang.NullPointerException at org.netbeans.modu...

Java FileHandler disable log rotation

I am trying to disable log rotation, for file handler using, FileHandler fh = new FileHandler ( "path" + "run.log", 1000000, 1, false); What i want is one log, created for each run i do not want rotation or backing up of the old file, but using this initialization i get run.log run.log.1 run.log.2 for each run. Also logger....

How to use JPL (bidirectional Java/Prolog interface) on windows?

I'm interested in embedding a Prolog interpreter in Java. One option is using JPL, but the download links on the JPL site are broken, and the installation page mentions a jpl.zip that I can't find. I downloaded SWI-Prolog which seems to include JPL (it lists it as a component when installing), but I'm still not sure how I'd use it along ...

Do non-self-signed certificates remove the security warning for Applets?

What exactly do certificates purchased from a CA do again (in the context of Java applets)? Lets say I have an applet on a website that accesses the users files (requiring a security certificate). If I make a self-signed certificate, the client will get a security warning asking if the client should trust this application. If I purcha...

Setting java to use one cpu

I have an application that has a license for a set number of cpus and I want to be able to set the number of cpus that java runs in to 1 before the check is done. I am running Solaris and have looked at pbind but thought that if I started the application and then used pbind it would have checked the license before it had set the number o...

SWT Drag and Drop support for Text widget

I've written an application recently using SWT. In one of its dialog box, I have a few widgets, one of which is Text, which is designed to support DND with other widgets. I've first added DND support for the 2 Tree widgets on the same dialog box (both drag source and drop target). Before I added DND support for that Text widget, I notice...

Accessing DWR post data in a Spring Interceptor

I have a DWR action with a method signature as follows: String joinGroup(String groupId, String groupName); This is called via a DWR AJAX request and works fine. However, I am trying to write a Spring interceptor (works much like a ServletFilter) to do some authentication work before the DWR action is called. The interceptor is being...

How to capture System.exit event?

hi, I have an application in java, in which i try to ensure that the if anybody exits codes System.exit() in the code , an listener should be called to do some stuff like logging message and releasing the resources ... How can i implement it, any suggestion/approach is welcome. ...

How do I make a constuctor available to only the factory class?

Ok, the question might not be crystal clear. Let me give some details: Let's say I have an Shoe (CShoe) object factory class called CFactory. CFactory is a singleton class that creates and stores all instanciated shoes using a simple hashmap. It is then accessed through static methods to use the created objects. Is there a way to force...

Is there a tool for analysing the Access Level of Java classes and methods?

In the Java code for our application I'm pretty sure there are lots of classes and methods which have public access but probably only need package level access. What I'd like to do is to tidy up our code on a package by package level, making only things that really need to visible outside each package public as this should simplify othe...

JMX and Tomcat: create and use MBeans in a servlet

Hi all, does anybody have some ideas on how to achieve that? Or even a good documentation on how to do that? Basicly everything is done in a test standalone version (by a java client or jconsole I am able to call mbeans methods and everything works fine), but I need to put it in my Tomcat servlet.... Thanks for every suggestions! Ro...

UnsatisfiedLinkError in lotus-notes plugin

Hi, We are having an issue with a dll in a notes plugin. When we call this: NotesFactory.createSession(); we get this error: Unable to create view: nlsxbe (The filename or extension is too long. java.lang.UnsatisfiedLinkError: nlsxbe (The filename or extension is too long. ) at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.j...

Invoking Eclipse's export to xml programatically

Hi I want to invoke the export to xml function of eclipse programatically to create the build.xml files, so that it can be in a continuous integration process. Is there an easy way to do it, without opening Eclipse? Thanks, Aakash ...

Database connection pooling datastructure

I would like to develop database connection pooling. Could anyone please tell me about which data structure need to use to maintain the pool ? ...

RSA decrypt in ANdroid

hi, I am using RSA modulus and encrypting a data with modulus and trying to decrypt it with private key of RSA ..i m using RSA/ECB/PKCS1Padding at the decrypt end Thnx in advance ...

Need pageEncoding/charset not to be defined in header (JSP)

I writing a JSP program that needs to react on an existing program. It gets several variables that the JSP program needs to process and generate a response. The existing program has his custom headers like: Content-Type: application/x-server-response But the JSP program returns its content with the wrong headers. Like this: Content-...

Timestamp Response is Incorrect - BouncyCastle

Hi, Trying to request a timestamp (RFC 3161) by using BouncyCastle and connecting to http://timestamping.edelweb.fr/service/tsp. I do get a TimestampResponse back from the server but it seems to be without an actual date. This is the code: public static void main(String[] args) { String ocspUrl = "http://timestamping.edelweb.fr/se...