java

PostMessage() alternative in Java(Android)

Hi, I am rewriting the existing C++ application and adapting it for Android environment. In the code there is a PostMessage statement: PostMessage( bExitApp ? WM_CLOSE : WM_LOGIN, wParam, lParam ); Does anyone know what is the most appropriate way to achieve tha same result in Android (Java)? Is it well enough to create two methods...

Factory pattern in java

Hi, I was working with java code that is supposedly using the Factory pattern, but I'm not completely convinced by the pattern. My code does this: // the factory class SomeFactoryImpl { Set<SomeClass> getSomeListOfObjects(); } And somewhere in the code: { ... SomeFactory factory = new SomeFactoryImpl(); Set<SomeClass> li...

questions on KVM(JVM)

is it possible different KVMs in different mobiles?who is the owner of that KVM(sun or others?suppose if i want manufacture GSM mobile,how can it support j2me applications, i have to get permissions from sun micro systems to purchase KVM(kilobyte virtual machine) can anyone give answer in detail? ...

delete temporary file in java

I'm creating temporary file in java but i'm unable to delete it. This is the code I have written: temp = File.createTempFile("temp", ".txt"); temp.deleteOnExit(); fileoutput = new FileWriter(temp); buffout = new BufferedWriter(fileoutput); ...

In servlet destroy() is called first or finalize()?

Hi In a servlet, is destroy() called before or after finalize()? ...

Are there some good and modern alternatives to Javadoc?

Let's face it: You don't need to be a designer to see that default Javadoc looks ugly. There are some resources on the web which offer re-styled Javadoc. But the default behaviour represents the product and should be as reasonably good-looking. Another problem is the fact that the usability of Javadoc is not up-to-date compared to ot...

How do i change the UI of a JComboBox

I like to change the UI of a JComboBox from the default metal look to some custom UI, see attached image. I have tried changing all the UIDefaults for the JComboBox but to no success. How does one achieve this? jdk1.4.2 ...

Session Bean doesnt work

I have Session and want to load DATA from an InfoHolder Class .. called Benutzer but it doesn't Work ! /* * SessionBean1.java * * Created on 21.06.2009, 16:03:41 */ package egispartnerprofile; import com.sun.rave.web.ui.appbase.AbstractSessionBean; import group52.infoholders.Benutzer; import javax.faces.FacesException; /** * <p...

Static files in (Java) App Engine not accessible.

The example documentation says that you simply need to place your files in war/ (or a subdirectory) and they should be accessible from the host (as long as they aren't JSPs or in WEB-INF). For example, if you place foo.css in war/ then you should be able to access it at http://localhost:8080/foo.css. However, this isn't working for me at...

Getting a list of all classloaders in a JVM

Is it possible to get a list of all class loaders in a JVM or at least all class loaders associated with web apps in a JEE Server (Weblogic in my case). ...

How can I execute a Windows batch file as a separate process from Java?

I'm writing a class in Java which will be calling a Windows batch file. When I run this class, the batch file is getting opened and getting closed. How can I make the batch file continue to run after the Java program terminates? ...

How to convert a map to list in Java?

What is the best way to convert a Map<key,value> to a list<value>? Just iterate over all values and insert them in a list or am I overlooking something? ...

Printing two Jpanels in one document

Hi, I have two different Panels but i have need to send them in one document in to two pages. first page print at front and the second will print at the back side can anyone please help me i have send one jpanel but how to send second with it. Here is my code private void printCard() { PrinterJob printjob = PrinterJob.getPrinte...

How to convert a byte array to its numeric value (Java)?

Hi everyone, I have an 8 byte array and I want to convert it to its corresponding numeric value. e.g. byte[] by = new byte[8]; // the byte array is stored in 'by' // CONVERSION OPERATION // return the numeric value I want a method that will perform the above conversion operation. ...

How do I get a list of all package names loaded by the JVM

I need to get names of all java packages loaded by the JVM. This is to display a package browser like the ones found in IDEs. I can get the package list of the current classloader and its ancestors by accessing protected "packages" field of the ClassLoader class. But i'm unable to get the packages loaded by other webapps as they have the...

How to redirect to Login page when Session is expired in Java web application?

I'm running a web application in JBoss AS 5. I also have a servlet filter which intercepts all the requests to the server. Now, I want to redirect the users to the login page, if the session has expired. I need to do this 'isSessionExpired()' check in the filter and need to redirect the user accordingly. How do I do it? Edit: I'm setti...

how to make setup file

hi.....i have made an application using java....my source is in .java file ...now i want to create a setup file from these source files.... so can anyone tell me how i can make this setup files like another softwares...like device driver....etc... please co-operate me.... ...

Method name from line number

Given a line number of a particular class source code (Java/C#) - is there an easy way to get the name of the method it falls within? (If it falls within one) (Presumably using an Abstract Syntax Tree) (This would be useful in limiting the output of checkstyle to just the method touched). I'm assuming you'd have to use an Abstract Syn...

How to Generate a Map in Java?

I trying to complete a RPG game for a project, but have no idea on how to make the game map. It doesn't need to be graphical, but the code for the whole map and each tile must be correct. So far, I thought about making a non-matricial map (as request by the professor) by using an ArrayList which contain all the linked tiles. public abs...

Eclipse SWING app: breakpoint hit only after an uncaught exception is thrown

I have a really strange issue. I am working on a Java SWING application in Eclipse. I set a breakpoint somewhere in my code, then run the debug. I execute the piece of code containing the breakpoint but it is always skipped. As soon as I run some code that throws an uncaught exception, the breakpoints start being hit again, without cha...