java

Is it possible to kill a Java Virtual Machine from another Virtual Machine?

I have a Java application that launches another java application. The launcher has a watchdog timer and receives periodic notifications from the second VM. However, if no notifications are received then the second virtual machine should be killed and the launcher will perform some additional clean-up activities. The question is, is th...

Does Java impose any further restrictions on filenames other than the underlying operating system?

Does Java impose any extra restrictions of its own. Windows (upto Vista) does not allow names to include \ / < > ? * : I know HOW to validate names (a regular expression). I need to validate filenames entered by users. My application does not need to run on any other platform, though, of course, I would prefer to be platform indepen...

Analyzer for Russian language in Lucene and Lucene.Net

Lucene has quite poor support for Russian language. RussianAnalyzer (part of lucene-contrib) is of very low quality. RussianStemmer module for Snowball is even worse. It does not recognize Russian text in Unicode strings, apparently assuming that some bizarre mix of Unicode and KOI8-R must be used instead. Do you know any better solut...

Struts 1.3: forward outside the application context?

Struts 1.3 application. Main website is NOT served by struts/Java. I need to forward the result of a struts action to a page in the website, that is outside of the struts context. Currently, I forward to a JSP in context and use a meta-refresh to forward to the real location. That seems kinda sucky. Is there a better way? ...

Can I submit a Struts form that references POJO (i.e. not just String or boolean) fields?

I have a Struts (1.3x) ActionForm that has several String and boolean properties/fields, but also has some POJO fields. so my form looks something like: MyForm extends ActionForm { private String name; private int id; private Thing thing; ...getters/setters... } In the JSP I can reference the POJO's fields thusly: ...

Draining Standard Error in Java

When launching a process from Java, both stderr and stdout can block on output if I don't read from the pipes. Currently I have a thread that pro-actively reads from one and the main thread blocks on the other. Is there an easy way to join the two streams or otherwise cause the subprocess to continue while not losing the data in stderr...

How does one record audio from a Javascript based webapp?

I'm trying to write a web-app that records WAV files (eg: from the user's microphone). I know Javascript alone can not do this, but I'm interested in the least proprietary method to augment my Javascript with. My targeted browsers are Firefox for PC and Mac (so no ActiveX). Please share your experiences with this. I gather it can be done...

How do you make a deep copy of an object in Java?

In java it's a bit difficult to implement a deep object copy function. What steps you take to ensure the original object and the cloned one share no reference? ...

Setting java locale settings

When I use the default java locale on my linux machine it comes out with the US locale settings, where do I change this so that it comes out with the correct locale? ...

What Feed Reader libraries for Java are best?

What Java library would you say is the best for consuming and parsing feeds? Requirements: Embeddable Supports Atom & RSS Has caching architecture Should be able to deal with any feed format the same way (Please: one suggestion per answer.) ...

How to upgrade database schema built with an ORM tool?

I'm looking for a general solution for upgrading database schema with ORM tools, like JPOX or Hibernate. How do you do it in your projects? The first solution that comes to my mind is to create my own mechanism for upgrading databases, with SQL scripts doing all the work. But in this case I'll have to remember about creating new scripts...

Detect changes in random ordered input (hash function?)

I'm reading lines of text that can come in any order. The problem is that the output can actually be indentical to the previous output. How can I detect this, without sorting the output first? Is there some kind of hash function that can take identical input, but in any order, and still produce the same result? ...

What is the most useful multi-purpose open-source library for java?

Are there any open-source libraries that all programmers should know about? I'm thinking something general, a sort of extension to the standard java.util that contains basic functions that are useful for all kinds of application. ...

Game programming in Java?

Hi, I am looking into game programming in Java to see if it is feasible. When googling for it I find several old references to Java2D, Project Darkstar (Sun's MMO-server) and some books on Java game programming. But alot of the information seems to be several years old. So the question I am asking, is anyone creating any games in Java ...

How do I get rid of "Cannot resolve property key" in fmt:message tags in JSPs in Intellij

This one has been bugging me for a while now. Is there a way I can stop Intellj IDEA from reporting missing keys in tags? My messages are not stored in property files so the issue does not apply in my case. I'm using IntelliJ IDEA 7.0.4 ...

What is the best way to make a .net client consume service from a Java server ?

I have a user interface in .net which needs to receive data from a server, on a request/reply/update model. The only constraint is to use Java only on the server box. What is the best approach to achieve this ? Is it by creating a Webservice in Java and then accessing it in .net, or should I create Java proxies and convert them in .net ...

C++/Java Performance for Neural Networks?

I was discussing neural networks (NN) with a friend over lunch the other day and he claimed the the performance of a NN written in Java would be similar to one written in C++. I know that with 'just in time' compiler techniques Java can do very well, but somehow I just don't buy it. Does anyone have any experience that would shed light...

Batch insert using JPA/Toplink

I have a web application that receives messages through an HTTP interface, e.g.: http://server/application?source=123&amp;destination=234&amp;text=hello This request contains the ID of the sender, the ID of the recipient and the text of the message. This message should be processed like: finding the matching User object for both th...

Writing C# client to consume a Java web service that returns array of objects

I am writing a C# client that calls a web service written in Java (by another person). I have added a web reference to my client and I'm able to call methods in the web service ok. The service was changed to return an array of objects, and the client does not properly parse the returned SOAP message. MyResponse[] MyFunc(string p) cla...

Write a Servlet that Talks to JMS (ActiveMQ) and OnMessage Update the Site

I am building a site that uses a simple AJAX Servlet to talk JMS (ActiveMQ) and when a message arrives from the topic to update the site. I have Javascript that creates an XMLHttpRequest for data. The Servlet processes the Get Request and sends back JSON. However I have no idea how to connect my Servlet into my ActiveMQ Message Broker. ...