java

Why can't solr 1.3.0 install using CentOS, plesk 9.2.1 and tomcat 5.5?

Ok I just setup a dedicated server for my client through his hosting provider. They have plesk installed on there (version 9.2.1) and one of the caveats of this dedicated server is that if i do anything OUTSIDE of the control panel (i.e. use SSH) for any task they do not guarantee support for that software component. That's fine because ...

Is a visitor to my website coming from a search engine? What were their search terms?

I'd like to display my page differently for the visitor based on if they came from a search engine or not. I guess I'm detecting search engine referrals? I'd also like to know the search terms used to arrive at my site. My solution so far is this: 1) Filter on the HTTP request referers which contain common search engine URLs, i.e. http...

Protecting Java jar Files for Distribution

I'm working on an application that I will soon be publicly distributing. I would like to do anything in my power to make sure those who download my program do not reverse engineer it. I understand that distributing a .jar file is highly insecure. Can anyone recommend a platform independent way to distribute my Java application? Also, I ...

JDO integration with hibernate

in JPA, to use hibernate, the only thing need to do is moodify persitence.xml and add in hibernate configuration. May i know with JDO, can just by modifying jdoconfig.xml, able to integrate with hibernate? any reference or example on this? ...

Best Practice to Use HttpClient in Multithreaded Environment

Hi all, All the while, I am using HttpClient in multithreaded environment. For every threads, when they initiate a connection, they will create a complete new HttpClient instance. Recently, I discover, by using this approach, it can cause the user is having too many port being opened, and most of the connections are in TIME_WAIT state....

How to use JarOutputStream to create a JAR file?

How does one create a JAR file programmatically using java.util.jar.JarOutputStream? The JAR file produced by my program looks correct (it extracts fine) but when I try loading a library from it Java complains that it cannot find files which are clearly stored inside it. If I extract the JAR file and use Sun's jar command-line tool to re...

How do I get FutureTask to return after TimeoutException?

In the code below, I'm catching a TimeoutException after 100 seconds as intended. At this point I would expect the code to exit from main and the program to terminate but it keeps printing to the console. How do I get the task to stop executing after timeout? private static final ExecutorService THREAD_POOL = Executors.newCachedThreadP...

Odd Annotation Error

I have set up an annotation that will be used to keep track of classes, however I am getting an error when I try to compile any java code that uses the annotation. Here is the annotation code: package tlib.anno; import java.lang.annotation.*; @Retention( RetentionPolicy.RUNTIME ) @Target( ElementType.TYPE ) public @interface Class {...

How do you use Objective-C starting from the "Java JNI Application" template in XCode?

I want to use the NSStatusBar object from my Java application using JNI. I know there's some existing libraries out there but I've tried them and they don't have the correct drop down menu. I'm starting from the "Java JNI Application" template in XCode and I simply put NSString *str=@""; to see if it could compile but this produces ...

Java dynamic casting for overloaded methods

I'm attempting to create a function where I can pass names and values that will be put into a ContentValues. The problem i'm having is that I'm trying to allow passing more that one key/value pair at a time, so keys can be an array of strings, but values have to be objects and ContentValues.put() doesn't allow Objects, they need to be ca...

use java-ffmpeg wrapper, or simply use java runtime to execute ffmpeg?

I'm pretty new to Java, need to write a program that listen to video conversion instructions and convert the video once an new instruction arrives (instructions is stored in Amazon SQS, but it's irrelevant to my question) I'm facing a choice, either use Java RunTime to exec 'ffmpeg' conversion (like from command line), or I can use a ff...

Netbeans: How do I let additional files be included into the created JAR?

Hello! Netbeans doesn't allow me to specify, which files I want to have additionally included inside the JAR. Can I work this around by editing the manifest.mf? Or by editing build.xml? What else could be done? EDIT I need the files to appear in jar's root (files such as LICENSE.txt or some exec script), because otherwise they would...

Memory leak traps in the Java Standard API

What classes of the Java Standard API can cause memory leaks when used in an (not obviously) incorrect way? And how can these memory leaks be avoided/fixed? Example: ObjectInputStream and ObjectOutputStream keep references to all objects they have seen in order to send subsequent occurences of the same object as references rather than c...

Hibernate,Spring and Struts, No session bound to thread

Hi all, just a simple question about a great problem... In my web app i use Struts, Spring and Hibernate. I've a lot of Business (classes that edit the database with Hibernate), many action that interact with Business. In Spring configuration i've inject SessionFactory in Business and the Business into Actions. When I call a busines...

How to find out the instance when component resize is complete

In my application I fetch data if component is resized. I want to delay the fetch till user completes resize operation. ComponentListner event componentResized fires every time the window is resized. ...

Connecting Java se Client to Glassfish

We are having some difficulties connecting our Java SE standalone client with the EJB module deployed on a remote GlassFish server. Pointers to how we are supposed to connect our client would be appreciated. The client code we currently has to get the initial context: props.setProperty("org.omg.CORBA.ORBInitialHost", "*remotehost*"); ...

How to modify, without any loop, a collections values to get a new collection?

How do I, without using any loop, modify the values in a collection to get a new collection with the modified values? For example, I'm having a Collection<String> and want to surround all Strings by parentheses. With a loop I would do this: Iterable<String> collection = getCollection(); ArrayList<String> newCollection = new ArrayList<...

Adding a child component to a JButton

Is it possible to place a child component inside a JButton and make it transparent to a subset of mouse events so that: The child component receives MouseMotionEvents (so it can respond by modifying a displayed image) Clicking still depresses the JButton "behind" the child component If you add the child component to the button but ma...

JPA fastest way to ignore a field during persistence?

I'm essentially looking for a "@Ignore" type annotation with which I can stop a particular field from being persisted. How can this be achieved? ...

Detecting drops from the same process

Hi there, Is it possible for a class implementing DropTargetListener, to detect whether the stuff being dragged comes from the same process of from elsewere? ...