java

UI design alternatives with Groovy/JRuby/Jython or other JVM languages ?

For a developer in the Java eco-system, there is a handful of choices when it comes to UI design. The best known are: Swing (preferred when used with Netbeans and its GUI builder) Eclipse's SWT (mostly preferred for Eclipse plug-ins) Now, are there any frameworks or design alternatives to this which target JRuby / Groovy / Jython or ...

What are the relative advantages of XMLEncoder and XStream?

Suppose I want to store many small configuration objects in XML, and I don't care too much about the format. The XMLDecoder class built into the JDK would work, and from what I hear, XStream works in a similar way. What are the advantages to each library? ...

What is the best place to store a configuration file in a java web application (war) ?

I create a web application (war) and deploy it on Tomcat. In the webapp there is a page with a form where an administrator can enter some configuration data. I don't want to store this data in an DBMS, but just in an xml file on the file system. Where to put it? I would like to put the file somewhere in the directory tree where the appl...

Writing post data from one java servlet to another

I am trying to write a servlet that will send a XML file (xml formatted string) to another servlet via a POST. (Non essential xml generating code replaced with "Hello there") StringBuilder sb= new StringBuilder(); sb.append("Hello there"); URL url = new URL("theservlet's URL"); HttpURLConnection connection = (HttpURLCon...

What's the difference between | and || in Java?

Title says it all. It's been discussed for other languages, but I haven't seen it for Java yet. ...

What are the best books for Hibernate & JPA?

My team is about to build a new product and we are using Hibernate/JPA as the persistence mechanism. There are other book posts on stackoverflow, but I couldn't find one that matched my needs. My manager will be purchasing books for our team to use as a resource so... What are the best books about Hibernate and JPA? (Please list each...

Package naming conventions for domain object models

What are some good package naming conventions for domain specific object models. For example, say you have a Person.java POJO, would you put it in a mydomain.model or mydomain.entity or mydomain.om (object model) package. The idea is to separate the MVC model objects from the domain object model. Our MVC based application has a model...

ADF Business Components thru RMI Vs EJB and Toplink

I was wondering what the differences would be in implementing remote business logic. Currently we are planning on using ADF to develop front-end web apps (moving from Struts). We were wondering what the differences between the front end calling EJBs using Toplink vs ADF Business Components thru RMI in terms of scalability as the migratio...

Why use Jython when you could just use Java?

The standard answer is that it's useful when you only need to write a few lines of code ... I have both languages integrated inside of Eclipse. Because Eclipse handles the compiling, interpreting, running etc. both "run" exactly the same. The Eclipse IDE for both is similar - instant "compilation", intellisense etc. Both allow the use ...

What is the best way to encrypt a clob?

I am using Oracle 9 and JDBC and would like to encyrpt a clob as it is inserted into the DB. Ideally I'd like to be able to just insert the plaintext and have it encrypted by a stored procedure: String SQL = "INSERT INTO table (ID, VALUE) values (?, encrypt(?))"; PreparedStatement ps = connection.prepareStatement(SQL); ps.setInt(id); p...

Which software to use for continuous integration of a Java web project

We're in an early stage of a new web project. The project will grow and become complex over time. From the beginning we will have unit and integration tests using JUnit and system tests using HtmlUnit. We might also add some static code analysis tools to the build process if they prove to be of value to us. If you're or have been involv...

Comparing C# and Java

I learned Java in college, and then I was hired by a C# shop and have used that ever since. I spent my first week realizing that the two languages were almost identical, and the next two months figuring out the little differences. For the most part, was I noticing the things that Java had that C# doesn't, and thus was mostly frustrated. ...

Physical Address in JAVA

How do I get the physical addresses of my machine in Java. ...

Static Analysis tool recommendation for Java?

Being vaguely familiar with the Java world I was googling for a static analysis tool that would also was intelligent enough to fix the issues it finds. I ran at CodePro tool but, again, I'm new to the Java community and don't know the vendors. What tool can you recommend based on the criteria above? Thank you! ...

force Maven2 to copy dependencies into target/lib

Hi, How do I get my project's runtime dependencies copied into the target/lib folder? As it is right now, after 'mvn clean install' the target folder contains only my project's jar, but none of the runtime depencies. Thanks, Michael ...

Filter on current date within Castor OQL

I'm running the java cocoon 2 and castor oql. I'm trying to filter my oql query by today's date, but I can't seem to figure out (or find in google) the syntax of the date. The database is mySql, but the oql is mapped by the java classes... so doing a search on field_date >= Now() doesn't work. Any ideas? I really can't stand the limit...

OSCache vs. EHCache

Never used a cache like this before. The problem is that I want to load 500,000 + records out of a database and do some selecting/filtering wicked fast. I'm thinking about using a cache, and preliminarily found EHCache and OSCache, any opinions? ...

Which EJB 3 persisent provider should I use?

I are using EJB 3 on a fairly large J2EE project, by default with Netbeans sets the persistent provider for the entity beans to TopLink. There is the option to change the provider to one of the following or even add a new persistence library: Hibernate KODO OpenJPA Which persistence provider do you prefer to use? What are the benefit...

Can eclipse extract a second class in class file to its own file

I often refactor code first by creating an inner class inside the class I'm working on--When I'm done, I move the entire thing into a new class file. This makes refactoring code into the new class extremely easy because A) I'm only dealing with a single file, and B) I don't create new files until I have a pretty good idea of the name/na...

How do I parse a PHP serialized datastructure in Java?

I have a system that combines the best and worst of Java and PHP. I am trying to migrate a component that was once written in PHP into a Java One. Does anyone have some tips for how I can parse a PHP serialized datastructure in Java? By serialized I mean output from php's serialize function. ...