java

Find "real" height/width of Swing/AWT object

Because Canvas3D doesn't have the ability to resize dynamically with the parent frame, I would like to be able to track when a user resizes a window and then resize it manually myself. (If this ends up crashing Canvas3D, as some docs suggest, I will simply destroy and recreate it when the user resizes their window). Part of this procedur...

How do I permit my Java applet to use MySQL?

I've recently gotten my hobby java project embedded into a page thanks to this very site, but now I'm having some security issues. I have the include: import java.sql.*; and the line: Class.forName("com.mysql.jdbc.Driver").newInstance(); as well as a mysql .jar file in my src directory, it works from the console, and in the applet...

Connection to Oracle without a username or password

Oracle has this concept of allowing database users to be identified by the operating system user who is running the program that is connecting to Oracle. See here. This allows you to do, as that user on a unix machine for example, a command such as: sqlplus / I am attempting to write a Java program for Oracle 10.2 which connects with...

java Enum definition

Hi, I thought I understood Java generics pretty well, but then I came across the following in java.lang Class Enum<E extends Enum<E>> Could someone explain how to interpret this type parameter? Bonus points for providing other examples of where a similar type parameter could be used. Cheers, Don. ...

Help Regarding Dynamic Proxy

I am seeing following exception when I try to use dynamic proxy com.intellij.rt.execution.application.AppMain DynamicProxy.DynamicProxy Exception in thread "main" java.lang.IllegalArgumentException: interface Interfaces.IPerson is not visible from class loader at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353) at java.lan...

What is the data type for length property for Java arrays?

I want to find out if length property for Java arrays is an int/long or something else. ...

Update more than one row atomically

I need to execute a select and then update some of the rows in the ResultSet in an atomic way. The code I am using looks like (simplified): stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); rs = stmt.executeQuery("SELECT ..."); while (rs.next()) { if (conditions_to_update) { rs.update...

Reflecting method's actions in Java

Hey I'd like to know how to - if even possible - reflect what method calls are executed inside the method during execution. I'm especially interested in either external method calls (that is, methods in other classes) or calling some specific method like getDatabaseConnection(). My intention would be to monitor predefined objects' acti...

Lightweight messaging (async invocations) in Java

I am looking for lightweight messaging framework in Java. My task is to process events in a SEDA’s manner: I know that some stages of the processing could be completed quickly, and others not, and would like to decouple these stages of processing. Let’s say I have components A and B and processing engine (be this container or whatever e...

Scripting in Java

Me and some friends are writing a MORPG in Java, and we would like to use a scripting language to, eg. to create quests. We have non experience with scripting in Java. We have used Python, but we are very inexperienced with it. One of us also have used Javascript. What scripting language should we use? What scripting language should w...

Struts Logic Problem

Why doesn't the code below work? The idea is that the page checks to see if the dropdown variable has changes since you last refreshed the page. <logic:equal name="Result" value = "-1"> <bean:define id="JOININGDATE" name="smlMoverDetailForm" property="empFDJoiningDate" type="java.lang.String" toScope = "session" /> </logic...

Dummy web service

I received a WSDL file for a web service interface that our system should call somewhere in the future. Until then, I'd like to setup a dummy/mockup web service that does nothing else than to log the web service invocations and return dummy data. What I've done so far is to generate Java objects from the WSDL file. What's the fastest...

Do I have to explicitly call System.exit() in a Webstart application?

Recently I converted a Swing application to Webstart. The process was pretty straightforward, but I found that after I close all windows, my application's JVM did not terminate. The thread dump showed that there are a couple of non-daemon threads, notably Swing's EDT, AWT and a couple of websart related threads. The actual strategy use...

Are there tools that log user actions to help reproduce bugs?

As a test engineer, I often engage in exploratory testing. When I encounter a bug, it is not always immediately clear which steps led to the problem. So, obviously, I have to find the required steps to reproduce the problem. Depending on the situation, this can take a large amount of time. What would be really helpful is a logging tool ...

How do you launch multiple threads from within JEE?

I need to scale calls into Tomcat and it's been suggested to launch threads internally. Has anyone needed to do this and, if so, what solutions did they come up with? Thanks. ...

What Java exception class to use for HTTP errors?

I am using Apache HttpClient and would like to communicate HTTP errors (400 Bad Request, 404 Not Found, 500 Server Error, etc.) via the Java exception mechanism to the calling code. Is there an exception in the Java standard library or in a widely used library that would be appropriate to use or to subclass for this purpose? The alterna...

How do I move from Java to C#?

I know Java well. Which caveats and resources will help me cross to the other side (C#) as painlessly as possible. ...

How to remove classpath variables from WAS module

On our Dev box, our application module contains references to the file:/apps/WebSphere61/systemApps/isclite.ear/ jar files and classpath entries. On our Prod box, however, it only contains the jar file containing all of our required classes. On Dev, this is causing a problem when using apache-commons-fileuploader as these classes are a...

Anyone know a simple way using java calendar to subtract X days to a date?

Anyone know a simple way using java calendar to subtract X days to a date? Sry not being able to find any function which allows me to directly subtract X days to a date in java, if anyone could point me into the correct direction. ...

Which anotation should I use: @IdClass or @EmbeddedId

The JPA (Java Persistence API) specification has 2 different ways to specify entity composite keys: @IdClass and @EmbeddedId. I'm using both annotations on my mapped entities, but it turns out to be a big mess to people who aren't very familiar with JPA. I want to adopt only one way to specify composite keys. Which one is really the ...