java

OpenOffice.org import csv with Java

How do I import a CSV file using OpenOffice.org APIs? I want to do this using the same functionality that is also provided when I open the same file using "CVS text" filter. ...

Can Microsoft Sync framework for ado.net work with Java?

Hi All, I am planning to use the following architecture for one of the applications: Client: Java based application, which will use a MySQL database Server: Will be C# based and the database will be SQL Server Now is it possible to use Microsoft Sync Framework in Java? (Probably by implementing some interfaces?). I want the data from J...

Best approach for learning Java after C++?

I've been using C++ for about 6 or 7 years now, and I consider myself fluent in it. I've never bothered with Java until now, but I find myself out of the job (company went under) and I need to expand my skill set. Someone recommended Java, so I am wondering if there is any advice for where somebody like me might start. I am also inter...

Patterns and more for clean and easy gui code

Hey, every time i code a gui (in my case with GWT, never touched gui programming before), i notice that my code becomes a big mess, when the applications becomes more complex. It's really frustrating to look over my code and get a headache of all these setters in object constructors and this messy throwing together of these. I am usin...

Best practices for exception management in JAVA or C#

I'm stuck deciding how to handle exceptions in my application. Much if my issues with exceptions comes from 1) accessing data via a remote service or 2) deserializing a JSON object. Unfortunately I can't guarantee success for either of these tasks (cut network connection, malformed JSON object that is out of my control). As a result,...

Process Monitoring in GWT

Does anyone know how to monitor long-running server-side processes in GWT, other than polling the server? We need to do some time-consuming, multiple-step, I/O-bound processing on the server, and it would be nice to display the progress of this processing in the browser. ...

Simplest way to print an array in Java

What's the simplest way of printing an array of primitives or of objects in Java? Here are some example inputs and outputs: int[] intArray = new int[] {1, 2, 3, 4, 5}; //output: [1, 2, 3, 4, 5] String[] strArray = new String[] {"John", "Mary", "Bob"}; //output: [John, Mary, Bob] ...

Specializing in C#, Java, or both?

I recently got a junior developer job and am still an undergrad in college. I am new to Java and have some experience with C/C++. I started learning Java on the job and was able to accomplish much quickly in 2 months. Now my company has me working on C#/.NET apps... Questions: Should I be specializing in Java since there are more job...

How to offer links in an eclipse editor plugin?

I'm writing an eclipse editor plugin for a custom file format and want to offer a way to quickly jump to the definition of an entity from a named reference to it - basically the "open declaration" functionality of the eclipse Java editor. I know I can do this by registering an editor action and putting it in the context menu, but I'd re...

How to overcome limitations of Java's Static Main() Method

I'm trying to work this out. In my project, i have a file called 'Hello.java' which is the file with the main() argument and which is called when the program is compiled. And I have another file called MyObj.java which has got just a random class I made up to test java's OO features. I'm trying to do this: class Hello { public MyOb...

Java Timer vs ExecutorService?

I have code where I schedule task using java.util.timer. I was looking around and saw ExecutorService can do the same. So this question here, have you used Timer and ExectuorService to schedule tasks , what is the benefit of one using over another. Also wanted to check if anyone has uses the Timer class and ran into any issues which th...

How to ensure hashCode() is consistent with equals()?

When overriding the equals() function of java.lang.Object, the javadocs suggest that, "it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes." The hascode method must retur...

What is Java written in?

What language is Sun's JVM written in? ...

Validate reflected method return type and parms in Java

I have a generic Callback object which provides a (primitive) callback capability for Java, in the absence of closures. The Callback object contains a Method, and returns the parameter and return types for the method via a couple of accessor methods that just delegate to the equivalent methods in Method. I am trying to validate that a ...

java for vb.net/c# programmer

Duplicate: http://stackoverflow.com/questions/324554 http://stackoverflow.com/questions/323015 I have been a VB.NET /C# programmer for about 5 years now and I think I want to learn the whole Java/J2EE stuff on my own. Do you guys know of any books/sites that help with this? I have taken several java courses in undergrad/graduate scho...

Is stopwatch benchmarking acceptable?

Does anyone ever use stopwatch benchmarking, or should a performance tool always be used? Are there any good free tools available for Java? What tools do you use? EDIT: Thanks for all the answers so far. To clarify my concerns, stopwatch benchmarking is subject to error due to operating system scheduling. On a given run of your prog...

How to trace a NullPointerException in a chain of getters

If I get a NullPointerException in a call like this: someObject.getSomething().getSomethingElse(). getAnotherThing().getYetAnotherObject().getValue(); I get a rather useless exception text like: Exception in thread "main" java.lang.NullPointerException at package.SomeClass.someMethod(SomeClass.java:12) I find it rather hard to ...

How do I get a list of installed printers?

Hi. I'm searching a possibility to get a list of installed printers. I'm using JDK 1.6 with a Windows operating system. Does anyone know a solution? Thank you in advance. Best regards Thomas ...

What are the differences between PHP and Java?

What are the main differences between PHP and Java that someone proficient in PHP but learning Java should know about? Edit: I mean differences in the syntax of the languages, i.e their data types, how they handle arrays & reference variables, and so forth :) ...

Using JavaMail with TLS

I found several other questions on SO regarding the JavaMail API and sending mail through an SMTP server, but none of them discussed using TLS security. I'm trying to use JavaMail to send status updates to myself through my work SMTP mail server, but it requires TLS, and I can't find any examples online of how to use JavaMail to access a...