java

AutoIndent in Eclipse possible?

I have been wracking my brain trying to figure this out. For the first time I used jEdit the other day and I was pleasantly surprised that it auto indented my code (meaning that I'd put in the following code: int method () { _ //<-- and it put me here automatically I've tried to get the same thing working with eclipse but with no ...

"Exception in thread "main" java.lang.NullPointerException when adding to a HashMapList

HashMapList keeps its elements inside a HashMap) and when I call add method this error message will be shown in the concole "Exception in thread "main" java.lang.NullPointerException public class HashMapList<K, V extends Product> extends AbstractList<Product> { public V element; public int index; Map<Integer, V> map; public HashMapLi...

When and why we have to implement Comparable interface??

in which situations we have to implement the Comparable interface? ...

In which language java compiler, jvm and java is written

Hi can you please let me know in which language the Java compiler, virtual machine (JVM) and java is written. ...

Download servlet issue with ie 6

I need to write a download servlet in java to download a file from the web server. I am setting the response parameters as follows: resp.setContentType( (mimetype != null) ? mimetype : "application/octet-stream"); resp.setContentLength( (int)f.length() ); resp.setHeader( "Content-Disposition", "attachment; filename=\"" +...

Calling a function every 10 minutes

I'm not an expert, just a beginner. So I kindly ask that you write some code for me. If I have two classes, CLASS A and CLASS B, and inside CLASS B there is a function called funb(). I want to call this function from CLASS A every ten minutes. You have already given me some ideas, however I didn't quite understand. Can you post some e...

Not loading images from the web in a html document?

Hi, is there an easy way to dell htmldocument (inside a JTextPane) to not load images from the web? i cant think of anything smarter then to simply remove the tags or similar. and cant seem to find any "build in" functionality for it. ...

Is it possible to place the header row of a JViewport at the bottom?

I'm using a JViewport for viewing some data and I'd like the header row to be placed at the bottom of the JViewport rather than the top. The viewport never scrolls horizontally so the issue of where the scroll bar would go isn't a problem. I suspect I'm going to have to make my own JViewport-like class which has the header row at the b...

How does semaphore work?

Hello, Can the semaphore be lower than 0? I mean, say I have a semaphore with N=3 and I call "down" 4 times, then N will remain 0 but one process will be blocked? And same the other way, if in the beginning I call up, can N be higher than 3? Because as I see it, if N can be higher than 3 if in the beginning I call up couple of times, t...

Java concurrency : Making webservice access threadsafe

Hi I'd like to know the correct / best way to handle concurrency with an Axis2 webservice. Eg, given this code: public class MyServiceDelegate { @Resource UserWebService service; // Injected by spring public CustomerDTO getCustomer() { String sessionString = getSessionStringFromCookies(); service.setJSES...

Abstract class and Interface class?

Hi, I'm new to Java. Why are abstract or interface classes created, or when should we use abstract or interface classes? ...

How to get subnet mask using java ?

how to get Subnet mask address of local system using java programming.? ...

Parent And Children Relationship

Hello Guys, I am haveing this problem with my application and need help. I have data from the server in this form Food Apple Fruit Seed etc.. Table Chair pen School et.. ... Food Mango Peer Melon etc.. Reading from the left, i want to make for eg; in the first row, Food parent of Apple Apple parent of Fruit Fruit...

Does the maven-dependency-plugin use some other kind of artifact resolution than the rest of maven?

If I use the maven-dependency-plugin plugin, than I can't use a version range. Also it seems the version of a there defined artifact doesn't get updated though a newer version is in the remote repository. Why is that so? Uses the maven-dependency-plugin some other mechanism than the rest of maven to resolve dependencies? And if that is...

Alternative to JUnit in Android

hi , As there is JUnit test tool for Desktop java is there some thing similiar in android so one can apply on android also . Thnx in advance. ...

Building A Tree Like Structure

Hello Guys, I just posted the following question but i made a mistake. What i want is not how to use Eclipse but how to build the tree-like structure. An element can have more than one children. So show me how to build the tree; It is not actually tree but to build the structure as i have show below. Thanks I am haveng this problem...

Getting multiple guice singletons of the same type

can you get 2 singleton instances of the same underlying type? this is obviously trivial in spring as it is based on named instances to which you attach a scope but I can't see the equivalent in guice which is about binding types to implementation classes. Note that I don't want to have to bind to the instance as the instances in quest...

No parameters on DWR methods signature

Hi, I'm having some ERRORS at runtime, from DWR methods with no parameters. The error looks like: [exec] 12:21:56,372 ERROR [SignatureParser] Parameter mismatch parsing signatures section in dwr.xml on line: public String MyOwnClassName.myOwnDWRMethod() How can I avoid this error? I mean, is there anything erroneous in the...

Interpolation over an array (or two)

I'm looking for a java library or some help to write my own interpolation function. That is I have two arrays of doubles which are potentially different sizes, but are ordered. I need to be able to make an estimate of intermediate values, and insert so that both arrays become the same size. In fact the total number of points appearing...

How let OSGi (Config Admin) persist/reuse your configuration?

I'm new to OSGi. My aim is to create a structure with the config admin, so you can enter a configuration, which will be reused after restarting the server. While I have read the api and tried some samples, I thought this feature will be included by default. My question to you: Is this possible at all and if yes: what have I to consider...