Possible Duplicates:
Gracefully avoiding NullPointerException in Java
Multilingual fields in DB tables
Exact duplicate
http://stackoverflow.com/questions/963936/gracefully-avoiding-nullpointerexception-in-java
What do you like more? I just hate seeing the last one. It just seems backwards.
String randomtext = "stack...
At the moment I execute a native process using the following:
java.lang.Process process = Runtime.getRuntime().exec(command);
int returnCode = process.waitFor();
Suppose instead of waiting for the program to return I wish to terminate if a certain amount of time has elapsed. How do I do this?
...
So I have a table in a jsp page with several rows and checkboxes for each row. I created a js function that creates an array of the value on the checkboxes. I want to send this array over in an ajax call so I toJson-ed it but I dont understand how actionbean variables get set with these parameters. Can anyone help? THANKS!
...
I was recently asked in an interview - In java, how do you compare component based frameworks to request based frameworks? I explained EJB as an example of Component based framework and Struts as a request based framework but was not convinced if I did justice to the question.
Any ideas on what interviewer meant and what should have bee...
Assume I have a webpage where people submit java source code (a simple class).
I want to compile and run the code on my server, but naturally I want to prevent people from harming my server, so how do I disable java.io.* and other functions/libraries of my choice?
A regexp on the source code would be one way, but it would be "nicer" if ...
Are there any good quick reference guides out there (preferably online) for Java Generics from the perspective of someone with complete understanding of C# Generics? I find that the syntax is so similar that I expect it to just work and then I run into unfamiliar Java syntax like this:
Class<?> foo;
which I thought was similar to the ...
I'm trying to use the AdvancedTabPanel of the Advanced GWT Components library. I've put the JAR file under war/WEB-INF/lib and added to my classpath in Eclipse, and added to my HTML file:
<link id="advancedTheme" type="text/css" rel="stylesheet" href="./advanced/themes/default/theme.css"/>
Although it finds the Java classes and loads ...
Is there a standard (preferably Apache Commons or similarly non-viral) library for doing "glob" type matches in Java? When I had to do similar in Perl once, I just changed all the "." to "\.", the "*" to ".*" and the "?" to "." and that sort of thing, but I'm wondering if somebody has done the work for me.
Similar question: http://stac...
What are the design patterns that every developer must know?
I'm interested in the context of Java web developers working with Spring & Hibernate. I have often heard that good knowledge in design patterns is essential for working with those frameworks. Can anyone list the specifics?
For example, I know that understanding abstract facto...
What's the difference between "java.version" and "java.vm.version?"
When I use the latter, I get something like "11.3-b02." What does that mean?
...
Hi,
Assume I have an array/vector of numbers like 1,3,7,9 then I need to guess a number from this list randomly. Using Random class in Java it seems like not possible to do this. Could anyone kindly help me to tell a way to do this kind of thing. I have to change the list of numbers used to generate random number. I am trying to impleme...
what is the different jpox and data nucleus implementation of JDO? both also free implementation right?
...
I'm having a tough time in understanding the following code based on recursion algorithm in Java. I don't understand, what's the different value x and y have when they call within one another? I tried to get the right value by calling System.out.print() within a code, but still get no help.
public class RecursionExample
{
private ...
I am just stepping into the world of XML-RPC to access a Trac server. How can I debug if I have access to the client only ?
Some code snippet:
import java.net.URL;
import java.util.Hashtable;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.lustin.trac.xmlprc.Wiki;
...
...
Hey all,
I'm currently searching for a way of measuring the amount of downloaded data on my computer while i am connected to the network / the Internet.
I'd need a method that would work either for Mac OS X or Windows XP/Vista and can't manage to find anything in the Java API related to that kind of feature. I hope you'll be able to h...
I have a java agent which instruments bytecode.
I am using the attach apis in java 6 to allow users to dynamically load the agent and instrument and deinstrument code using my java agent.
I am using the Boot-Class-Path manifest attribute to make sure my javagent classes are in the boot classpath so that my users can instrument classes li...
I was trying to come up with obscure test cases for an alternative open-source JVM I am helping with (Avian) when I came across an interesting bit of code, and I was surprised that it didn't compile:
public class Test {
public static int test1() {
int a;
try {
a = 1;
return a; // this is fine
...
I have my reports in reports\templates\Contractor_Bill.jrxml, reports\results\ which stores the results. It works fine in Netbeans 6.5. But when i copy the dist folder containing exec jar file to a new place n run the jar. It throws this execption. I also craeted the report folder in the new place. Still itz gvin same error. What might b...
I have a Java MouseListener on a component to detect mouse presses. How can I tell which monitor the mouse press occurred in?
@Override
public void mousePressed(MouseEvent e) {
// I want to make something happen on the monitor the user clicked in
}
The effect I'm trying to achieve is: when the user presses the mouse button in my app...
Is there a way to cancel a long running file open operation? Long delays due anti-virus scans, mapped network drives etc.
new FileInputStream("a_file_that_the_antivirus_" +
"will_process_for_minutes_before_returning.jar")
// process the contents...
In the above example, the first line can block, but I don't know any way to asynch...