Questions for java


Cassandra sstable2json not working in 1.0

I am beginning to experiment with Cassandra. I am trying out the sstable2json backup tool and it dies with an exception. I do:

Getting ant to put dependent jars in ./lib

I do I get ant jar task to put the dependent jars in the directory ./lib inside the jar? Currently, ant puts those in ./.

Unable to create folder “classes” in WEB_INF folder in eclipse while building using ANT

I am using ANT to build a simple web application project named "HelloWebApp" in eclipse. But while using ANT to build the build.xml file I am getting the following error.

Overriding application server behaviour for loading jsp-api and servlet-api jars in a packaged web application

I have a project built and packaged with a specific version of jsp-apiand servlet-api jar files. Now I want these jars to be loaded when deploying the web project on any application server for exam...

Using Thread with paint java

I'm developing a checkers game in Java, and I stumbled on a problem.

How do I set the size of a printed page in java?

I have written a program that uses the Java print API to print pages from a printer. I believe I have put in code to set the page size to letter, but it still prints on whatever size is default for...

repeat all columns multiple times in jasper report

I have a requirement like the following but can't solve it and that's why I am here. I hope someone can help.

Android connecting server, how do I stop the socket after a certain amount of time?

I'm developing a personal android application used at home for my own functionality.

javax.jms.JMSException: MQJMS2002: failed to get message from MQ queue

I have a asynchronous JMS receiver coded thus (obvious details missing):

Java SAXParser - keep InputStream open

I've a BufferedInputStream from which I want to parse XML with SAXParser but then reuse it again (eg. mark(int) & reset()). However this stream is closed in parse() method. Is it possible to so...

Java Regex: Replace character unless preceded by other character

I am using Java and Regular Expressions and need to split some data into multiple entities. In my input a single quote character (') specifies an end of entity UNLESS its preceded by the escape cha...

Findbugs, PMD or Checkstyle rule to find access by a field

I have a class caches a set of values internally. These values can be updated periodically and the cached contents will be updated appropriately. As long as users of this class do something like...

Efficient data structure for a record consisting of a tuple and its value

I want to store sort of a tuple and a value as an entry. I mean something like this

Which Java object type (collection/list/set/whatever) do I want for this?

I want to store a collection of objects that are keyed based upon a value they represent. These keys can be repeated. e.g.:

Create DAO for existing CSV file

given is an existing CSV file with the following example structure/content:

Native Swing Menu Bar Support For MacOS X In Java

A link that stands out is however the menu bar under Mac OS X displays as the package name as opposed to the

Import eclipse project with other package name ? - Eclipse / Android

I have project in eclipse (done app). Now I want copy this project, but with other package name.

CSRF: Generate token for every request

Right now, we have csrf token per session. And adding this token jsp's using hidden field. following snippet gives only one per session:

Is it possible to use AND, OR condition in tag IF?

contrib It's possible to check more condition in tag IF?

Writing a large XML file with Out Of Memory Error Java

I am developing an app for android, I need to create a rather large XML file.

How to activate ENSIME editor for Emacs in MacBook

Iam new for emacs ... installed emacs for macbook and installed the ensime plugin, i cant follow the steps as provided in the ensime site, can anyone help me by citing any wiki or blogs which has s...

javax.mail not including Sender Name in emails

No matter what I try, I can't get the Sender Name to show up in the outgoing mails sent through the javax.mail Session class.

How to get email addresses of all users in liferay

I want to get email addresses of all users in liferay...

how to reference a file of higher hierarchy in a java servlet project

i'm trying to implement a basic mvc pattern for a java web app project in netbeans. i have the deployment descriptor (web.xml) correct but i can't seem to redirect to the correct jsp from the java

Efficient algorithm to find all the paths from A to Z?

With a set of random inputs like this (20k lines):

Java Class Loaders Hierarchy

There is very good article on class loading. But this opens many questions in my mind.

Android rss unable to parse XML with attribute

Document doc = getDomElement(response); // getting DOM element

To separate Integer and String ArrayList from Object ArrayList

I have an arraylist containing Objects. I have two different arraylists, one containing strings and the other integers. Now I need to get the strings and integers rom the parent list and put it in ...

Jface: custom FieldEditor bad layout

I'd like to create a custom FieldEditor for a preference page. the aim is to override ScaleFieldEditor to provide a Scale with two labels over it (one to display the min value, the other to display...

Can I null-check in-line?

I have a Java command that looks something like below:

How can I extract java exe to jar

I have an exe that I know was written in java. I understand that java programs can be made into an exe and there are tools to convert jar files to exe but is it possible to convert back? AFAIK jar ...

mutual exclusion using Hashtable of java

hi mate i have a global Hashtable in my class, and two thread A and B that work with her.

setListAdapter within MainActivity

Hi I'm trying to get my listview to work with json and in my MainActivity. I have an error on my onPostExecute(string result) method. It gives me the following error: "The method

How to recover when server socket exits from listening

In this application I have a server socket which waits for clients to connect. My problem is when there is a runtime exception while listening socket exit from listening. So clients cannot connect ...

Properties of a java for loop

Consider a simple java for loop:

Hibernate: Multiple FK relationships

I'm kinda stuck defining a Hibernate Entity:

Linkage problem with Amazon AWS Java SDK and Grails

When trying the following snippet in a grails 1.3.5 app (you can test this through the console)... :

How I can use threads to generate terrain based on camera position without bursts of lag?

Here's the deal. My game generates chunks of randomly generated terrain based on the position of the camera (2D isometric). When moving from chunk to chunk, there is always a tiny burst of lag which

Hibernate basic configuration in Spring 3 project - Class not found exception

I'm trying to set up Hibernate 3.6 in my existing Spring 3 MVC + Spring 3 security project. Nevertheless I keep getting java.lang.ClassNotFoundException in my HibernateUtil class - line with return...

How to see which JVM an executable Jar is using?

The project uses a dll which has to be copied to JVM_HOME/bin directory. From the IDE the application works fine (the dll is copied in JAVA_HOME/jre/bin) but when I try to run the application direc...

How can i get 64 bits of the fractional part of the square root of a number in java?

How can i get 64 bits of the fractional part of the square root of a number in java?

Creating a generic array instance in a generic method

I'm trying to build a helper method to turn the two line list to array conversion into a single line. The problem I've ran into is that I'm not sure how to create a a T[] instance.

Google Maps API Android - Error inflating class fragment

I know that there are many topics on StackOverFlow regarding this problem, however none of them could help me.

Getting back specific lower bounds value from inputted key in LinkedHashMap

I have an LinkedHashMap that uses the values from a char array as its key adds integers 1 to the size of the char array as its values:

Java String Comparison with html tags

I have two Strings as follow: