java

Can I get a Java Socket from a file descriptor number?

When a program is started via FastCGI, it is exec'd with a socket already open to talk to the web server. The socket's file descriptor number is handed to the program, but how can that be converted to something useful in Java, such as a Socket instance? My hosting service uses mod_fastcgi for Apache httpd. They won't allow me to configu...

How to stop Maven/Artifactory from keeping Snapshots with timestamps

Hi, Due to disk space considerations I'd like to only ever keep one version of any snapshot in my repository. Rather than keeping multiple versions with timestamp suffixes e.g. ecommerce-2.3-20090806.145007-1.ear How can I set this up? Is this a build setting or repository (Artifactory) setting Thanks! ...

My GUI is frozen

Hi all, I have something I can't understand: my Swing GUI contains a 'play' and 'pause' button. I have also a static variable that defines 'ON' and 'OFF' states. (The main program generates the GUI). By cliking on 'play' I change the state of my static variable to 'ON' and I launch a time-consuming process in a thread that also modifies...

threads for reading and writing java

hi, i'm reading data from serial port for average interval say 1 second,and at the same time writing read data to textArea and textfile,problem is i'm not getting correct data at some time,may be because i'm doing all three process in a single program,how to do writing to text area and text file by separate thred? this is my code: impo...

Are static anonymous classes definitely wrong in Java?

I've read elsewhere that a static anonymous class doesn't make sense - that all anonymous classes should be tied to an instance of the enclosing type. But the compiler let's you do it. Here's an example: class Test { /* * What's the difference at between * Test.likeThis and Test.likeThat? */ // This is...

I want to insert a file to Oracle using BLOB column type over Hibernate?

I want to save my file on Oracle Instance. I am using Hibernate for data objects. How can I insert files into Oracle Blob. Is there any sample code for this? ...

Which Java blocking queue is best for multiple producer and single or multiple consumers scenarios?

Which Java blocking queue is best for multiple producer and single or multiple consumers scenarios ? I am testing with LinkedBlockingQueue but i am getting OutOfMemoryError exception. I am trying to achieve following things. producer creates a object & put in a queue. consumer grabs the data from queue & insert into DB. There woul...

Disable Axis log4j logging in jboss

Hi, I have small application that is uploading pictures to another website via webservice. My current problem is, that Axis is logging the whole xml message (including the binary data of the picture!) via STDOUT and I can't seem to figure out, how to disable it. My log4j settings for jboss (jboss-log4j.xml) includes an appender for nor...

How can I change <wsdlsoap:address location=""> at runtime

I use Java and Axis to develop my website and WebService and I hava a problem: I have 1 WS module and I have pluged it into some websites run on diferent servers. And I have a program call WebServices, but I want to invoke specific WebService (belong to specific my website), so I nedd to change value of <wsdlsoap:address location=""> a...

Open Source data streaming engine

Are there any open source data streaming products for publishing and subscribing to objects? A commercial example is SwissRisk Slingshot ...

log4j directs all log output to stdout even though it's not supposed to

In my log4j.properties I have: log4j.rootLogger=DEBUG,stdout log4j.logger.notRootLogger=DEBUG,somewhereelse The appenders stdout and somewhereelse are both configured properly, stdout writes to the console and somewhereelse writes to a file. In my code in each class either I set either: static Logger log = Logger.getLogger("notRoo...

Java Serializable

i have made a serialized class,like this ` class Example implements Serializable { transient byte i=2; transient byte j=3; Example(){System.out.println("value of i:"+i+",j:"+j);} } ` when i am serilizing n deserializing the class,i.e. class SerialClass { public static void main(String []r)//throws IOException { try{ ...

mangen adds 'Bundle-ManifestVersion: 1' to manifest, but felix doesn't seem to accept value 1

Hi, I've used 'Mangen' to process my jar, which works but it adds the next line to the manifest Bundle-ManifestVersion: 1 after which Felix 1.8.0 complains with -> install file:D:/bundles/osgi_ds_1.jar.new.jar org.osgi.framework.BundleException: Unknown 'Bundle-ManifestVersion' value: 1 at org.apache.felix.framework.util.ma...

Drag and drop feedback in a JTree with custom TreeCellRenderer (Java, Swing)

I have a class derived from JTree with custom TreeCellRenderers. I have implemented drag and drop in that tree, so a user can rearrange tree nodes. The drop mode is DropMode.ON_OR_INSERT, so the user can drop nodes on or between other nodes. While the user is dragging the node, if the pointer points between nodes, a blue line is drawn i...

How can I retrieve a hard disk's unique ID using Java+JNI on Linux, Windows and Mac

How can I retrieve a hard disk's unique ID using Java+JNI on Linux, Windows and Mac? ...

Java : how to determine disk space on Windows system prior to Java 1.6

I want to determine the available disk space on windows. I don't care that my code is not portable. I use this : String[] command = {"dir",drive}; Process process = Runtime.getRuntime().exec(command); InputStream result = process.getInputStream(); aiming to parse the result from a "dir C:" type of call, but the String I get from the c...

How do I turn logging off using log4j?

Hi, I am using a third-party library which has a log4j.xml configuration - what's the best way to turn off the logging? ...

Resize video with JMF

Im trying to play a video in my java application using JMF. The video is playing fine but im trying to make the video larger. the code below is being placed inside another jpanel with a gridbag layout. I currently have it being added with no FILL constraint so it should be displaying at its normal size. When i do add a fill constra...

How to test void method with Junit testing tools?

I just happen to implement a method void followlink(obj page,obj link) which simply adds page and link to queue. I have unsuccessfully tried to test this kind of method. All I want is to test that in the queue contains page and link received from followlink method. My test class already extends TestCase.So what would be the best way to ...

JDBCRealm digest for MySQL PASSWORD() function

For an internal Tomcat/Java/Struts application, we're converting custom-written authentication code to use JDBCRealm. The database is MySQL 5.0, and the passwords are stored as PASSWORD()-encrypted strings. In our version of MySQL, the PASSWORD() function is a non-standard (proprietary?) 41-byte hash. (I know now that we shouldn't be ...