java

Extending Android's Default Gmail/Email Applications

Hello everyone, I would like to extend the Android platform's default Gmail/Email applications either by plugging into their ContentProvider or by using intent filters. Essentially, I want to be able to scan incoming emails for special rules that will trigger events in my Android application. If scanning emails automatically isn't possi...

java : non-static variable cannot be referenced from a static context Error

the following code is generating an error on the variable con2 saying "non-static variable con2 cannot be referenced from a static context Error." I googled for a resolution and they are suggesting the variable isn't initalized yet to make the methods available. Am I initializing this incorrectly? i also tried changing things to publi...

Java Calender scheduling events

In my application i want to schedule the start of processing. In two ways first on a preset date or say like every Monday. In the case of a single date i can watch the time on a tread and start processing but when two are mixed i can't come up with a good solution. My initial thought was when application boots up i can schedule events t...

Peek at next element in a Tree set using an iterator.

I was wondering if there was a way to accomplish this, or if there are alternative data structures. It has to be sorted, without duplicates, and have an iterator. ...

how to load a image from web in java

I need to load an image from a web in a simple Java stand alone aplication. Any Ideas? ...

Java Struts list listKey listValue listClass?

Well new to the java stuff and having trouble with assigning a class attribute to this SELECT options. wanted to know if the listClass is correct? What I'm trying to accomplish is to add a class attribute to the options of a SELECT drop down What I have: <select> <option value="volvo">Volvo</option> <option value="saab">Saab</optio...

Respecting/reading the "Preferred Applications" settings in Gnome (Linux)

How do I find out the user's "preferred web browser", if they're using Gnome desktop environment? (I want to open a webpage, I don't need to know which browser the user prefers.) Some background: I'm trying to open a browser window (my homepage) with my Java app. if Java version is 1.6+, use Desktop.browse(url); otherwise, use BareBo...

Problem using two xa-datasources with Jbpm

Hello, I'm using Seam, JBoss Jbpm and Resteasy. I have a very simple process definition: <start-state name="create"> <transition name="send" to="inbox" /> </start-state> <node name="inbox"> <action expression="#{test.sayHello}" /> <transition name="acknowledge" to="acknowledged" /> </node> <end-state name="acknowledged" /> Thi...

Java- Copy file to either new file or existing file.

Hi- I would like to write a function copy(File f1, File f2) f1 is always a file. f2 is either a file or a directory. If f2 is a directory I would like to copy f1 to this directory (the file name should stay the same). If f2 is a file I would like to copy the contents of f1 to the end of the file f2. So for example if F2 has the conten...

What is the format of the Maven Surefire plug-in <include> statement?

I'm trying to run Maven Surefire with an include statement of: <include>**/[A-R]*SeleniumTest.java</include> <include>**/[A-R]**SeleniumTest.java</include> <include>**/[A-R].*SeleniumTest.java</include> But it does not seem to support any of these notations. What is the syntax of this expression? (Documentation link would be much app...

How to pause execution while JDialog is open

How can I make my application pause when I open custom JDialog and after the dialog is closed to make continue again. ...

Adding a ServiceListener with Spring DM

I am wondering if it possible to do the equivalent of public void start(BundleContext context) { String filter = "filter for my specific service"; context.addServiceListener(new MyServiceListener(), filter); } with Spring DM. I have found reference material for adding listeners for lifecycle management. But this relates t...

How can I detect a SQL table's existence in Java?

How can I detect if a certain table exists in a given SQL database in Java? ...

What characteristics of Java allow it to build much faster than a comparable C++ program?

Possible Duplicate: Why does C++ compilation take so long? I am working with two different projects of about the same size (loc). The Java build process using Ant is measured in minutes. The C++ build processing using the CMAKE tools is measured in hours. What characteristics of Java allow it to build much faster than a compara...

Is there a .Net equivalent to java.util.concurrent.Executor ?

Hello, Have a long running set of discrete tasks: parsing 10s of thousands of lines from a text file, hydrating into objects, manipulating, and persisting. If I were implementing this in Java, I suppose I might add a new task to an Executor for each line in the file or task per X lines (i.e. chunks). For .Net, which is what I am usi...

Is there a meta-language available for Java that allows you to access object complex hierarchies?

I'm evaluating some potential implementations of a complex object hierarchy model for my current project. I'm wondering if there is an xpath-style meta-language or something like this that would allow me to query these object linkages. Furthermore, I'm sure there is some very specific jargon used for the problem I am asking about - I ju...

How to shutdown com.sun.net.httpserver.HttpServer ?

The Http Server embedded in JDK 6 is a big help developing web services, but I've got situation where I published an Endpoint and then the code crashed and left the server running. How do you shutdown the embedded server once you've lost the reference to it (or the published Endpoint)? ...

How to force hibernate to release memory once the session is closed ?

We've just recently started using Hibernate and are still getting used to the way it works. On of the things we've seen is that even after all sessions are closed and references have gone out of scope, hibernate still seems to maintain the previously used database values in it's cache. We have code that reads from a set of tables in mu...

Get the parent of an IStructuredSelection (eclipse-rcp)?

I have a TreeViewer in a view and need to get the parent (if it exists) of an item selected. Nothing seems to work and google yields no answers.. mBacktestTree.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { IWorkbenchPage page = getSite().getPage(); TreeViewe...

setBorder method for JLabel causing paint problem

I have a custom class that extends JLabel. For specific instances of that class, I want to add some spacing to the text on the left side. I need the spacing as I'm setting the background of this JLabel and I don't want the text to bump up right next to the edge of the colored background. I fished around quite a bit and implemented thi...