java

What is the best way to monitor (java) process deaths on a Windows box?

We have a curious problem with our java processes dying. The application doesn't stacktrace, or write anything to the logs, the process just randomly dies. It's a heavily used application, but the problem only appears about once a month. We're currently looking into using Process Monitor but any other suggestions would be welcome. Edi...

An exception is encountered java.lang.UNIXProcess.forkAndExec

Anyone knows what is the reason for encountering this exception? An exception is encountered during the processing. The stack track is below: java.lang.UNIXProcess.forkAndExec(Native Method) java.lang.UNIXProcess.(UNIXProcess.java:53) java.lang.ProcessImpl.start(ProcessImpl.java:65) java.lang.ProcessBuilder.start(ProcessBuilder.java:451...

Arbitrary Java enum argument

I'm fairly new to java, and am used to enums essentially beeing nothing more than a named list of integers. Now I'm writing an implementation where a parent class has a couple of methods that take an enum value as argument. The enum will be defined in child classes, and will differ slightly. Since enums basically seem to behave like cl...

Does any one know how to extract a date field using a calendar in Java J2ME?

I want to be able to run an alert if the user does not change the date/calender field. My data is set up like this StartDate = new DateField("Start Date ", DateField.DATE); cal1 = Calendar.getInstance(); cal1.set(Calendar.YEAR, 2009); cal1.set(Calendar.MONTH, 0); cal1.set(Calendar.DAY_OF_MONTH, 1); StartDate.setDate(cal1.getTime()); ...

Regex for matching javadoc fragments

This question got me thinking in a regex for matching javadoc comments that include some specified text. For example, finding all javadoc fragments that include @deprecated: /** * Method1 * ..... * @deprecated * @return */ I manage to get to the expression /\*\*.*?@deprecated.*?\*/ but this fails in some cases like: /** * Method1 * ...

Java Collections copy list - I don't understand

I have an ArrayList and I want to copy it exactly. I use util classes when possible ont the assumption that someone spent some time making it correct. So naturally I end up with the Collections class which contains a copy method. ss I hav the following:: List<String> a = new ArrayList<String>(); a.add("a"); a.add("b"); a.add("c"); Lis...

Java ConcurentMap keySet() question when map is modified and iterating over keyset.

Quick background I have a concurrent map I used to cache some values that change quite often (still worth caching them from testing). I want to evict items from my cache at regular intervals by examining an expire time in the value. I am using the keySet() method to get a reference to all my keys and then check the values and if expired ...

Is Emacs useful compared to Eclipse programming Java?

When working in an actual development environment with other people, is Emacs still a valid IDE? I work with Eclipse with my co-workers, but I'm curious if there are any benefits whatsoever of using Emacs over Eclipse. ...

Do I need to worry about concurrency with tomcat spring beans?

Not quite understanding enough about java, do I need to worry about concurancy issues when listing, and changing DTO objects in my spring java beans in a single server tomcat application? ...

Eclipse JavaEditor extension: How to add a properly indented line?

What is needed? We are writing an extension to eclipse's JavaEditor. We need a way to add a line before and after the line the cursor is in. The cursor on the new line should be on the correct position (correctly indeted). Sample (# is the cursor): before (I): public class Test { public static void main#(String[] args) { ...

CXF without Spring

Hi there, Is it possible to use CXF with Tomcat and without Spring? ...

How to configure classloader for ear in websphere 6.1 (specifically wsdl4j)

I have a war file (actually not my own, it's Apache ODE 1.2) that fails to deploy into WAS 6.1 because of a classloader issue - and a specific incompatibility with wsdl4j. If I manually edit the classloader for ODE and create a shared-library for wsdl4j1.6.1 it's all fine. However, the client has come back stating this is not acceptable...

Java-based monitoring application

Hello,all. Imagine the next architecture: We have Java application over Spring framework (let's call it Manager). It accepts requests and can launch other applications to handle them (let's call them Containers). These Containers exists for a long time. They has rather complex structure and consist of several different applications, ...

Any suggestions on how to session proof a website?

This might be a very odd question, but some hints or guidelines will be very helpful. We want to "session proof" our web site, basically make sure that two different sessions generate the same link structure (e.g. Both user-a and user-b will get the same links in the same web page). The reason behind this test, is that our web site i...

Array Index out of bounds

This is what I'm trying to do: I'm reading a file in from the command line. The file contains a list of data,below this paragraph is what it looks like. The problem I'm having is with the if statements. import java.util.*; import java.io.*; public class VehicleTest { public static void main(String[] args) throws FileNotFoundExcepti...

Link Java textbox to string in external class

I am currently working on a project in which I have a Java GUI class and another class which contains its relevant methods. I want a text area in the GUI to be updated with the content of a string in the other class whenever it changes. What is the easiest way to watch for these changes? Cheers! ...

Make a application retrieve data from MySQL database.

I'm looking to make a application that shows something from a MySQL data base. They should go in Order according to which ever one is next. The user would set a time that the events should happen, along with a Name for it. Then, that information would go intoa a MySQL database and it will be shown along with the other events in the appli...

Tutorial on JPA mapping file

Is there a great tutorial on how to use JPA mapping file? Accompanying related source code for the mapping file would be great also. ...

Guaranteeing that a .NET WCF Service can be consumed by a Java client

I am creating a WCF Service that will be consumed by both .NET and Java client applications. We do not have any Java experience in the team, so are looking for guidelines or rules to follow to ensure that we do not accidentally include any types in our WCF Service interface or do anything else that would preclude it from being consumed ...

OpenGL, Java and memory management

When using openGL in Java (in bindings like jogl), do you have to worry about memory management? Does the JVM do garbage collection with the created openGL objects? If so, what's the best way to approach cleanup? ...