java

Is it possible to compile a Rails app to a Java VM JAR file?

Essentially the only thing I can deploy to my deployment machine is a JAR file. I can't install JRuby, nor can I install Glassfish or Tomcat. Is it possible to package up a Rails application (including Rails, vendored, of course) to a JAR file such that I can do c:\my_server> java rails_app.jar and have it run WEBRick or Mongrel wit...

Difference between int[] array and int array[]

Hello. I have recently been thinking of the difference between the two ways of defining an array: int[] array int array[] Is there a difference? I havent found anything in my Java book explaining me the difference and googling the question isnt bringing me any closer... I just dont know what to google after. Thanks ...

Formatting Timestamps in Java

Is there a way to format a UTC time into any arbitrary string format I want in java? Basically I was thinking of having some class take the timestamp and I pass it is string telling it how I want it formated, and it returns the formatted string for me. Is there a way to do this? ...

Getting Spring Application Context

Is there a way to statically/globally request a copy of the ApplicationContext in a Spring application? Assuming the main class starts up and initializes the application context, does it need to pass that down throw the call stack to any classes that need it, or is there a way for a class to ask for the previously created context? (Whi...

Why no static methods in Interfaces, but static fields and inner classes OK?

There have been a few questions asked here about why you can't define static methods within interfaces, but none of them address a basic inconsistency: why can you define static fields and static inner types within an interface, but not static methods? Static inner types perhaps aren't a fair comparison, since that's just syntactic suga...

JavaScript or Java String Subtraction

If you are using Java or JavaScript, is there a good way to do something like a String subtraction so that given two strings: org.company.project.component org.company.project.component.sub_component you just get sub_component I know that I could just write code to walk the string comparing characters, but I was hoping there was a ...

Java: Serializing a huge amount of data to a single file

I need to serialize a huge amount of data (around 2gigs) of small objects into a single file in order to be processed later by another Java process. Performance is kind of important. Can anyone suggest a good method to achieve this? ...

Problem using JConsole remotely with JBoss 4.2.2 with app that uses JWS

I am trying to set up JBoss 4.2.2 and JConsole for remote monitoring. As per many of the how-to's I have found on the web to do this you need to enable jmxremote by setting the following options in run.conf. (I realize the other two opts disable authentication) JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=11099" JAVA_OPTS...

<ProjectName.ProjectUI sucks as a name for my Netbeans java OS X app.

What property in Netbeans to I need to change to set the name of my java swing app in the OS X menubar and dock? I found info.plist, but changing @PROJECTNAMEASIDENTIFIEER@ in multiple keys here had no effect. Thanks, hating netbeans. ...

How can I convert a JTS-Geometry into an AWT-Shape?

Is it possible to convert a com.vividsolutions.jts.geom.Geometry (or a subclass of it) into a class that implements java.awt.Shape? Which library/method can I use to achieve that goal? ...

How to call Java code from C# ?

We've developed a Java application and would like to use this application from a C# client. The application has dependencies on Spring, Log4j, ... What would be the most efficient mechanism - make DLL(s) from Java code, ... - to achieve this ? ...

Best server Performance Monitoring Tool for Java Servers

At work, we are trying to combat the monstrosity that our application servers have become - we are now running out of server resources after many months of resource-creep. I would like to begin the process of finding out what to investigate by seeing what people think the best server monitoring tools are. Specifically, I'm interested...

Most useful free third party Java libraries?

I've never seen a good list of free Java libraries. What are some of your can't-live-without Java libraries? Note: to keep this poll as useful as possible, please remember: Post only one library per answer We don't want duplicate answers, so before posting check if the library has been mentioned already When adding a new library, pro...

Really Young Software Architect Question

Hi, I am a really young software engineer/QA Team leader. I have been developing software for about 2 years and for 1 of those years I have also been the head of the QA team at a software development company. Currently I am still working as the QA team leader/software engineer for QA tools. Recently I have been invited to join a grou...

How many threads should I use in my Java program?

I recently inherited a small Java program that takes information from a large database, does some processing and produces a detailed image regarding the information. The original author wrote the code using a single thread, then later modified it to allow it to use multiple threads. In the code he defines a constant; // number of thr...

Can PHP handle enterprise level sites as well as Java

PLEASE NO FLAMING! I really would love a few objective opinions about the issue. I have a project that has been strongly developed in PHP but have clients that are concerned that Java would be a better solution. I know sites such as Flickr and Digg are run on PHP, but I am concerned that PHP's lack of a running environment may destroy ...

How can I provide customer error messages using JAXP DocumentBuilder?

I want to provide my own message from the validation done in DocumentBuilder, rather than the one from XMLMessages.properties. Now i see that a property error-reporter needs to be set to a class which extends XMLErrorReporter. However, I've not been able to get ComponentManager from Document/Builder/Factory. Can any kind soul gimme co...

Migrations for Java

I use both ruby on rails and Java. I really enjoy using migrations when I am working on a rails project. so I am wondering is there a migrations like tool for Java? If there is no such tool is it a good idea to use migrations as a tool to control a database used by a Java project? ...

Streaming large result sets with MySQL 4.1.x + Connector/J

I’m trying to get a large result set to stream and having no luck. The MySQL docs are somewhat unclear as to whether this should even work. E.g.: When using versions of the JDBC driver earlier than 3.2.1, and connected to server versions earlier than 5.0.3, the setFetchSize() method has no effect, other than to toggle result set streami...

Web Log analysis in Java

Hello all, How to read a web server log file in Java. This file is getting updated all the time. If I open a new FileInputStream, will it read the log real time? Regards ...