java

Painting rows in a JTable

I have an implementation of a DefaultTableCellRenderer. When someone selects a row in the table, the row gets highlighted green. If I wanted to highlight the row under the one selected what is the easiest way to achieve this? Is this even possible without having to re-render the entire table? So at the moment, I have something that l...

What exactly is sun.jnu.encoding?

What is the purpose of the system property sun.jnu.encoding? Various fragments on the web set or report it, but I can't find a definition. ...

How do I stop a class from logging in java.util.Logger under Glassfish

My Glassfish server logs messages like this every 10 minutes or so: [#|2009-07-01T10:10:03.373+0930|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=21;_ThreadName=Timer-13;_RequestID=30966ccf-eac6-4cff-8256-22bc31862686;| java.lang.NullPointerException: name cannot be null at javax.management.ObjectName.constru...

Building Freemarker from source

Hey Everyone, I am working on a security project at my university for open source software. I am trying to build freemarker from source, but I am running into some problems. Everything that I can find online says that simple running 'ant' in the root directory should build the project. The only requirement is that you have ant v1.7.0 in...

java multidimensional array

Looking for the correct way to declare a multidimensional array and assign values to it. This is what I have: int x = 5; int y = 5; String[][] myStringArray = new String [x][y]; myStringArray[0][x] = "a string"; myStringArray[0][y] = "another string"; ...

UTF Encoding in java

I need to encode a message from request and write it into a file. Currently I am using the URLEncoder.encode() method for encoding. But it is not giving the expected result for special characters in French and Dutch. I have tried using URLEncoder.encode("msg", "UTF-8") also. Example: Original message: Pour gérer votre GSM After encod...

Java/J2EE training recommendations

I am an advanced Flex developer looking to quickly ramp up my Java knowledge. I have solid OOP knowledge and can understand normal Java code well enough but would like to take things a few steps further. Specifically I want to get (reasonably) comfortable with app servers and Java environments, Spring, Hibernate, AOP, DB integration, etc...

Is it possible to get the class name from a static method?

When you are in a static method, is there a way to get the class name (a string containing the name) without typing the class name itself? For example, typing MyClass.class.getName() is no more useful than just "Myclass". ...

can set enum start value in java

Hi, I use the enum make a few constants: enum ids {OPEN, CLOSE}; the OPEN'valuse is zero, but I wanna it as 100. Is it possible? ...

Weblogic error

I am getting an error when I try to establish connection through a DataSource created in weblogic server.Has anyone faced this error in past.I am getting exception in getConnection method of the DataSource. java.lang.IllegalArgumentException: interface weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_com_i...

Confusion about cloneable interface and object.clone() in java

If I have: "class foo implements cloneable" and then do: bar = new foo(); bar.clone(); I get a shallow copy without needing to write any bar.clone() code like I normally would need to do when I implement an interface. My understanding is that an interface's functions must be filled in by the class implementing it, and Object.clo...

Spring MVC support for dynamically populating select box

Does Spring 2.5 (or 3.0) include support for dynamically populating a select list based on what the user selects from another form element? For example if you have a form with 2 select for (Car) Make and Model. When the user selects a Make from the first list, the Model select should get populated with the available Models for that Make...

How to avoid accidentally closing an SQL Connection in Java?

Currently what i am doing for transaction management is: Connection connection = getConnection(); connection.setAutoCommit(false); updateTableX ( connection, ... ); updateTableY ( connection, ... ); connection.commit(); closeConnection(); I would like to know, if it is possible to avoid closing the connection in my 'updateTableX' meth...

using rmic in netbeans

I have written rmi server code in netbeans 6.5. how can i use rmic in netbeans 6.5 so that i can create server_stub class? ...

How to resolve Maven exec plugin: classpath too long error?

I have a large Java project with a large number of jar file dependencies. When I try to run the project (using exec) from Eclipse or Netbeans, Maven throws an exception which turns out to be a too large number of entries on the classpath (only 2/3 of the needed entries are included). Does anyone know a workaround for this? (Except from...

Threadsafe publishing of java object structure ?

Assuming that I have the following code: final Catalog catalog = createCatalog(); for (int i = 0; i< 100; i++{ new Thread(new CatalogWorker(catalog)).start(); } "Catalog" is an object structure, and the method createCatalog() and the "Catalog" object structure has not been written with concurrency in mind. There are several non-f...

GWT on GAE and S3

I'm trying to play with Google Web Toolkit (GWT 1.6) on Google AppEngine with Java (GAE/J) and I have encountered problem storing data files to GAE. So I have decided to use S3 to store my files but when I googled, I've found library called gwt-s3 that allows me to store File to S3 using GWT, but the problem is that it only allows storin...

How to invoke main method of java program from a jsp?

Hi, I have a JSP from which I'm getting the input from the users. Now, I'd like to pass the input that get from this JSP as arguments to the main method of my java program and run the program from this JSP. Some help please! Thanks in advance! Ravilla ...

How to upload a file using Java HttpClient library working with PHP - strange problem

I want to write Java application that will upload a file to the Apache server with PHP. The Java code uses Jakarta HttpClient library version 4.0 beta2: import java.io.File; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpVersion; import org.apache.http.client.HttpClient; import org.apa...

.Net & Java which one is better?

Hi guys: My company is doing the future planing at the moment. One of important things is to decide which framework we should build our company IT on? .Net or Java? It seems both frameworks have it advantage and disadvantage. Just want to hear how you guys think about this issue. Cheers ...