java

System.getProperty("user.language") always return "en" not user current Language settings

Hi, This is now drying me mad. I have a javaApplet on top of a asp.net page. Within this javaApplet I must detect the user preferred language FireFox-Tools-Options-Content-Languages-Choose.I have 3 languages in there and the firstOne is Spanish/Spain[es-ES]by doing the following String locale= System.getProperty("user.language")+"-"+...

How do I differentiate between request and response in an HTTPURLConnection?

Hi I need to evaluate if a server supports gzip compression. Therefore I want to set gzip as Accept-Encoding in my request and evaluate if the response of the server containts "Content-Encoding: gzip". However I am not quite clear on how to do this with HTTPURLConnection. Especially when to query my Connection object about the respons...

How to manage multiple versions of same class file for different SDK targets?

This is for an Android application but I'm broadening the question to Java as I don't know how this is usually implemented. Assuming you have a project that targets a specific SDK version. A new release of the SDK is backward incompatible and requires changing three lines in one class. How is this managed in Java without duplicating an...

Is it possible to decouple the code indexing capabilities of Eclipse?

I am looking to write a static analyser for a university class. To provide more power for the tool I would like to be able to look up the call hierarchy (as Ctrl+Alt+H does in Eclipse). This would also have to be a fast operation, so the lookup would probably have to be done against an index rather than bytecode scanning. However, writi...

Using GPB, how do I make my wrapper classes stop accepting binary messages that aren't meant for them?

I'm using Google Protocol Buffers to serialize some of my business objects (in a Java app). As recommended in the tutorials, I wrap the message builder in a class of my own that implements getter and setter methods to access the message's properties. Also, I declared all message fields optional, again following their recommendations. No...

How to Check References of Annotated Methods

I'm trying to find a way to check my classes for references of methods with a particular annotation (think "Deprecated"). As far as i see it, analysing byte code won't work because it doesn't contain any annotations. Using APT doesn't really help because i need the references to the methods, not the annotated methods themselves. So, wh...

'Remove middleman' IntelliJ refactoring on an empty interface

I have an interface which is now empty, and extends another interface. I'd like to remove the empty interface and use the base interface, and am trying to find the correct refactoring in IntelliJ. I've tried "remove middleman" but got "cannot perform the refactoring. The caret should be positioned at the name of the field to be refactor...

How to test drive a networking application with custom protocol?

I'm currently developing two Java networking applications for school projects. One over TCP and the other one over UDP. In both I have to implement simple custom protocol. Even though I'm trying pretty hard, I can't find a way how to correctly test this kind of apps, or better develop with test first development. If I have a client and...

jna call to kernel32.CreateToolhelp32Snapshot in shutdown hook crashes the VM

If a thread sets a shutdown hook using Runtime.getRuntime().addShutdownHook(); calls via jna the method: kernel32.CreateToolhelp32Snapshot (0x00000002, 0) it crashes the VM. If I call the same method in the WindowListener.windowClosing() hook, the call does not crashes the VM. Any idea why? I can post part of the VM crash e...

WebOrb/Flex: How to call a method on a RemoteClass returned by a RemoteObject

I have a RemoteObject returning a 'Schedule' class. I've created a client side RemoteClass to map to it. All properties of the class instance are coming in fine. I just not clear on how I go about calling methods on the class. How would I call a setter on startdate? package classes.remote { [Bindable] [RemoteClass(alias...

What do you monitor with JMX in your production java application?

This question is not about how JMX works or what JMX does. This question is about applications of JMX in standard application server environment in production. It is not for specific server either. What do you monitor with JMX in production environment that runs standard stack of JEE services: database access (JDBC and JPA), session EJ...

Richfaces suggestionbox

I'm trying to use a List of SelectItems with RichFaces suggestionBox component. The problem is I need to store the id rather than the label of the SelectItem. It seems that the suggestionBox always stores the label and that's causing a problem. Is there a way out of this problem? ...

how to build javascript debugger with the java scripting engine

Possible Duplicate: is it possible to build a debugger around the java scripting engine? Duplicate of is it possible to build a debugger around the java scripting engine? hi, i have enabled in my application to write java script code and for that i have used the java scripting engine, as the next step i would like to enable c...

Possible to create JSR 286 portlet using Coldfusion?

I was just thinking this morning, since ColdFusion is essentially built on JAVA, is it possible to create JSR 286 portlets using coldfusion? A search revealed that it might be possible, but I cannot find any material on this? Reason I ask is because I would love to be able to create Liferay compatible portlets with ColdFusion, as I am ...

Implementing DLNA/UPnP (Win7 Play To) on a mobile device

Hey all, For a semester project, I had the idea to implement Windows 7's Play to infrastructure to either use a phone as the end point (the player) or to stream stuff from the phone to a Windows 7 machine. Does anybody have experience working with this API? Is this do able over a couple of weeks (prototype, just proof of concept, not ...

install java se 6 on a mac without software updater

hello guys i've come from a very long issue where i was obliged to remove the /System/Frameworks/JavaVM.framework/Versions/1.6.0 and the 1.6. now i downloaded the JavaForMacOSX10.5Update1, because it's not available anymore on the software updater, and run it.Now i can't find it in /System/Frameworks/JavaVM.framework/Versions/ where i'm ...

Spring 3 Collection Binding

How I can bind a collection to a form for inputdata (not for show) ...

Enum with int value in Java

What's the Java equivalent of C#'s: enum Foo { Bar = 0, Baz = 1, Fii = 10, } ...

Using JaaS with Jersey on Grizzly

I'm trying to find a simple, flexible way to add JaaS authentication to REST. I found a post that I think leads me in the right direction (See StevenC's answer). It sounds like the servlet container is responsible for security, not the Jersey code itself. I like this idea, but need a little guidance on implementation. Grizzly is my s...

Java: JTable adding and moving columns

Hi, im quite new in Java. I want to add Columns in a JTable at a specified index. For this i am using addColumn(..) and then move them with moveColumn(...), this works great at the first time, but when i add another column it kind of moves also the other(before added columns). Do you have any suggestions? this is the code i've written...