java

Match Calendar objects in Java?

I want to have objects that define partial dates / times similar to the entries in Unix crontabs, i. e. "every first day in any month" etc. These objects are going to be compared to Calendar objects to see if they match. I was about to write my own "TimePattern" class but it would have to contain a lot of logic like checking if the fie...

A tool like ReSharper, but for Java?

I have read a lot about ReSharper on here. It sounds like it has a lot of cool features to help the programmer out. Trouble is, I don't write C#. Is there any tool that has similar functionality to ReSharper, but for Java instead? Thank you! ...

javax.net.ssl.SSLHandshakeException: certificate expired - Local or Remote?

I am receiving the following exception while trying to make an SSL connection to a web service. Does this error mean my local keystore/certificate is expired, or is it that I cannot trust the remote server because it has the expired certificate? javax.net.ssl.SSLHandshakeException: certificate expired at com.ibm.jsse.bs.a(Unknown S...

How do I read the manifest file for a webapp running in apache tomcat?

I have a webapp which contains a manifest file, in which I write the current version of my application during an ant build task. The manifest file is created correctly, but when I try to read it in during runtime, I get some strange side-effects. My code for reading in the manifest is something like this: InputStream manifestStrea...

Running several instances of Netbeans RCP application simultaneously

Hello We have an application based on the netbeans rich client platform. Default behaviour is that only one instance of the software can run, and this can be overridden by specifying a different user-dir as argument when starting the application. Are there any alternatives to this? Our clients rely on being able to run several instan...

Is JRuby ready for production?

I just found out about JRuby, and I like the idea of running Ruby on Rails and being able to call Java libraries. I would like to know about some experiences with running enterprise production applications in JRuby. Are stability and performance acceptable? Thanks. ...

Where can I download JOGL?

I'm looking to start using Java Open GL, but I can't find it. ...

How do I run a batch file from my Java Application?

In my Java application I want to run a batch file that calls "scons -Q implicit-deps-changed build\file_load_type export\file_load_type" It seems that I can't even get my batch file to execute. I'm out of ideas. This is what I have in Java: Runtime.getRuntime().exec("build.bat", null, new File(".")); Previously I had a python Scons...

Changing locale at runtime in Swing

I would like to be able to change the locale in my Swing application at runtime and have all the text elements on the screen update themselves with localized text from a ResourceBundle of the new locale. Can this be done without customizing swing components or creating UIDelegates for all components that handle rendering localized text...

Can I map an EnumSet to a series of boolean columns automatically using Hibernate Annotations?

I have an EnumSet that I thought it would be good to map into a series of boolean columns. This will make it easy to inspect using SQL tools and also resilient to changes to the available enum values. However, I don't really want to hand-write all the getters and setters for this. Does anyone have a clever solution using some kind of ...

In JDBC, why do parameter indexes for prepared statements begin at 1 instead of 0?

Everywhere else in Java, anything with an index starts at 0. Is there a reason for the change here or is this just bad design? ...

TextMate source.java comment block folding

How do I modify the java language definition bundle foldingStartMarker and foldingStopMarker entries to allow for folding of these types of comment blocks? This is the comment style: /** * This is a comment... * Yet another comment... */ I've tried this: foldingStartMarker = '(\{\s*(//.*)?$|^\s*// \{\{\{|^\s*\/\*\*)'; foldingSt...

How to use ConcurrentLinkedQueue?

How do I use a ConcurrentLinkedQueue in Java? Using this LinkedQueue, do I need to be worried about concurrency in the queue? Or do I just have to define two methods (one to retrive elements from the list and another to add elements to the list)? Note: obviously these two methods have to be synchronized. Right? EDIT: What I'm trying t...

Best match in C# to Java ReentrantLock and Condition?

Another cross-language question: can someone tell me what C# Threading constructs best match the Java ReentrantLock and Condition classes? ReentrantLock has lockInterruptibly() and unlock() methods, while Condition has signal() and await() methods. It is this combination that I would like to be able to preserve in the C# code - or some...

On-the-fly, in-memory java code compilation for Java 5 and Java 6

How can I compile java code from an arbitrary string (in memory) in Java 5 and Java 6, load it and run a specific method on it (predefined)? Before you flame this, I looked over existing implementations: Most rely on Java 6 Compiler API. Those that don't, rely on tricks. Yes, I checked out commons-jci. Either I'm too dense to understa...

Correct: Java "enterprise" edition = Java "internet" edition?

I am reading books on middleware, Spring, Hibernate, etc., and am wondering myself why the developer invented a new name, i.e. "enterprise edition" for Java "web" or "internet" libraries? As I have a quite individual mindset, "enterprise" edition sounds almost like "socialist" edition... what do I need to know to differentiate better? ...

Is HttpSession thread safe, are set/get Attribute thread safe operations?

Also, does the object that is being set have to be thread safe in order to guarantee that we know what the state of the object stored in session is known. Also, I was reading on the web that some suggest using: synchronized(session) { session.setAttribute("abc", "abc"); } Is this a valid suggestion? ...

java interface extends questions

For my assignment I have to implement an RMI server which will a front end for two other RMI services. So I decided a logical thing to do would be to have the interface for this implement the interfaces for the other two services. public interface FrontEndServer extends Remote, BookServer, StudentServer { // Block empty so far } ...

How to close command windows with Java

Each time I use Runtime.exec("cmd /c start....") I am opening a cmd window. I would like to create a more seamless application by closing each previous cmd window. How can I do this? If anyone knows of a better way to run a series of commands in the same cmd window rather than opening new ones each time I execute a command, please let m...

private string member what to initialize with

In Java what is the best practice of initializing the private string members class A { private String mem = ??// private int num; A (int a) { this.num = a; } A (int a, String s) { this.num = a; this.mem = s; //What if s is null (Is this a good practice) } } ...