java

SQL data and JTable

I'm trying one sample program for practice and i want to display results of database in JTable. The problem is i have no idea how to do that. I know how to get data from database and display it on text field or console but never tried with JTable. How to do that ? Consider that i've table which is holding information like person name, ...

When does garbage collection happen for a class with static data

I want to make some data easily available throughout my application. I have a few variables in a class with static data, which get written to and read from at several different points. This worked fine for a while, but now at one point where I expect to be able to retrieve an ArrayList all I get is "null". I am wondering if the static ...

eclipse view classes dependency graph plugin?

is there any plugins i can use for eclipse that will show graphical view of classes dependencies ? ...

How to add one day to a date?

I want to add one day to a particular date. How can I do that? Date dt = new Date(); Now I want to add one day to this date. ...

Construct a tree structure from list of string paths

I have a collection of string paths like ["x1/x2/x3","x1/x2/x4","x1/x5"] in a list. I need to construct a tree-like structure from this list which can be iterated to get a pretty printed tree. like this x1 | |-x2 | | | |-x3 | | | |-x4 | |-x5 Any ideas/suggestions? I believe that the problem can be attacked first by processing the ...

How to convert DateTime to Date

How can I convert Date to DateTime and vice versa? E.g. Date dt = new Date(); Now I want to covert this to DateTime. Also DateTime dtim = new DateTime(); Now I want to convert it to Date. ...

How to use Java pakages with Groovy

I'm at school and we are doing this java stuff. We use a special library named sum.kern: http://www.mg-werl.de/sum/bjw.zip I want to use Groovy instead of Java. But I can't get groovy to use this library. If I add the jar in grape and try to import sum.kern and create a sum.kern.Bildschirm it says that it is not able to find it. How to ...

DateTime package

in which package is DateTime defined what i need to import ? ...

SELinux and JAVA

Are there any best practices to handle Java applications with SELinux? Is it able to configure SELinux for each Java App or can only the VM be handled because it makes the finale system calls? thanks ...

filerering / replacing single quote in java

how do i filter single quote ' in java. I am haveing a search box . if anyone types a single quote ' in that box i am geting a databsee error. i dont want to filet it in javascript or at Database level, i want to do it in java only how can i do that i dont want to loose it completely, is there any other way. wil replacing the quote wit...

How to change this regex to properly extract tag attributes - should be simple

I need to "grab" an attribute of a custom HTML tag. I know this sort of question has been asked many times before, but regex really messes with my head, and I can't seem to get it working. A sample of XML that I need to work with is <!-- <editable name="nameValue"> --> - content goes here - <!-- </editable> --> I want to be able to g...

Use HashSet over ArrayList to Convey Intention?

Imagine that I need to create a Collection of elements, where order could or could not matter. Effectively all I plan on doing is using the iterator. I notice most of my colleagues using an ArrayList vs LinkedHashSet/HashSet. My question is, if I know that these elements should be unique, should I be using a Set or a List? Effectively it...

Calling matlab callback/function handle from Java

How do I pass a matlab function handle to a Java object and invoke it from within Java (that is, I want Java to tell matlab when it is ready with a calculation). I am trying to use the com.mathworks.jmi.Matlab class for evaluating Matlab expressions in the Java object, but I can't see how to 1) transfer the callback funcktion handle to J...

Java: Should I add an @Override annotation when implementing abstract methods?

When overriding a virtual method in Java, use of the @Override annotation is recommended, but what if I implement an abstract method? Should I use @Override then as well? ...

wsdl + svutil

I need to resolve a pcakage import in java.. but the package was not present.. Then i later found that I have to use some wsdl file to genrate the pacakage.. I have a link fo that wsdl file.. How to use svcutil to generate that pacakage/ resolve the imported pacakage... D:\Profiles\pdk473\Desktop>svcutil /t:metadata http://service/meta...

How to install Java class on Oracle on Solaris

I have simple java class that calculates SHA1 and I want to use it from PLSQL procedures in Oracle. Following advises from : SHA1, SHA256, SHA512 in Oracle for free without using DBMS_CRYPTO (my simple case use unly SHA1 and do not need any jars and consist of only sha1.class that imports java.security and java.io) I compiled sha1.java ...

axis - how to access it?

Hi I have axis in webapp and I can access http://localhost:8080/oop/services/test2?wsdl correctly. I wrote client: import org.apache.axis.client.Call; import org.apache.axis.client.Service; import javax.xml.namespace.QName; public class TestClient { public static void main(String [] args) { try { String...

What is the default encoding of jvm?

Whether the default encoding for jvm is UTF-8 or some other? In jvm where it will be mentioned? ...

Java Interface, AbstractClass and Enum code convention

hi all: we are having this discussion in our team about code conventions for java for interface: should it be Foo or IFoo or FooInterface abstract: Foo or AbstractFoo or ? Enums: Foo or FooEnum I m basically trying to put my personal preferences aside :) so reasons to back up one or other convention are very welcome Cheers ...

Is memory management in different languages similar enough to transfer my knowledge?

I'm just starting to learn programming. And as of now, I know a tad bit of memory management in Objective-C. It wasn't easy learning it. So, just out of curiosity, is the memory management employed in major languages like C, C++, Java, etc., in any way similar to what I've learned? ...