java

Java Refuses to Start - Could not reserve enough space for object heap

Background We have a pool of aproximately 20 linux blades. Some are running Suse, some are running Redhat. ALL share NAS space which contains the following 3 folders: /NAS/app/java - a symlink that points to an installation of a Java JDK. Currently version 1.5.0_10 /NAS/app/lib - a symlink that points to a version of our applicatio...

In Java, is there a way to obtain the command line parameters even if main() didn't save them?

We have a program with a main() that parses certain CLPs but does not save them anywhere. I then have my own plug-in code that needs access to the original CLPs (so I can transmit more parameters) for it. However, I cannot change main() I saw that there is apparently a way to do this in C#, I'm looking for an equivalent Java solution o...

What does this statement mean?

I am a beginner in Java and do not understand what if(!s.add(a)) means in this code excerpt: Set<String> s = new HashSet<String>(); for(String a:args) { if(!s.add(a)) System.out.println("Duplicate detected:"+a); } ...

64 bit java app to use 32 bit dll

A Java app running under JBoss (using 64 bit JRockit) needs to communicate with a third-party 32 bit C++ dll (doing calls to an external service). Are there more clever ways to solve this than putting a .NET web service between the two? ...

Adding a number of days to a JodaTime Instant

I'm trying to write a simple utility method for adding aninteger number of days to a Joda time instant. Here is my first stab. /** * Adds a number of days specified to the instant in time specified. * * @param instant - the date to be added to * @param numberOfDaysToAdd - the number of days to be added to the instant specified * @r...

monitoring java memory usage

We have a j2ee application running on Jboss and we want to monitor its memory usage. Currently we use the following code System.gc(); long usedMB = (rt.totalMemory() - rt.freeMemory()) / 1024 / 1024; logger.information(this, "memory usage" + usedMB); This code works fine. That means it shows memory curve which corresponds...

how do I make a select which always returns zero rows

I want to determine if a column exists in a table for any jdbc driver. In order to know the columns in a table, I have to make a query to the table and then get the ResultSetMetaData for the info, but this is pretty expensive in like 99% of times. In mysql I have: SELECT * FROM tablename LIMIT 0,0 In Intersystems caché I have: SELEC...

Counting the number of occurrences of each item in a list

I have a streaming input which has repeated values. I can use any data structure but I have to count the number of occurence of each element. Suppose I have a list of mobile phone suppliers like the following: Apple Nokia Samsung Apple LG Nokia HTC Android Apple Nokia Nokia Apple Samsung I have to build any data structure preferably ...

What is the Iterable interface used for?

I am a beginner and I cannot understand the real effect of the Iterable interface. ...

Is it possible to access the Mac Address book API from pure Java?

Just wondering if it is possible to access the Mac OS X Address Book API's from pure Java 6 code? I want to keep this completely platform independent as my program is built for Windows & Linux also (open source & free: http://jsmsirl.sourceforge.net/). Any help is much appreciated! ...

activemq No suitable Log constructor

this is driving me insane. I'm simply trying to run activemq on Mac OSX 10.5.7. I have java version 1.5.0_19 and activemq 5.2.0. Below is the exception I get when running bin/activemq. It seems to be unable to find log4j which is odd considering it comes with activemq and is definitely in the lib/optionals directory. The only thing ...

Maven dependencies jar not usable

EDIT: I am basically running into the following documented issue. I am using the maven assembly plugin to generate a jar file that includes my dependencies so that my project can be run from a single file. However, the jar file is not being built properly it seems. The below was an attempt to try and work around the issue. Has anyone ru...

What clustering solutions are available in .NET?

As a kind of follow on to this question, what specific services are available for .NET that allow clustering in .NET similar to what is available in (Session) EJBs. The answer to the other question focused on the remote method invocation and transaction management of EJBs, but what about clustering for fail over and scalability purposes?...

How can I emulate a COM port, write data to it and read data from it?

I'm trying to test my code that reads from a USB port (COM25 when the device is connected) that is created when a device is connected to my computer and to a boat. I cannot power the USB device when not on the boat so testing is difficult. Can someone let me know how to simulate a COM port and write data to it so my test program is able ...

Distributed Lock Service

Which distributed lock service would you use? Requirements are: A mutual exclusion (lock) that can be seen from different processes/machines lock...release semantics Automatic lock release after a certain timeout - if lock holder dies, it will automatically be freed after X seconds Java implementation Nice to have: .Net implementation...

A new version of Netbeans just came out. Is there anything I can do to avoid having to manually hunt down my plugins again?

6.7 is out, and although going to the web and finding some .nbm-s and copying over a few update center URL-s isn't the biggest chore...it's still a chore. Any tips for this? Is there maybe a hidden directory somewhere that I can just copy into the new 6.7 install? Edit: for people like me who use both, I've asked this question in Ecli...

A new version of Eclipse just came out. Is there anything I can do to avoid having to manually hunt down my plugins again?

Galileo came out the other day, and even though plugins under Eclipse are, IMO, just a little bit easier to deal with than Netbeans, it would still be really awesome if there was a simple way for me to upgrade to the new version (and take my plugins with me). Any tips? ...

Is there an accurate way to determine the difference in nanoTime between two Java processes?

We have a few processes in Java that use nanoTime for internal benchmarking (since that is supposed to be accurate within the same thread). The processes can communicate between themselves. Is there a standard way of determining the difference in nanoTime between the threads? (e.g., mimic NTP?). Should this be done regularly? ...

What are my free and/or open source options for decompiling class files and JARs?

I'm familiar with JAD, and haven't found anything newer or better, but I really didn't look that hard because I had previous experience with the JAD tool. However, I might have missed some really good options out there. Did I miss anything good? If so, what is it and what features does it have in comparison to JAD? ...

Get Internet Explorer Script Error when i call selenium.waitForPageToLoad

This is v. frustrating. I get Internet Explorer Script Error modal dialog when i call selenium.waitForPageToLoad(). Below is a snippet of the command sequence. ... type(short_desc, IE6.0 -- Testcase:SimultaneousEditingConflictDetected... click(component) select(component, place holder) click(commit) waitForPageToLoad(60000) ... I turne...