java

what is the easiest way to convert / map a JSON string to a javabean?

Hi, I have a JSON string that I read in and would like to parse / map it to a JavaBean so I can use it in my Java code. What is the easiest way / library to achieve this? ...

Logic (if any) behind Google App Engine excluding standard JDK 1.6 APIs

It looks like GAE has chosen a subset of JDK 1.6 classes, as per: Google App Engine JDK white list which is very unfortunate as one gets class linkage errors all over the place with most common java libraries that deal with data binding, reflection, class loading and annotations. Although some omissions may be for deprecated or legacy ...

how do you open web pages in java?

Is there a fairly simple way to open a web page within a GUI's JPanel? If not, how do you open a web page with the computer's default web browser? I am hoping for something that I can do with under 20 lines of code, and at most would need to create one class. No reason for 20 though, just hoping for little code... I am planning to o...

Idea for a project

Hi, me and my schoolmate were tasked to come up with an idea for a project that would have something to do with simulating things that concern the operation system (e.g. animation of disk algorithms such as FCFS; implementing your own virtual file system- with FUSE for example etc.). The problem is that all of the mentioned ideas are a...

Why doesn't my Ant master build file work properly?

We have a bunch of Ant scripts, one for each of our subprojects. In the end we want to run all of these from a master build script and do some other housecleaning to package the whole project. Each of the individual Ant scripts is named ant.xml and is in the subdirectory of its project. Each uses an Ant import to import an ant-commons.xm...

Java Netscape LDAP Delete

I have been using the Java Netscape LDAP library to modify LDAP entries (http://www.mozilla.org/directory/javasdk.html). I now need a way to delete an entry. I looked through the library but could not find anything that I think would work. Found “LDAPDelete” but that looks like it’s used from the command line. If someone could post ...

Does the Sun JVM slow down when more memory is allocated via -Xmx?

Does the Sun JVM slow down when more memory is available and used via -Xmx? (Assumption: The machine has enough physical memory so that virtual memory swapping is not a problem.) I ask because my production servers are to receive a memory upgrade. I'd like to bump up the -Xmx value to something decadent. The idea is to prevent any he...

"Spotlight" like component for Swing?

I am just thinking about ways to improve the user experience for our data entry application and thought about a Mac OS X Spotlight like search bar which allow the user to search for arbitrary terms and pick from a list of choices that match the terms. I imagine something that is capable of showing categories (like contacts, appointments...

Is there any alternative to JTable, that is free and better?

Looking for a free and better alternative to JTable. Found quite a few good ones, but they aren't free. To begin with, I want to be able to select cells diagonally (apart from horizontally and vertically). ...

Java Object "cannot be dereferenced"

I'm using a library - HtmlUnit - and I just updated from version 2.4 to version 2.5. When I compile my code against 2.5, I'm getting a strange object "cannot be dereferenced" error message that I'm not familiar with. Moreover, I don't understand why it works when I write the code in two lines, but fails when I do it as a one-liner . Her...

How do I use generics with an array of Classes?

I want to create an array of Classes, each representing a type that is available in the system I'm building. All the Classes involved are subclasses of a common superclass. So I'd like to do: Class<? extends SuperClass>[] availableTypes = { SubClass1.class, SubClass2.class }; This gives me the error: Cannot create a generic array o...

jgoodies bindings + indirect changes

I'm having a brain cramp trying to understand the appropriate way to use JGoodies bindings in my application. I have a class Article which is a bean that has read-only properties. Article is a "plain" bean, and doesn't manage property listeners, since the properties don't ever change. I have a Swing JPanel which I would like to use to d...

Can java call a script to restart java in solaris?

We have a jboss application server running a webapp. We need to implement a "restart" button somewhere in the UI that causes the entire application server to restart. Our naive implementation was to call our /etc/init.d script with the restart command. This shuts down our application server then restarts it. However, it appears that ...

How to walk through Java class resources?

I know we can do something like this: Class.class.getResourceAsStream("/com/youcompany/yourapp/module/someresource.conf") to read the files that are packaged within our jar file. I have googled it a lot and I am surely not using the proper terms; what I want to do is to list the available resources, something like this: Class.class....

Trying to wrap my wee brain around how threads deadlock...

First, here's a sample: public class Deadlock { static class Friend { private final String name; public Friend(String name) { this.name = name; } public String getName() { return this.name; } public synchronized void bow(Friend bower) { System.out.fo...

How to deal with the URISyntaxException

I got this error message : java.net.URISyntaxException: Illegal character in query at index 31: http://finance.yahoo.com/q/h?s=^IXIC My_Url = http://finance.yahoo.com/q/h?s=^IXIC When I copied it into a browser address field, it showed the correct page, it's a valid URL, but I can't parse it with this : new URI(My_Url) I tried : My_U...

Has anyone used "GWT Designer"?

Haven't seen anything about it here but it seems to solve one of the problems with GWT - the fact that you have to write Java code to generate your GUI. Instead this software allows you to design the GUI using drag-and-drop tools - a WYSIWYG interface. I'm not trying to sell the product, by the way. I just want to know whether it wor...

Java String contains only...

Hi everyone, I'm new to Java and I'm trying to achieve something pretty simple but I am not allowed to use regex... Which is my favorite tool to do that type of task. Basically I need to make sure a string only contains alpha, numeric, space and dashes. I found the class org.apache.commons.lang.StringUtils and the almost adequate meth...

Eclipse : list methods and variables of all classes

I am starting to use some Java code which was written by someone else. I have to understand, change and test it. The author is not available now. The package has some 50 files (and so classes) of different sizes. It would be great if I could just see/print out the names of the methods (public and private) and the public variables (like t...

Question about JInternalFrames.

I have a frame that once it's minimized, I'd like to minimize other frames related to it. If the frame is no longer minimized, I want to restore the other frames too. How should I go about doing this? EDIT: nvm, it works. ...