java

Using ANT to generate a .jar in a very large project

Hi, I have a large project I'm working on (using Eclipse) that uses the 1.5 update 18 JDK, various external JARs, and the like. It's all been setup properly in Eclipse. Is it possible to create an Ant file that generates a JAR from a particular source file in my project? (A number of the source files are compilable into Java Applications...

Type safety, Java generics and querying

I have an interesting situation and I'm wondering if there is a better way to do this. The situation is this, I have a tree structure (an abstract syntax tree, specifically) and some nodes can contain child nodes of various types but all extended from a given base class. I want to frequently do queries on this tree and I'd like to get ...

How can I implement a drag and drop file/folder upload that is recursive?

I am looking for some way to implement a drop box for files and folders to be uploaded to the site. I found one from rad inks, but it only supports multiple files. Does anyone know about something like this that supports folder uploading? The website itself is based on PHP. ...

How to locate JLabels to an absolute position on Java GUI

I have many JLabels (which includes ImageIcons) in a JPanel. And this JPanel is only a panel on the GUI; there are lots of other panels. I want to place labels to the exact pixel coordinates on their JPanel container. How can I do that without using GroupLayout? ...

IIS WCF Service Accesed via JAVA with NTLM Authentication

We have a WCF Service hosted in IIS 6 with Integrated Windows Authentication turned on under Directory Security. Consuming this service from a .NET Windows client the cached NTLM credentials flow to the Server PC and things work great. We would like to have the same occur when a Java client accesses the service (via the WSDL generated ...

Debug / Standard build of Java application

Greetings, I'm using embedded java, I write the application to a low resource device. One of the problems I get is when the code crashes the device stops. I can get a little information from it with some logging that I've added. (Simple print statements) This logging cannot remain in the application due to memory constraints. I wa...

Java: appropriate way to pass messages between client and servlet?

My system successfully passes objects from a client to servlet. However it is primitive as it was built to cater for Java 1.1. The message object it passes consists of an int (representing one of about seventy types) and a String of tokens which need to be parsed (the tokens may contain a list, a list of objects, etc). Not good! So, I'm...

How can I have a Singleton that's derived from an abstract base type in Java?

I have some classes that are used as Singletons. They share some basic functionality and extend the same ancestor from a library which in turn isn't normally used as a Singleton. If I put the common functionality in a base class that inherits from the common ancestor, I get a class which makes no sense to instantiate, so I made it abstr...

Encrypt/Decrypt ECB/PKS5/Blowfish between AS3Crypto & Javax.Crypto fails with padding error

I have a secret key that was sent to me as a file so I can encrypt some xml data using Blowfish. How do I access the key so that I can use it with AS3Crypto? I assume I need to Embed it using the [Embed] meta tag. It's mimeType="application/octet-stream" but I'm not sure if thats right. How do I embed, then reference this file as the sec...

Why are my sockets only able to communicate client-to-server and not server-to-client?

I have written a simple Java dispatcher with a daemon thread to handle the incoming traffic, and using another thread to send out commands. The problem comes when the server receives the first message, then the client/server system gets stuck on where the server trying to send out a response to the client. The sockets on both end just ...

class not found exception

I'm using Eclipse; when I run my code in debug I get a class not found exception but running it without the debug it works fine. I see it doesn't find the classes I wrote. How can I fix this? ...

Java MouseListener - Events

Does any know if the following is the expected behaviors in terms of what MouseEvents are fired? One seems to be missing or consumed elsewhere. Right-click on JPanel and display JPopupMenu MousePressedjava.awt.event.MouseEvent[MOUSE_PRESSED,(469,347),absolute(2214,490),button=3,modifiers=Meta+Button3,extModifiers=Button3,clickCount=1]...

How to send java.util.logging to log4j?

I have an existing application which does all of its logging against log4j. We use a number of other libraries that either also use log4j, or log against Commons Logging, which ends up using log4j under the covers in our environment. One of our dependencies even logs against slf4j, which also works fine since it eventually delegates to l...

Location of the IBM Developer Kit for Java for iSeries (AS/400) Javadocs

Does anyone know where I can find the Javadoc for the IBM Developer Kit for Java for the iSeries? The information center doesn't seem to have it. All I could find was the Javadoc for iSeries-specific JAAS. Specifically, I'm looking for the Javadoc for writting Java Stored Procedures (mostly the com.ibm.db2.app package). ...

java imap fetch messages since a date

I am writing/learning to fetch email using java from an IMAP folder using javax.mail package. I was successfully able to retrieve the last n messages in a Folder, however I am looking to build an example to retrieve messages since a specified date. Any examples? ...

Checkstyle and Eclipse; Java string continuation

(I know this is a sort of lazy question, but it's oddly hard to search for...especially since checkstyle does so much, and Google search results are littered with checkstyle reports.) Can someone tell me which checkstyle check reports "+ should be on a new line" when splitting long strings over multiple lines in Java? On an aside, thi...

How do I extract this string using a regular expression in Java?

errorString="AxisFault\n faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException\n faultSubcode: \n faultString: My Error\n faultActor: \n faultNode: \n faultDetail: \n {}string: this is the fault detail" Pattern pattern = Pattern.compile(".*faultString(.*)", Pattern.DOTALL); Matcher matcher = pattern.ma...

How to access static resources when using default servlet

Hi i have a problem i want to send all my request to one spring servlet <servlet> <servlet-name>home</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>home</servlet-name> <url-pattern>/*</url-pattern> </serv...

ORA-01031: insufficient privileges creating JMS connection to Oracle topic

One of my colleagues is having an issue creating a (non-durable) subscriber to an Oracle queue from Java. The queue is owned by one schema (say OWNER); he's trying to connect as another user (say SUBSCRIBER). SUBSCRIBER has been granted DEQUEUE privileges (and ENQUEUE, for what it's worth) by OWNER. When he creates the queue with the ...

Can you maintain the position of objects on a Java Swing panel?

I am currently desigining a calculator panel using Java Swing. However, it's an extreme PAIN to line up all of the buttons because they are always resizing and repositioning themseleves whenever I add a new button or change the size of a button. Is there a type of layout or something that can "lock" the buttons in position so they are n...