java

GWT context.xml in shell mode

I'm trying to get the GWTShell mode to load my context.xml file in which my database is described. The only usable info can be found here, but this doesn't seem to work for the context.xml part. ...

getting java exception: java.net.MalformedURLException: no protocol

I am currently calling the following line of code: java.net.URL connection_url = new java.net.URL("http://:/path"); and when it executes I get the above exception. Any ideas as to why this is happening? ...

How do I create a spring bean for a Java double primitive?

I'd like to create a spring bean that holds the value of a double. Something like: <bean id="doubleValue" value="3.7"/> ...

Slowing down the playback of an audio file without changing its pitch?

I am working on an application for college music majors. A feature i am considering is slowing down music playback without changing its pitch. I have seen this done in commercial software, but cannot find any libraries or open source apps that do anything like this. Are there libraries out there? How could this be done from scratch f...

Java sound recording and mixer settings question

Hello I'm using the javax.sound.sampled package in a radio data mode decoding program. To use the program the user feeds audio from their radio receiver into their PC's line input. The user is also required to use their mixer program to select the line in as the recording input. The trouble is some users don't know how to do this and al...

How to escape text for regular expression in Java

Does Java have a built-in way to escape arbitrary text so that it can be included in a regular expression? For example, if my users enter "$5", I'd like to match that exactly rather than a "5" after the end of input. ...

How to implement draggable tab using Java Swing?

How do I implement a draggable tab using Java Swing? Instead of the static JTabbedPane I would like to drag-and-drop a tab to different position to rearrange the tabs. EDIT: The Java Tutorials - Drag and Drop and Data Transfer. ...

Starting a process with inherited stdin/stdout/stderr in Java 6

If I start a process via Java's ProcessBuilder class, I have full access to that process's standard in, standard out, and standard error streams as Java InputStreams and OutputStreams. However, I can't find a way to seamlessly connect those streams to System.in, System.out, and System.err. It's possible to use redirectErrorStream() to g...

Downloading Java classes from inside a (signed) applet

If I'm running a signed Java applet, can I download additional classes from remote sources (in the same domain, maybe even the same host) and run them? I'd like to do this without changing pages or even stopping the current applet. Of course, the total size of all classes is too large to load them all at once. Is there a way to do this...

How should I load Jars dynamically at runtime?

Why is it so hard to do this in Java? If you want to have any kind of module system you need to be able to load jars dynamically. I'm told there's a way of doing it by writing your own ClassLoader, but that's a lot of work for something that should (in my mind at least) be as easy as calling a method with a jar file as its argument. A...

Mocking Static Blocks in Java

My motto for Java is "just because Java has static blocks, it doesn't mean that you should be using them." Jokes aside, there are a lot of tricks in Java that make testing a nightmare. Two of the most I hate are Anonymous Classes and Static Blocks. We have a lot of legacy code that make use of Static Blocks and these are one of the annoy...

Getting mail from GMail into Java application using IMAP

I want to access messages in GMail from a Java application using JavaMail and IMAP. Why am I getting a SocketTimeoutException? Here is my code: Properties props = System.getProperties(); props.setProperty("mail.imap.host", "imap.gmail.com"); props.setProperty("mail.imap.port", "993"); props.setProperty("mail.imap.connectiontimeout", "5...

jtds No Suitable Driver Exception when running a maven built project

We have a simple spring-hibernate application(console app) where in we have set the classpath in manifest file of the executable jar file. And the app connects to the database using jtds driver, Everything works as expected on windows machine and jdk1.6. But on Linux, the app is unable to find the driver, We are running the program usin...

SVN plugins for Eclipse - Subclipse vs. Subversive

SVN in Eclipse is spread into 2 camps. The SVN people have developed a plugin called Subclipse. The Eclipse people have a plugin called Subversive. Broadly speaking they both do the same things. What are the advantages and disadvantages of each? ...

Is .NET/Mono or Java the better choice for cross-platform development?

How much less libraries are there for Mono than for Java? I lack the overview over both alternatives but I have pretty much freedom of choice for my next project. I'm looking for hard technical facts in the areas of performance (for example, I'm told Java is good for threading, and I hear the runtime code optimization has become very ...

Should you use international identifiers in Java/C#?

C# and Java allow almost any character in class names, method names, local variables, etc.. Is it bad practice to use non-ASCII characters, testing the boundaries of poor editors and analysis tools and making it difficult for some people to read, or is American arrogance the only argument against? ...

How do I get my Java application to shutdown nicely in windows?

I have a Java application which I want to shutdown 'nicely' when the user selects Start->Shutdown. I've tried using JVM shutdown listeners via Runtime.addShutdownHook(...) but this doesn't work as I can't use any UI elements from it. I've also tried using the exit handler on my main application UI window but it has no way to pause or ha...

How to capture crash logs in Java

I'm working on a cross platform application in Java which currently works nicely on Windows, Linux and MacOS X. I'm trying to work out a nice way to do detection (and handling) of 'crashes'. Is there an easy, cross-platform way to detect 'crashes' in Java and to do something in response? I guess by 'crashes' I mean uncaught exceptions. ...

Java profiler for IBM JVM 1.4.2 (WebSphere 6.0.2)

I'm looking for a Java profiler that works well with the JVM coming with WebSphere 6.0.2 (IBM JVM 1.4.2). I use yourkit for my usual profiling needs, but it specifically refuses to work with this old jvm (I'm sure the authors had their reasons...). Can anybody point to a decent profiler that can do the job? Not interested in a generic l...

Does Tiles for Struts2 support UTF-8 encoded templates?

If so what are required configuration elements to enable UTF-8 for tiles? I'm finding my tile results are sent as: Content-Type text/html; ...