java

Java - encrypt / decrypt user name and password from a configuration file

We are busy developing a Java web service for a client. There are two possible choices: Store the encrypted user name / password on the web service client. Read from a config. file on the client side, decrypt and send. Store the encrypted user name / password on the web server. Read from a config. file on the web server, decrypt and us...

C#/Java portability

What mainstream frameworks, patterns, and tools would you choose to develop two projects in parallel, one in C#, one in Java, in order to minimize the total effort. (Disregard the obvious cases of interchangeable or equivalent tools, like SCC, Unit Testing, etc. Also assume generic broad RDBMS support.) "Mainstream" means the market in ...

Two questions on inner classes in Java (class A { class B { } })

Sorry for the bad title, but I couldn't think of a better one. I'm having a class A and a class B which is kind of a sub class of A, like so: (Is there actually a correct name for it? Isn't "sub class" reserved for inheritance?) class A { int i = 0; class B { int j = 1; } } class Test { public static void main...

How do I ensure a value being updated with Hibernate hadn't been changed in the meantime since I read it?

I have a problem where I want to read an object from the database using Hibernate, change a value, and save the object. If changing the value takes some time, what's the best way to ensure the underlying object in the database has not changed? I am doing this in one transaction (and one session). The code looks something like: // Load...

java session variables

i'm hearing that some people believe storing info on the server in a session is a bad idea, that its not secure. as a result, in a multi-page business process function, the application is writing data to a db, then retrieving the info when its needed. is there something necessarily unsafe about storing private info in a session? ...

Looking for a job scheduler for Java environment

hi, We are developing a web application using java,Struts2.0,Apache web server and a Postgres Database. I need a requirement to run a scheduler dynamically(Morning and Evening) so that i can insert updated data in to the database and generate the report on daily and monthly basis. please reply me soon as this is immediate requirement....

Java generics - type erasure - when and what happens

I read about Java's type erasure on Sun's website (http://java.sun.com/docs/books/tutorial/java/generics/erasure.html). I have the following question : When does type erasure occur - at compile time / runtime:when the class is loaded / runtime:when the class is instantiated. A lot of sites (including the Sun tutorial mentioned above) ...

What is the equivalent of Java's AbstractMap in C#?

I need to create an object which exposes an IDictionary<K,V> interface, but I don't want to fill in the entire interface implemntation. It would be nice to have the equivalent of Java's AbstractDictionary, which leaves you very little to impelment a complete dictionary (HashMap, in Java): If you don't need to iterate the collection, y...

Possible to duplicate current java stack using JNI

I am trying to record the arguments passed to a method before it is called using bytecode instrumentation. Currently while instrumenting using java code I have to first pop all the args into a locals, then push them again twice (once for my method which will record and in this case all primitive types have to be converted to their boxe...

Needed: tomcat + axis2 + JAX-WS guide for dummies

We are working with tomcat + axis2 + POJO for web service implementation, and we encountered some issues with POJO and axis2 that are a show stopper for us. It seems that axis2 and POJO implementation of SOAP parsing ignores the names of the xml elements and just assign values to the arguments according to the order of the xml elements i...

Find composite location on screen

I am implementing a on screen keyboard in Java for SWT and AWT. One important thing is to move the keyboard to a position where the selected text field can show and is not lying behind the on screen keyboard. For AWT i can detect the position of the current selected component with Component owner = KeyboardFocusManager.getCurrentKeyboa...

A better way to do Swing Applications

Is there a better way to develop Java Swing applications? SWIXML? JavaFX? Anything else that developers out here have liked and recommend? ...

mixed java version JTable

Hi, I would like to use the JTable row sorter new in Java 6. But also I need it to be compatible in Mac OSX with Java 5. Is it possible to find out the JVM version during runtime and use different code for the JTable with and without row sorter? ...

Why do I keep getting a NullPointerException in the Java BasicTableUI$Handler.setValueIsAdjusting?

I keep getting this NPE in my application and I can't seem to get rid of it because it is not showing up in any of my source code. As you can see from the stacktrace it is not happening in my code but in the Swing plaf. Has any of you had this problem and maybe figured out what is happening here? 11:28:23,273 [AWT-EventQueue-0] ERROR...

Plugging in to Java compilers

I have a post-compilation step that manipulates the Java bytecode of generated classes. I'd like to make life as painless as possible for library consumers, so I'm looking at ways I can make this process automatic and (if possible) compiler agnostic. The Annotation Processing API provides many of the desired features (automatic service ...

Which are the must-have-newsletters subscriptions for .net/java programmers?

I think there are several newsletters which are very good in content. EDIT: Such as http://www.javaspecialists.eu/archive/archive.jsp ...

method visibility between classes in java

In Java (And in general) is there a way to make a class so public that it's methods etc... are accessible from little classes all around that don't even instantiate it? Ha, what I mean is... If I have a daddy class that has a method draw() and it instantiates a baby class called Hand and one called Deck, and then deck instantiates a babi...

Setting unicode characters in java frames

How to display unicode characters (e.g. japanese) in the title of a JFrame in java swing in a Windows XP m/c without the Japanese language pack? It looks like setting the title text to Japanese unicode characters and the font to MS Mincho is not enough. While this is all you need to do to display unicode characters in Swing labels? ...

Cool or Stupid? Catch(Exception[NamingException, CreateException] e)

I was writing some code, and I notice a pattern in the exception handling that got me thinking: try{ // do stuff... throws JMS, Create and NamingException } catch (NamingException e) { log1(e); rollback(); doSomething(e) } catch (CreateException e) { log1(e); rollback(); doSomething(e)...

Parsing XML with XPath in Java

I have a XML with a structure similar to this: <category> <subCategoryList> <category> </category> <category> <!--and so on --> </category> </subCategoryList> </category> I have a Category class that has a subcategory list (List<Category>). I'm trying to parse this XML file with XPath, but I can...