java

Java: unparseable date exception

Hi, While trying to transform the date format I get an exception:unparseable date and don't know how to fix this problem. I am receiving a string which represents an event date and would like to display this date in different format in GUI. What I was trying to do is the following: private String modifyDateLayout(String inputDate){ ...

In Java, why are arrays objects? Are there any specific reasons?

Is there any reason why an array in Java is an object? ...

Strings are objects in Java, so why don't we use 'new' to create them?

We normally create objects using the new keyword, like: Object obj = new Object(); Strings are objects, yet we do not use new to create them: String str = "Hello World"; Why is this? Can I make a String with new? ...

char c=7; Why this statement will execute in java without error?

char c=7; The above statement will execute in java without error even though we are assigning a number to character. where 7 is not a character .Why will it execute? ...

special driver to connect to sql server 2008 express

I'm a java newbie, want to test out some hibernate goodies! I have netbeans installed, and I included the Hibernate libraries. I then created a new package named Model. I will drop my Class and xml config files in there. Do I need a special library to connect to sql server? (windows machine) ...

Java or Groovy CMS

Hi, I'm considering developing a school information system using the Grails web framework. Before a school can use the system, they will need to setup the following data School data Students Teachers Subjects Classes etc. I'm considering using a CMS in order to get the ability to CRUD these entities "for free". The CMS may also pro...

java application uses hsql, can I .net application odbc to that?

java application uses hsql to store data, can I .net application odbc to that? ...

Sending a serialized object from Android to a servlet using HTTP client

Hey guys I have tried to create a android application that sends a serialzed object from the phone to a servlet the contents of the object is the input from the user which i will store in a database using hibernate. I believe the problem is around the serializing and deserializing of the object the code is below. If anyone could help i ...

Type-safe method reflection in Java

Is any practical way to reference a method on a class in a type-safe manner? A basic example is if I wanted to create something like the following utility function: public Result validateField(Object data, String fieldName, ValidationOptions options) { ... } In order to call it, I would have to do: valida...

How do you decide in which entity classes to put JPA NamedQuery annotations?

Say I have a Customer - CustomerOrder one-to-many bi-directional relationship with the CustomerOrder holding the total value of each order. If I had a query to find the total value of all orders for a particular customer : select SUM(o.orderValue) from CustomerOrder o where o.customer = :customer Does it matter in which entity class ...

Disable Word wrap in JTextPane

I can't find an easy way to turn off word wrap in a JTextPane. I can't use JTextArea because I need different colors for different text. I have these big ugly lines that get uglier with word wrap turned on. JTextArea has a setLineWrap() method, but I can't find it for JTextPane. Why? ...

Using Groovy(or Java) how can I convert a org.joda.time.LocalDateTime to a java.util.date?

Using Groovy (or Java) how can I convert a org.joda.time.LocalDateTime to a java.util.Date? import org.joda.time.* Calendar cal = Calendar.instance cal.set(Calendar.DATE, 1) cal.set(Calendar.HOUR, 0) cal.set(Calendar.MINUTE, 0) cal.set(Calendar.SECOND, 0) cal.set(Calendar.MILLISECOND, 0) Date startOfTheMonth = cal....

Netbeans won't download Maven artifact

Hi Everyone I'm using Netbeans and I want to grab the latest hibernate artifact from the jboss maven repository. I have added the repository in netbeans, and I can navigate to it within the repository browser. After I add this dependency to my pom.xml file and attempt to build my project, I get an error saying that the artifact coul...

How do I use paramertized generic types in an inner class?

Hello, I am trying to implement an inner class that has generic parameterized type. Here is my code (short version): public class AVLTree<T extends Comparable<? super T>> implements Iterable<T> { ... private class BinaryNode<T extends Comparable<? super T>> { ... } private class TreePreOrderIterator<E extends Comparable<? super...

Recommend an alternative to jTidy?

We have a java widget that does some basic parsing on arbitrary xhtml documents, and we've been using jTidy to clean them up before processing. For a couple of reasons (which are outside the scope of this particular question,) we're looking to replace jTidy with a different library. Can anyone recommend something? We're looking for so...

will netbeans or eclipse install mysql for me as a plugin?

will netbeans or eclipse install mysql for me as a plugin? (preferrably netbeans) (on a windows machine) ...

Java regex pattern to match word or phrase

I have the following regular expression, that I am compiling with Pattern class. \bIntegrated\s+Health\s+System\s+\(IHS\)\b Why is this not matching this string? "test pattern case Integrated Health System (IHS)." If I try \bpattern\b, it seems to work, but for the above phrase it does not. I have the parenthesis in the pattern esc...

Ideas on how to approach a project involving Integration of APIs

I am a student and working on developing a Java Application that would serve as a "Translation Layer" between one application's web service calls to another application's JMX API. Both the applications reside on 2 different systems in the same network. So, essentially, it involves a deliverable program that converts one application's we...

JSpinner Date Editor in Buddhist Calendar

Is there a way to use JSpinner.DateEditor with a Buddhist Calendar? When I change my locale to "th", "TH" and recreate my calendars they are indeed Buddhist Calendars. However, the JSpinners are not updated. Here is some sample code: Locale locale = new Locale("th", "TH"); Locale.setDefault(locale); // Reinitializing calendars with n...

connection url for sql server

I downloaded microsfot's jdbc driver, and I am not sure what the connection.url should be? <property name="connection.driver_class">org.microsoft.sqlserver.jdbc</property> <property name="connection.url">jdbc:</property> .. <property name="dialect">org.hibernate.dialect.SQLServerDialect</property> i configured sqlexpress to wor...