Hi all,
i just have a quick question about the Generic Type.
i have an interface class
public interface myInterface<T> {
T add();
}
and a sub class
public class interfaceImp<T> implements myInterface
{
private T t1;
private T t2;
interfaceImp(T t1, T t2){
this.t1 = t1;
this.t2 = t2;
}
public...
How do I get the location of rt.jar in my Ant script with NetBeans without editing my project.properties? ${java.home} is returning the location of the jre folder and not the jdk folder.
I know that I could easily add a value to project.properties but I don't want to. I also know that I could easily just modify the path whenever I switc...
I want to build two Android apps from the same code base. The difference between the apps is very small - app name, one or two resource files, and whether to show ads or not (basically, a free and a paid version of the same app).
This is pretty simple to do in XCode for an iPhone app, but I'm not sure how to approach it in Eclipse. Is...
I am building a project in GWT that pulls an rss feed, executes regular expressions on the feed (in javascript using JSNI), and then stores that resulting data on a database where the users can access it.
As of right now, I have been writing all the code in the client-side .java file hoping that I could simply transfer it to the server-...
I'm building a Distributed System using Java RMI and it must support a server loss.
If my client is connected to a Server using RMI, if this server goes down (cable problems for example), my client should get an exception so it can connect to other server.
But when the server goes down, nothing happens to my client, he keeps waiting fo...
I have an Object who's internal representation is not conducive to data entry. I have a class with multiple custom components, one of which is a Range class. The Range class is easiest to input using two text field inputs rather than as one text field that uses a custom PropertyEditor.
I have a fully functional constructor that could ...
I'm looking for a regular expression in Java which matches all whitespace characters in a String. "\s" matches only some, it does not match and similar non-ascii whitespaces. I'm looking for a regular expression which matches all (common) white-space characters which can occur in a Java String.
[Edit]
To clarify: I do not mean ...
List<Question> questions = new ArrayList<Question>();
questions.addAll(getAllQuestions()); //returns a set of Questions
Collections.sort(questions, new BeanComparator("questionId")); //org.apache.commons.beanutils.BeanComparator
Under Java 1.5, the above works fine except that the 'new BeanComparator("questionId")' generates an uncheck...
I'm planning to develop an applet-based application that will be used by "average Jill" non-technical users (classical musicians, to be precise). What version of Java can I realistically expect those users to have installed in their browsers? Is 1.5 safe? I know Microsoft hasn't bundled Java with Windows in years, but do most OEM Windows...
I'm trying to build a web portal in Java that supports incremental changes to an XML document. I really like the diffgram technology in .Net, but I must use Java for this project. Is there a Java library that can modify an XML document object using diffgrams? We will likely be using JAXB, but I can always marshal data to build the ori...
The format i have in the external file is
name
tel no
mob no
address
From the gui i would like to delete a contact which is in the format of above using my delete button.
i have completed the export method and was wondering if deleting would be similar,, here is my code for exporting.
{
FileOutputStream file;
PrintStream ou...
Ok, so I'm tyring to iterate through an ArrayList and remove a specefic element. However, I am having some trouble using the For-Each like structure. When I run the following code:
ArrayList<String> arr = new ArrayList<String>();
//... fill with some values (doesn't really matter)
for(String t : arr)
{
t = " some other value "; //hop...
Ive made an address book. I can currently write to the arraylist and save it back to the .buab file, but I cant delete from the arraylist and export it back to the .buab file?
Im pretty much stuck on this. Im able to retrive contacts from the .buab and scroll through them using the JTextFields and buttons ive created.
Any help will be ...
I'm moving my project to Maven and eventually OSGi. I currently distribute the project is a large Zip file with all the dependencies. Although my projects code is only 20% of the total package I have to redistribute all the dependency. With smaller independent modules this may be even less.
Looking here on stack overflow it seems that t...
What are some good tools for quickly and easily converting XML to JSON in Java?
Thanks in advance for all your help!
...
I'm using Method.invoke() to call a function in a third party jar. Sometimes I get a java.lang.reflect.InvocationTargetException thrown. How can you figure out what the real exception was from this?
...
I have a problem using java rmi:
When I'm trying to run my server, I get a connectException (see below).
Exception happens when executing the rebind method:
Runtime.getRuntime().exec("rmiregistry 2020");
MyServer server = new MyServer();
Naming.rebind("//localhost:2020/RemoteDataPointHandler", server);
when using rmi://localhost:202...
Assuming you have a hypothetical enum in java like this (purely for demonstration purposes, this isn't code i'm seriously expecting to use):
enum Example{
FIRST,
SECOND,
THIRD,
...
LAST;
}
What's the maximum number of members you could have inside that enum before the compiler stops you?
Secondly, is there any per...
As the title suggests, we have a Java (Swing) desktop application, and we'd like to be able to have some basic access to the Jump Lists (in the new Windows 7 taskbar).
In particular, we'd like to be able to add some "user tasks" to the jump list--the ability to start other modules in our application, maybe to close all running modules, ...
This is really strange to me and it's becoming into a real problem.
I'm building a site in appengine (java) using scala and It's working really slow when accessed from my domain:
/latest 200 1505ms 2325cpu_ms 1586api_cpu_ms 4kb
But when accessed from appspot it works much faster:
/latest 200 180ms 269cpu_ms 221api_cpu_ms 4kb
I've ...