java

How can I send an email from Java that will auto-expire in Outlook?

I am familiar with sending email from Java programs. Is it possible to configure the email so that Outlook will recognize that it should expire at a certain time? ...

Do you have any recommended plugins for Netbeans?

This is a copy of the question : http://stackoverflow.com/questions/2826/do-you-have-any-recommended-plugins-for-eclipse But now is for netbeans (I'm not a eclipse lover. CTRL+TAB does not change pages.) Please, I'm very curious. ...

Optimize Hibernate entities saving?

Hi Is there a way to reduce unnecessary/empty fields in SQL inserts and SQL updates? For example, I have a single hibernate entity class mapped to a table that has 10 columns. The populating of data is actually done in two phases. When the user submit a request, I will insert the request information into the table with the hibernate ent...

Exchanging of screens between two users

We have a web-based application with tech stack - 1. Java Struts based 2. Hibernate 3. DB - Oracle 4. App server - JBoss server We are facing an issue related to concurrent usage of the application by two or more users. When I am doing an operation and I submit the changes, the next page or success message that comes up is of a differen...

Is it possible to write a decent java optimizer if information is lost in the translation to bytecode?

It occurred to me that when you write a C program, the compiler knows the source and destination platform (for lack of a better term) and can optimize to the machine it is building code for. But in java the best the compiler can do is optimize to the bytecode, which may be great, but there's still a layer in the jvm that has to interpret...

Doubt in FileAppender in log4j API

Hi All, I have created java program which will process different file which coming to the particular folder.In my program, I need to create log file for each incoming file for logging exception for that file. I have used the below code for that. Problem i am facing is for 1st file it creates log file and logging exception. When second f...

How to handle incomplete files? Getting exception

Hi All, I need to create a java program which will create thread to search for a file in particular folder(source folder) and pick the file immediately for process work(convert it into csv file format) once it found the file in the source folder. Problem i am facing now is file which comes to source folder is big size(FTP tool is used t...

How to implement one-to-many relationships in Ibatis?

Let's say I have this Class: Class A { int id; int[] b; // Other properties } Class B { int id; // Other properties } The Class A has one-to-many relation with class B. I already have a service which caches B objects and return them on id. Table schema looks something like thi...

Is System.nanoTime() completely useless?

As documented here, on x86 systems. Java's System.nanoTime() returns the time value using a cpu specific counter. Now consider the following case I use to measure time of a call - long time1= System.nanotime(); foo(); long time2 = System.nanotime(); long timeSpent = time2-time1; Now in a multi core system, it could be that after measu...

Can and How do you use RandomAccessFile with a file contained on an FTP server?

This problem pertains to Java By using RandomAccessFile I intend to be able to also modify the file without blanking it. ...

Is there a good reference for using OLE Automation (from Java)?

I am trying to communicate with Excel from a Java/SWT application. I have been able to open a worksheet, open a file and save it but that's about it. Can anyone point me to some documentation/examples for this? I especially need to know which commands are available. I did try to record macros to inspect. This was useful but did not give...

Java JTree expand only level one nodes

With a JTree, assuming the root node is level 0 and there may be up to 5 levels below the root, how can I easily expand all the level 1 nodes so that all level 1 & 2 branches and leafs are visible but levels 3 and below aren't? ...

What's the difference between ConcurrentHashMap and Collections.synchronizedMap(Map)?

I have a Map which is to be modified by several threads concurrently. There seem to be three different synchronized Map implementations in the Java API: Hashtable Collections.synchronizedMap(Map) ConcurrentHashMap From what I understand, Hashtable is an old implementation (extending the obsolete Dictionary class), which has been ad...

JGoodies Binding vs. JSR 295

Hello, What is the practical difference between JGoodies Binding and JSR 295, Beans Binding? They both seem to be intended for the same purpose and get their job done (with slightly different approaches). JGoodies Binding is more mature, but JSR 295 is eventually getting part of JDK in Java 7. Using a standard part of JDK is surely pre...

Inheritance in Java - "Cannot find symbol constructor"

Hi I'm working on a class that inherits from another class, but I'm getting a compiler error saying "Cannot find symbol constructor Account()". Basically what I'm trying to do is make a class InvestmentAccount which extends from Account - Account is meant to hold a balance with methods for withdrawing/depositing money and InvestmentAcco...

Real-time Java interoperability

I am wondering how it's the interoperability between JRE6 and the JVM from rtsj. It seems that I have to use only their implementation (since the code will be interpreted using their JVM), so I cannot use many of the features that Java 6 has to offer. Can it support a GUI? (say for example to modify the parameters of an industrial proces...

How to throw an informative exception from AccessDecisionManager that uses voters

Hi all, I have the following situation: my application's authorization mechanism is implemented using Spring security. The central class implements AccessDecisionManager and uses voters (each of which implements AccessDecisionVoter) to decide whether to grant access to some method or not. The algorithm that tallies the votes is custom: ...

Compiling and Executing Java Remotely

In my company I have many guys who want to learn Java. They don't have the admin rights to install anything. They don't even have the JRE. Is it possible for them to compile and execute their Java programs from a PC which has the JDK and JRE? Thanks a bunch in advance! ...

Custom Spring sterotype annotation with scope of prototype?

Hi I created a custom sterotype @Action, and Spring has managed to detect it in the package scan I configured in the configurations. The next step I would like to do is to tell Spring that all classes with @Action should be created with prototype, instead of Singleton. My @Action interface is as follows: @Target({ElementType.TYPE}) @R...

How to by-pass inheritance in java when invoking a method

class Super { public void anotherMethod(String s) { retValue(s) } public String retValue(String s) { return "Super " + s; } } class Sub extends Super { public void anotherMethod(String s) { retValue(s) } public String retValue(S...