java

What's the upcoming Java concurrency library: jsr166y? jsr166z?

Hello! I wanted to play around with the upcoming concurrency library which is going to be included in Java 7 according to this website. It seems to be named JSR166. In most places its reference implementation is referred as jsr166y, while few resources call it jsr166z. I discovered two totally different javadocs for each reference im...

SQL Server 2000 blocking problem solved by running profiler?

We are working on a large Java program that was converted from a Forte application. During the day we are getting Blocking SPID's in the server. We had a DBA visit yesterday and he set up a profile template to run to catch the locking/blocking action. When we run this profile the blocking problem goes away. Why? This application is dist...

Is Red Hat's JBOSS a fork of the code you get from JBOSS.org?

Does anyone know if Red Hat has forked the code you download from JBOSS.org? I'm guessing that the answer is "yes", but I'd like to confirm it. I can't pin it down at the Red Hat site, and jboss.org giving me an HTTP 502 right now for some reason. I know that Red Hat owns JBOSS. Does that mean that the code they sell in JBOSS Develo...

Java URL Connection blank input stream

The application I am working on has a terribly slow loading web page. If I run the following code it works fine but only because of the call to sleep. If I don't sleep then the InputStream is just a bunch of spaces, probably due to the application it is calling from. Is there any non-hack way around this? public class PublishTool e...

Whats the best way to make this Java program?

This the description of the program brief: Produce a software that keeps track of courses taught by lecturers at College. For each course, a course code and title needs to be recorded, as well as a list of lecturers taking that course needs to be recorded. The system should allow courses and lecturers to be added and removed from the...

server configuration questions...

Please pardon my non-understanding here. I have a local mysql server and I need to be able to access that data over an encrypted channel from a java web application running on a web host. Can anyone recommend the best way to do this? Thank you! Joshua ...

maven deploy additional jar file

I have an artifact which is being built and deployed in a particular way (not as a jar file). In the course of deployment, a war file is built. How can I configure the pom so that the artifact is also deployed as a jar file, to a different location? ...

Remove from a HashSet failing after iterating over it

I'm writing an agglomerative clustering algorithm in java and having trouble with a remove operation. It seems to always fail when the number of clusters reaches half the initial number. In the sample code below, clusters is a Collection<Collection<Integer>>. while(clusters.size() > K){ // determine smallest distance b...

Convert an array of primitive longs into a List of Longs

This may be a bit of an easy, headesk sort of question, but my first attempt surprisingly completely failed to work. I wanted to take an array of primitive longs and turn it into a list, which I attempted to do like this: long[] input = someAPI.getSomeLongs(); List<Long> = Arrays.asList(input); //Total failure to even compile! What's...

Regex to replace characters that Windows doesn't accept in a filename.

I'm trying to build a regular expression that will detect any character that Windows does not accept as part of a file name (are these the same for other OS? I don't know, to be honest). These symbols are: \ / : * ? " | Anyway, this is what I have: [\\/:*?\"<>|] The tester over at http://gskinner.com/RegExr/ shows this to be work...

Using generics with jakarta commons collections Buffer

This code compiles fine in Java <= 1.4. Java 1.6 bitches and moans with the warning: "The method add(Object) belongs to the raw type Collection. References to generic type Collection should be parameterized" import org.apache.commons.collections.Buffer; import org.apache.commons.collections.BufferUtils; import org.apache.commons.collec...

Communication between the EDT and main threads in JAVA

Hello, I have been asking a lot of questions about a project I have been working on recently. Here is the scenario I am in and any help or point in the right direction would help a lot... This is a network program built with a server and multiple clients. Each client has a GUI which must act according to commands sent from the server. ...

How does bytecode get verified in the JVM?

How does bytecode get verified in the JVM? ...

How do I retrieve the name of the lowest subclass from the context of the superclass in Java?

Rational I would like to have more detailed logging debugging/logging output on a few superclasses, so the subclass name will not actually be effecting real-time performance nor application logic. I'm also of the opinion that it is fairly bad design to do this normally, however I really do want this info to be logged during development ...

Why is the Sybase JDBC driver "eating" the exceptions?

I'm using the official Sybase JDBC driver to connect to a database and call a stored procedure by creating a CallableStatement, binding the parameters to it and calling .execute() on it. However, I found that no exception is thrown, even if the stored procedure fails. I can verify that the failure is propagated back to me by sniffing th...

How can I enclose a component with another container at runtime?

What I'm trying to achive is basically the "Enclose in" feature of Netbeans at runtime: Let's say I have this component hierarchy: Container Label 1 Label 2 Label 3 And I want to enclose Label 2 like this: Container Label 1 Container Label 2 Label 3 And I also want to revert it, i.e. I want to "pull...

Any good tutorials for JMS + EMS + Spring?

I have been searching the web, but can't find any good tutorials for getting started with JMS under Spring connecting to TIBCO EMS. Anyone can point me to a good one? ...

spring-struts2.0 application getting an exception of jdbc.properties file not found

when i run my application i am getting an exception of javax.servlet.ServletException: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: WEB-INF\jdbc.properties (The system cannot find the path specified) org.apache.struts2.dispatcher.Dispatche...

Convert a double to a String in Java and vice versa without losing accuracy

A String representation of a double is written to and read from a file by a C# application. The C# application converts the double to a string using the following fragment: value.ToString("R", NumberFormatInfo.InvariantInfo); The C# application converts the string to a double using the following fragment double num = double.Parse(s,...

How can I unblock from a Java started process?

When executing some command(let's say 'x') from cmd line, I get the following message: "....Press any key to continue . . .". So it waits for user input to unblock. But when I execute the same command ('x') from java: Process p = Runtime.getRuntime().exec(cmd, null, cmdDir); // here it blocks and cannot use outputstream to write somne...