java

Fixing Vanishing LaunchShortcut in Eclipse Plugin

I'm developing an eclipse plugin for creating a plugin for another java platform. I've managed to figure out the LaunchShortcut concept, LaunchDelegate, etc. The basic codepath of the plugin: I have a launchShortcut display if it detects the project right clicked is a "plugin" project. This is detected via a propertyTester Once succes...

Mysql/j Connector Unloads Mysteriously Under Tomcat 6/JDK 6

Hello - Thank you for taking time to look at my question. I developing a Java WAR file intended for distribution to only one server at a time. So far, I have tested on 3 different servers with success, one Debian, one Ubuntu and the other, the Windows machine I'm developing on. On the final deployment server, for some reason the app de...

How do I manage Java timer tasks?

I'm looking for some guidance on how to manage multiple timer tasks. I'd like to be able to dynamically create timers and then when each timer is finished, it'll reset itself. Example: Timer 1 - perform action x - reset to perform action x again in 30 minutes Timer 2 - perform action y - reset to perfom action y again in 10 minut...

Problem with Java GUI

I have made a java program with GUI. Now I want to add a component on the GUI where I can display whatever I want in the same way we display output through System.out.println(); Which component I can add on the GUI and how to display content on that component. ...

How to stop threads of a Java program?

I have made a java program with GUI and have placed a "stop" button on it. When I start the program, the main thread starts 10 threads. Now I want that whenever a user click on "stop" button, all the threads should terminate first, then the main thread should terminate. How can I do that. ...

Mysterious one time Casting Exception

I am trying to use the PropertyChangeSupport of JComponent class. But when I am executing the following code, Clicking on the menu button first time gives Runtime casting Exception, but then it runs fine always. FrameListener.java import javax.swing.*; import java.beans.*; import java.awt.*; import java.awt.event.*; public class Frame...

Java binary tree which return type for iterator over nodes, interface or class?

I'm writing a class for a binary tree, and in the tree interface this function is defined: /** Returns an iterable collection of the the nodes. */ public Iterable<Position<E>> positions(); The problem is that the type of the node is MY class implementing the position interface in the task. Not the interface itself, Position. That ...

Making Java Tic Tac Toe Server Multithreaded

Hey everyone, I have no experience with threads, unfortunately. I have been doing a couple of "Hello World" thread examples, which seem to be pretty easy. However, I need to incorporate threads into a Java Tic Tac Toe server that I have (which uses sockets). The design of my Tic Tac Toe game is this: Provider.java (server): Determin...

How to deliver a java program to a client?

I wrote a software application in Java. Now I want to deliver it to my clients. But before that, I want to do something on that software which are mentioned below. You can answer any or all of the below questions: I want to: Encrypt all the .class files so that no one can decompile it. How can I encrypt it? After encryption I want to ...

suggestion on batch processing db records

I am working on developing a webapp (visual jsf, ejb3, hibernate on glassfish/mysql) that works with an existing legacy system. I have an 'employee' table (with fields such as name (String), location (String), etc.) which is separate from an employee table on the legacy db2 side. I do all of the webapp processing with my employee table....

Question About Deadlock Situation in Java

I'm learning about deadlocks in Java, and there's this sample code from Sun's official tutorial: Alphonse and Gaston are friends, and great believers in courtesy. A strict rule of courtesy is that when you bow to a friend, you must remain bowed until your friend has a chance to return the bow. Unfortunately, this rule doe...

Java JVMTI doesn't work alongside -Xdebug -Xrunjdwp

I spent the last 4 hours trying to set up Eclipse TPTP memory profiling on a Tomcat instance that must be run remotely (i.e. not in Eclipse). This should be possible according to the TPTP and Agent Controller docs. I installed the TPTP components (4.6.0) into my Eclipse (Galileo) workbench, along with the Agent Controller according to ...

jbdc connection with auto reconnect

i am using jdbc to connect to a database server the connection is over a wireless network and can be dodgy at times at the moment when the connection is lost they need to close and restart the application does anyone have some examples of code, where i could write some sort of wrapper to automatically reconnect and rerun the last query,...

How to stop a running *.JAR file with a batch script?

Hello everybody! We are facing trouble restarting closing a running *.JAR file started with the "java -cp". Killing java.exe worked fine. But... isn't there any smoother way for the application? (It saves data on shut-down) Also, how can one simulate any key input at the following message "Enter any key to continue..." with a batch ...

Anonymous code blocks in Java

Are there any practical uses of anonymous code blocks in Java? public static void main(String[] args) { // in { // out } } Please note that this is not about named blocks, i.e. name: { if ( /* something */ ) break name; } . ...

How to enforce unique field value in java Google App Engine

Hello there, I am try to find out how to enforce uniqueness in fields other than the unique id. Example: @PersistenceCapable(identityType = IdentityType.APPLICATION) public class User implements IsSerializable { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; @Persistent priv...

It's possible in Java to access the source code of a method "reflectively"?

Hi, I'm afraid that the answer is no, but maybe one of you surprises me. Thanks. Edit 1: I'm aware that the question doesn't make much sense but I think the point was understood and, sadly, the answer is no. Anyway I changed the title of the question adding quotes to the word "reflectively" and I will try to better explain my inte...

java : cannot resolve symbol

I was compiling an JAVA ( 1.4 varsion )file and was getting the following error (about 100 times all are same). Appli.java:721: cannot resolve symbol symbol : class License location: class test.App.Appli License sellLicense = sell.getLicense(); I used run/cmd/cd D:...../javac Appli.java I had set the CLASSPATH...

Eclipse console in RCP missing output

In my RCP I show the Console and want to output different categories of output (not just STDERR and STDOUT). I have looked at and used code from both: http://stackoverflow.com/questions/720963/eclipse-console {filter_workaround}://stackoverflow.com/questions/716615/writing-to-the-eclipse-console I go through all the actions as prescrib...

Recursive Generic Usage

Edited:" I received a very pertinent answer from 'erickson', but there is a side problem (up-casting?) that was not explicitly covered in my original example and is not solved with his answer. I've extended the example to cover this other problem, and I've included it at the end of this post. Thanks for your help. I'm currently facing a...