java

Good Java community and resource

I've just started learning Java as part of my uni course, and am so far really liking it. I did a quick search to try and find a Java Community online, but haven't really had any luck. I was looking for something along the lines of gotoandlearn.com and www.kirupa.com like the flash communities have. Can anyone recommend a good starting...

Which SOAP XML object serialization library for Java would you recommend?

Which Java SOAP XML object serialization library would you recommend for Java object exchange with other platforms / languages (.NET, Delphi)? Communication scenarios could look like this: Java object writer -> SOAP XML text -> .NET or Delphi object reader .NET or Delphi object writer -> SOAP XML text -> Java object reader I know th...

Is it good to use printStackTrace() in swing program?

Hi, I'm developing a small swing application, and I'm not sure if I should use the printStackTrace(). If I get an exception I show a user via JOptionPane a message, e.g: file not found etc. But at the same time, I'm using the printStackTrace(), I wasn't sure about neither showing the stack trace to a user nor not to print anything...ju...

Create Weak Multimap with Google Collections

Is there an equivalent to the nice MapMaker for MultiMaps? currently i create the cache like this: public static Map<Session,List<Person>> personCache = new MapMaker().weakKeys().makeMap(); the whole point of MultiMap is to avoid the nested List Values. is there any way to construct the multimap with weak keys? ...

Strange behaviour when accessing Oracle 8i table from servlet

Hi there, First a little background, I'm using jdk 1.6. I've got a 2 column table in an Oracle 8i DB that holds a very simple code to word map. There are no strange characters. Both columns are varchar. From my desktop machine, when I execute the the following: OracleDataSource ods = new OracleDataSource(); ods.setDri...

Persist java.util.Properties as serialized object using JDO/DataNucleus

The Google AppEngine docs say that I can persist serializable objects using JDO like so import javax.jdo.annotations.Persistent; import DownloadableFile; // ... @Persistent(serialized = "true") private DownloadableFile file; but if I use it with Properties @Persistent(serialized="true") private Properties initProps; I get Data...

Struts2 Tiles run time error

I am developing simple struts2 tiles integreated application. For that i have written the code for struts.xml, tiles.xml & layout.jsp files. That all code are so long that i have put it here When i am executing this application i am getting following error : No configuration found for the specified action: 'helloWorld' in namespace: ...

Two-way relation in JPA

Hi I have the two entity classes, User and MyCharacter. User has a list of MyCharacters and each MyCharacter has a reference back to the User (owner). What I'd like to accomplish is, that I use the same join table for both relations, meaning, that the owner relation found in MyCharacter would automatically use the same join table as fro...

Java - list of objects to list of single property attributes

I have the ViewValue class defined as follows: class ViewValue { private Long id; private Integer value; private String description; private View view; private Double defaultFeeRate; // getters and setters for all properties } Somewhere in my code i need to convert a list of ViewValue instances to a list containing values of id fiel...

Should I use DataInputStream or BufferedInputStream

I want to read each line from a text file and store them in an ArrayList (each line being one entry in the ArrayList). So far I understand that a BufferedInputStream writes to the buffer and only does another read once the buffer is empty which minimises or at least reduces the amount of operating system operations. Am I correct - do I...

Why does Java main() method accept an array of String args?

Since its possibly one of the most widely used methods of the Java language, why does it have to accept an array of Strings and doesn't work without it? For example, I could always live with: public static void main() {} over public static void main(String[] args) {} Is there a higher purpose to this than just being able to accept ...

Free utility which runs in Linux to create a UML class diagram from Java source files

I prefer to jot down UML-diagrams on paper and then implement them using Java. It would be nice to have a utility which could create UML-diagrams for me which I may share on-line and include in the digital documentation. In other words: I want to create UML diagrams from Java source code. The utility must be able to: Run in Linux. Han...

What jar should I include to use javax.persistence package in a hibernate based application?

Is it ok to take it from Glassfish project ( glassfish-persistence-api) or may be there is a Hibernate jar? ...

Make URL Request from Servlet and retain Header information

I need to make a request from a servlet but I also need to retain all the header information. That is in the request object. For example, I if I do something like the following from the doGet method, is there a simple way to just pass that information to the URL Connection object? URL url = new URL(); URLConnection uc = url.openConnec...

MSXML parser in Java

Hi: Our application is written in VC++ and we are using MSXML for parsing. Now we want to pass MSXML document object from our application to a java application for processing. How can I achieve this? Does java (swing) support MSXML or MSXML objects? We are using DOM parser. Any help appreciated, Thanks, KK ...

Where can I find a set of Java test programs with injected errors?

I need some fairly simple Java test programs with injected errors in order to test something I'm working on on them. Edit: By "injected errors" I mean broken algorithms, errors that may cause the program to crash, and so on... Edit2: I'm making something that tries to give some hints to the programmer about the cause of the error, so t...

Java annotations

I've created simple annotation in Java @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface Column { String columnName(); } and class public class Table { @Column(columnName = "id") private int colId; @Column(columnName = "name") private String colName; private int noAnnotationHe...

How to make a Java client for a WCF service secured with X.509?

I have a WCF service that uses X.509 certificates for authentication. What's the best method of creating a Java client that can use that service? I've heard of Axis, CXF, Tango, and WSS4J, but I'm not sure which supports X.509 and which one is a good way of working with WCF. ...

What's the best way to tell a framework which database to use?

With Java, I'm trying to implement a client-server scenario; both are using the same model and both are using the same framework. Obviously, I want the framework to be independent from the model and applications, but it must know who is using itself and consequently, which database to use in the other end. What is the best and simplest...

Please help with my JSP Internationalization problem

I have problem with I18N in JSP, specifically, with forms. When I enter some Czech characters (e.g., "ěščřžýá...") into my page one form, into the field "fieldOne", and then show text from that field on page two, instead of Czech characters I see this as "čč". (Note, the second page gets the Czech characters with "request.getProperty...