java

Finding server internet bandwidth thru java for streaming.

Following this thread. http://stackoverflow.com/questions/55709/streaming-large-files-in-a-java-servlet. Is it possible to find the total internet bandwidth available in current machine thru java? what i am trying to do is while streaming large files thru servlet, based on the number of parallel request and the total band width i am tr...

How do I install a specific version of an IDEA plugin?

I have experienced problems since moving to the latest version of one of the IDEA plugins I use. I can download ZIP files of previous versions of the plugin from their website but I can't find any installation instructions for how to manually install a specific version of a plugin. Anyone know how to do this? ...

Tree-like Structure

Hello, I have the following classes: public class Model { protected String name; protected ArrayList<Model> children; public Model(){ children = new ArrayList<Model>(); } public void addChild(Model node) { children.add(node); } //other code here } public class cPackage extends Mod...

Java cipher.doFinal() writing extra bytes

I'm implementing encryption / decryption using Java Cipher and AES. Everything is working well except that there's 5 extra bytes written on the call to doFinal(). So, I end up with a correctly decoded string with 5 extra bytes appended. I believe the reason is that the entire block of 16-bytes is being written. I see 3 16-byte blocks...

Hunt down java.net.SocketException: No buffer space available

Hi I have very ugly problem with: java.net.SocketException: No buffer space available (maximum connections reached?) It is client-server app. Client is Windows XP SP2 32b, with two net cards core duo. Java 1.6. u7. Application have couple server socket open for local communication and couple of client socket for rmi to jboss server. ...

Problem in semaphore being interrupted multiple times

I have a semaphore which restricts users to download n number of files at a time. Each file is downloaded in a separate thread. EDIT: Modified the example so that the release happens correctly import java.util.concurrent.Semaphore; public void downloadFile() { Thread downloadThread = new Thread() { boolean bSemaphoreAcquire...

Unhandled win32 exception occurred in runMidlet.exe

I am using Java ME Platform SDK 3 to start developing Java Mobile application. But I couldn't run a sample application in the emulator. Every time it compiles successfully and an error occurs in the emulator with this message "An Unhandled win32 exception occured in runMidlet.exe [xxxx]". I don't know what to do. I also try to use Netbea...

Saving a file in Java

I have a String that holds a path to a file. I want the users to be able to select a path and filename with a file chooser and have the program save the file given in the String variable to a location of their choice. What is the best way to do this? ...

Good solutions to distribute a pre-configured Eclipse?

I am working with a medium team of developers. So far, everyone has its own version of Eclipse, configured with a slightly different set of plugins and with different configuration options. It is normally a pain to set up a new computer as we have to hunt for a bunch of different plugins and configure everything by hand. Is there a wa...

quick way to add default method permissions for all EJBs specified in ejb-jar.xml

Like the title says, I have a valid ejb-jar.xml. However, for it to be JEE compliant, method permissions need to be present for all beans specified in the file. There are about a couple of hundred beans (I know!, don't even ask) so this is going to be horrible to do manually. Anyone out there have a neat way of doing this (automaticall...

Shortest path between two nodes in a graph (Java)

I have a program with a graph whose nodes represent some processes, and the proccess computing time is the node's cost.This graph is maintainded in memory as a list of nodes and each nod has a list of parent and children, and his execution time. I must find the path with the minimum execution time. Each node can connect with any other...

java file/directory api

Hi, Is there an API that can provide me more in depth information on a file/directory on the disk? For e.g. I would want to know if a drive is a root drive or a floppy drive , a file is a hidden file etc..? Thanks Shafi ...

Using Java's FileInputStream

In java.io.FileInputStream, there is a method int read(Byte[] buffer,int offset,int numBytes); how we can use this function - is there any difference between this method and read(byte[] buffer)? ...

JXTreeTable and JComboBox cell editor...

Jow can I use JComboBox as cell editor in JXTreeTable ? Can you give me a working example please? ...

Assigning different Java versions to different Web Apps on client wkst.

Can/is it possible to open different web apps each calling different java versions? Two web apps that clients browse to via favorites link in IE6 need older versions of java to display properly. ...

<br>? \n? a line break in java

I have three JLabels and three JTextAreas. I have them in borderlayout, center, but I want each of them in a different line, that's not happening and the top ten search results in Google for line break java don't solve the problem. How can I do a simple line break? ...

java.lang.NoClassDefFoundError: com/hp/hpl/jena/shared/BadURIException on running servlet

I get a "java.lang.NoClassDefFoundError: com/hp/hpl/jena/shared/BadURIException" when running a very simple servlet. The error points back to the initialisation of the "Tagger" class. The code is as follows import java.io.IOException; import java.io.PrintWriter; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServl...

What's new in Java as of August 2009?

I've been asked to prepare a presentation for a company meeting with the title "What's New In Java". Any suggestions for content (or references to similar SO questions) would be welcome. For scope: the bulk of the work done by my company is pretty traditional n-tier apps, typically using Java 5 or 6, Spring, Hibernate and a relational d...

How to specify a different column for a @Inheritance JPA annotation

@Entity @Inheritance(strategy = InheritanceType.JOINED) public class Foo @Entity @Inheritance(strategy = InheritanceType.JOINED) public class BarFoo extends Foo mysql> desc foo; +---------------+-------------+ | Field | Type | +---------------+-------------+ | id | int | +---------------+-----------...

Detect Who Created a Thread (w. Eclipse)

How can I find out who created a Thread in Java? Imagine the following: You use ~30 third party JARs in a complex plugin environment. You start it up, run lots of code, do some calculations and finally call shutdown(). This life-cycle usually works fine, except that on every run some (non-daemonic) threads remain dangling. This would...