java

Trouble getting Hibernate Core and Hibernate Annotations using Apache Ivy (but it's also Maven2 related.)

It's a long one! ;-) There are a lot of copy pasted text in this question which makes it look complicated. And to be honest, it's a lot of information! However to an experienced person a lot of it might be unnecessary and easy to skim over. In its essence I'm only wondering why my basic Hibernate Core + Hibernate Annotations test proje...

Split Java String in chunks of 1024 bytes

What's an efficient way of splitting a String into chunks of 1024 bytes in java? If there is more than one chunk then the header(fixed size string) needs to be repeated in all subsequent chunks. ...

Java and .NET heap overhead

I have understanding how heap and garbage collector works: garbage collection happens in generations, memory allocation happens sequentially, during garbage collection free/unused space compacted by shifting data and forming continues block, etc. Is there any headers for allocated memory chunks are present and how big are they (I heard...

Using SHA1 and RSA with java.security.Signature vs. MessageDigest and Cipher

I'm trying to understand what the Java java.security.Signature class does. If I compute an SHA1 message digest, and then encrypt that digest using RSA, I get a different result to asking the Signature class to sign the same thing: // Generate new key KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair(); PrivateKey pri...

Examples of good Java desktop applications

More of a wiki list/collection, I'm looking for a list of good Java desktop apps. I've added a couple below to get started. Please list the framework/widget toolkit being used if it's know as well. ...

What do you use for a complex build process?

I am trying to revamp our build process, which is currently a gigantic Ant build.xml that calls into other ant build files and executes several Java classes to perform more complex logic that would be impossible/scary to attemp in Ant. Background: experience in Java and Ant, some Groovy Windows platforms Goals: run as a combinatio...

A Java collection of value pairs? (tuples?)

I like how Java has a Map where you can define the types of each entry in the map, for example <String, Integer>. What I'm looking for is a type of collection where each element in the collection is a pair of values. Each value in the pair can have its own type (like the String and Integer example above), which is defined at declarati...

Java Menu Mnemonics in Resource Files

I would like to assign a mnemonic to a JMenu using resource bundles (or the ResourceMap). So for example, the code without resource file would be... JMenu fileMenu = new JMenu(); fileMenu.setText("File"); // this would be read from a resource file fileMenu.setMnemonic('F'); // but the docs say this is obsolete fileMenu.setMnemonic(Ke...

Edit existing excel files using jxl api / Apache POI

Hi All, I am interesting and would like to learn more on java , how write into existing excel sheets / manipulating the existing data. I was wondering if you could give me an idea on how to edit an existing excel file and saves it using the jxl api / Apache POI or perhaps give me a sample program on how to edit some data in an existing ...

Duplicate set of columns from one table to another table

My requirement is to read some set of columns from a table. The source table has many - around 20-30 numeric columns and I would like to read only a set of those columns from the source table and keep appending the values of those columns to the destination table. My DB is on Oracle and the programming language is JDBC/Java. The source...

How can I convert a XML file into a XSD file, using java code ?

Hi, I am looking for an API what I can convert XML files into XSD files. In my project I am using that API's JDOM and Xerces. And I can edit my attributes and namespace, but I can't transform a xml in xsd. I have no idea to how I can start. Any suggestion? ...

Why should I learn C#?

I want to know why I should learn C#? What features does C# have that Java does not? ...

When and why would you use Apache commons-digester?

Out of all the libraries for inputing and outputting xml with java, in which circumstances is commons-digester the tool of choice? ...

object is to class as enum is to ...?

object is to class as enum is to ...? I'm using C# but I'd like the answer for Java as well, if there is one. Thank you, as always. ...

Are there good Java libraries that facilitate building interactive shell-style applications?

I need to write a simple shell-style application in Java. It would be nice to use a library that takes care of parsing commands and takes care of things like flags and optional/mandatory parameters... Something that has built-in TAB completion would be particularly great. ...

How to load third party libraries (like X11 libs) through code in Java?

Whenever JVM fires up, i.e when java command is run; it looks for other libraries in /java/jre/lib folder. These libraries along with the third party libraries like X11 libs, are loaded into the memory by the system's dynamic loader (like dld.so in HP Unix). So is it possible to load third party libraries from code in java? If yes, what...

Implementing support for nested transactions using JDBC 3.0

Hi all, our legacy application uses JDBC 3.0. it supports transactions by implementing its own transaction manager that is capable of returning the same JDBC connection for each thread. The problem I recently discovered is that it doesn't support nested transactions: if a transaction is started inside an another transaction, then every ...

The XML code runs properly, but junit fails with NoClassDefFound

I am upgrading my environment from eclipse 3.3.1 and java 1.4 to eclipse 3.4.1 and java 1.5. My unit tests are in jUnit 3. eclipse java version 1.5.0__17 stand alone env version 1.5.0__12, or 1.5.0-17, both work. I have a method on a class that writes an XML file to disk. It calls TransformerFactory tf = [javax.xml.transform.]Transfor...

Is it possible to obtain a web-browser's Java VM without using an applet?

We have an ages old Java applet that we want to move forward to a newer version of Java (5 or 6), however until today we've always supported people using Java VMs as far back as version 1.1 (specifically for those still using the Microsoft VM) As part of the upgrade, we'd like to be able to serve a web page to people using out-of-date V...

What are some additional directory conventions for Maven projects?

Maven 2 uses a standard directory layout for projects, documented here: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html What I'm wondering is: are there recommended conventions for other projects besides the plain-vanilla Java library, JEE and WebApp projects? Specifically, where to place...