java

will serialized object contains metadata?

When we are deserializing an object, its very difficult to understand that, how it is retriving the object in some certain state? Does it contain any Meta data of the object? ...

How to convert a date String into the right format in Java?

Can somebody please explain to me how I can convert 2009-10-27 14:36:59.580250 into 27.10.2009, 14:36 ? The first date is available as a string and the second one should be a string as well ;) Up to now I'm not so into date conversion within Java... Thanks in advance! ...

Non-blocking I/O versus using threads (How bad is context switching?)

We use sockets a lot in a program that I work on and we handle connections from up to about 100 machines simultaneously at times. We have a combination of non-blocking I/O in use with a state table to manage it and traditional Java sockets which use threads. We have quite a few problems with non-blocking sockets and I personally like...

How to Find Default Charset/Encoding in Java?

The obvious answer is to use Charset.defaultCharset() but we recently found out that this might not be the right answer. I was told that the result is different from real default charset used by java.io classes in several occasions. Looks like Java keeps 2 sets of default charset. Does anyone have any insights on this issue? We were abl...

how to mime type of the url

Hi , I am using cxf as a webservice.It supports xml and json format output of the requested data.I want to know that if some exception has occured in my code then i want to return him back the error code either in xml or json format.But i dont know when to give json and xml ,it depends on the requested url that user has asked. example ...

How to read OSX .plist files from Java?

How to read OSX .plist files from Java? Thank you in advance! ...

what is counterpart for ejb in dot net?

hey i have to migrate a project written in java 1.4 with ejb 2.0 to dot net 3.5 in c#.What i counter part for ejb model in dot net framework? ...

Rapid switch to Java for an experienced C++ developer

I'm am looking for online tutorials/books, which assume a solid knowledge of OOP/Design patterns concepts and stress on differences (both conceptional and syntactical) between C++ and Java thus allowing for a rapid development in the latter. Thank you very much in advance, appreciate your time. ...

Lightweight Java database with Maven plugin for starting/stopping?

For unit tests, demonstrations and Hibernate tasks I would like to use a small and simple Java database like Derby / Java DB or HSQLDB, which can be called from within Maven. So far I have not found a Maven plugin which can download and launch Java DB (which is my favorite at the moment) or something similar. ...

How to hide interface methods in the web service when using @WebService's `endpointInterface` attribute?

Is there a way to prevent a method from an interface used in @WebService's endpointInterface attribute to be exposed in the web service? I'm using the endpointInterface as that seems to be the only way to make the service work on JBoss with Metro, not doing so results in a: javax.xml.ws.WebServiceException: Undefined port type ...

How can I use hibernate with MS Access?

I want to use hibernate with MS Access. Which dialect should I use and can you give me a sample hibernate configuration file with MS Access? ...

Persisting a GWT Visualization API DataTable

What's the correct way to go about persisting a GWT Visualization API DataTable? Should I find a way to serialize the DataTable object or should I write the table cell by cell to a relational database? I'm trying to build a RIA using the GWT-MVP pattern described here http://blog.hivedevelopment.co.uk/2009/08/google-web-toolkit-gwt-mvp...

Are empty abstract classes a bad practice, and why?

We have several empty abstract class in our codebase. I find that ugly. But besides this very stupid reason (ugliness), should I refactor it (into empty interface e.g.) ? Otherwise, the code is robust and well tested. So if it's only for a "aesthetic" reason, I will pass and let the empty abstract classes remain. What do you think? ED...

AntClassLoader cannot be cast to URLClassLoader

I have an Ant task to compile jsp files with Jasper. The first step is generate the java files: <java classname="org.apache.jasper.JspC" fork="no" failonerror="true"> <classpath refid="my.class.path" /> <arg value="-uriroot" /> <arg value="${apps}" /> <arg value="-d" /> <arg value="${jsp}" /> <arg value="-p" /> ...

Java problem - getting errors related to Mockito

Hi, I'm using the Mockito library for Java testing and getting errors in Mockito when I run my test. (I'm using the NetBeans IDE, in case that's relevant). For example, I have a class called Animal and I am trying to perform the following simple test: @Test public void mokito_test(){ Animal mockAnimal = mock(Animal.class); An...

Java Domain Objects

Possibly a simple (read dumb) question. I am in design phase of a web application - standard Spring MVC and planning on using Spring DAO support (jdbctemplate - no hibernate & no ibatis etc). I am currently modeling my data objects for the RDBMS. What is the best practise for data types? Let's say my primary key of a table is Numeric - ...

unresponsive java application for no reason

I have a java application that I run from eclipse 3.5. My OS is WinXP(SP2) and the JRE version is 6.05. I run the application on two identical computers (or so I think) but the application behaves differently on each computer. The computers are the same Dell Optiplex model with the same amount of memory and have the same GPU. On the ...

Proper way to declare and set a private final member variable from the constructor in Java?

There are different ways to set a member variable from the constructor. I am actually debating how to properly set a final member variable, specifically a map which is loaded with entries by a helper class. public class Base { private final Map<String, Command> availableCommands; public Base() { availableCommands = Helpe...

how to covert dialogic adpcm vox to wav in java

Need to convert vox files (dialogic adpcm) to wav ones. Do you know java solution? ...

osgi-like framework without the import/export restrictions?

I like OSGi, but the import/export restrictions and the lack of context class loader creates havoc when trying to use 3rd party libraries (e.g., some libraries try to find file.xml in META-INF, expecting for all such files in all jars to be returned, other libraries use ServiceLoader). I want OSGi's dynamic loading, ability for handling...