java

Java3d resetting to a new scene

Hi all, I'm working on a game in Java3D. I read all my level info from a file and it works fine. But now I want to re-initialize the scene from reading data from a different file. How do I reset the scene? Should I just destroy the whole canvas3D and universe objects? ...

get every page under a website

I need a program to get all the web pages under a website. The website is Chinese, I want to get all those English words out. Then I can extract all the information I need. Any ideas for this? Is there any software for this purpose? If NO, I would like to write one. Any suggestions? Thanks much. ...

referencing ant script location from within ant file

I have a utility build script that gets called from a variety of project-specific build scripts on a build server. Everything works fine, until the relative directory structure changes. That is: trunk/ utilities/ imported.xml some_resource_file projectName/ importing.xml works just fine, but sometimes...

How to set RESPONSE Headers globally using J2EE container (Websphere)

Is there a way, at the web server level (web.xml) to set headers for all transactions? Specifically, I would like to do this: response.setHeader("Cache-Control", "no-cache, no-store"); response.setDateHeader("Expires", -1); at the application level. I seem to recall that headers could be set in the Web.xml. Are there other solution...

Coordinate transform

Do any open source or 'free' libraries exist for Java where i can perform coordinate transforms from one spatial system to another? I found Opengeo http://opengeo.org/ but it's a huge and comprehensive library for all sorts of spatial things. Does anything smaller exist? I need to convert from MGA56 to WGS84. ...

Any tool to view the picture of class loader tree?

Say I'm debugging some weird class loading issues of an application deployed inside of a Java EE app server. By some reason it appears, that I have duplicate jars on the class paths of two classloaders (2 different EAR classloaders), and the classes from namespaces of these class loaders need to colaborate. So the question is following:...

How can I reference my Java Enum without specifying its type.

I have a class that defines its own enum like this: public class Test { enum MyEnum{E1, E2}; public static void aTestMethod() { Test2(E1); // << Gives "E1 cannot be resolved" in eclipse. } public Test2(MyEnum e) {} } If I specify MyEnum.E1 it works fine, but I'd really just like to have it as "E1". Any idea ...

Retrieve main class/jar file name passed to the JVM

As a C++ app, is there a way to query a java process(java.exe/javaw.exe) to retrieve the main class or jar file name that was passed to the JVM? I want the same result as when you run "jps -l": C:\>jps -l -V 2644 sun.tools.jps.Jps 4340 net.sourceforge.squirrel_sql.client.Main I think I could get the command line parameter and try to p...

loading JRuby classes from Java by Class.forName

Hello, I have following class in Java code: public class CHRTreeCreator extends IndexCreator { ... } Instead CHRTreeCreator I want to use diffrent implementation which also extends IndexCreator, but I want to code it in JRuby. The problem is, specific implementation of IndexCreator is chosen based on xml config file: <creator>dwe.in...

Dumping a Java StringBuilder to File

What is the most effecient/elegant way of dumping a StringBuilder to a text file? you can go: outputStream.write(stringBuilder.toString().getBytes()); But is this efficient for a very long file? Is there a better way? ...

How to create ebook DRM reader and distribution platform?

My company has decided to develop ebook DRM platform. The platform does not have to be perfectly safe, but should be comparable to existing DRM platform. Software can be written in .NET or Java, both client and server-side. I am pretty much at dark on how I should approach this project and how DRM software really works. Any good tip on...

Way to consume a Java-Spring Service from .NET

What is the the most hassle-free (even commercial) way to consume a Java service (resides in Spring container) from c# ? ...

Simple SSH Tunnel in Java

I want to create an SSH Tunnel in Java. I noticed quite a few Java SSH libraries on another post. Before I dig into each option, maybe someone can give me some code snippets of how they did it or at least tell me which client library would work best. I only need tunneling. I won't need stuff like file transfers, terminal emulation, e...

Java Swing: positioning dialog on top of existing window

Can someone show simple Java Swing code/web resource that will position the popup dialog center-aligned on top of an existing JFrame window when the JFrame's button clicked? ...

Linked list Recursion

Hi everyone. So, I was reading about linked lists and recursion. I just wanted to know why can't I use recursion in a method that is static void? Also, I was wondering in Java in the linked list recursion, why you can use static void in printing or search for the nodes. Thank you. ...

Calling a method from within a servlet in tomcat generated HTML

I have a piece of Java code in a simple blogging servlet being used in Apache Tomcat. I have page being generated based on a form in the previous page, among this is a link to publish the post. I would like the user clicking that link to call a method later in the class. Is this possible and, if so, how? ...

CruiseControl JUnit test results show all zeroes

I've got JUnit hooked up with CruiseControl and unit tests are being executed & logs imported, but CruiseControl shows the following output: nz.co.picksend.core.tests.nz.co.picksend.core.dal.FilterTests Tests: 0, Failures: 0, Errors: 0, Duration: 0.0 nz.co.picksend.core.tests.nz.co.picksend.core.dal.ModelObjectRegistryTests Tests: 0, ...

Java RSS Notification Manager

Does anyone know of a java library or JSP Web Application that can do the following... Subscribe to an RSS feeds Manage User Email Subscriptions to certain events in the feed. (add/remove) Notify the users as the feed come in through the feed Example: User A wants to be notified on all news related to "technology" from the Google New...

How do I sanitize SQL without using prepared statements

For some sql statements I can't use a prepared statment, for instance: SELECT MAX(AGE) FROM ? For instance when I want to vary the table. Is there a utility that sanitizes sql in Java? There is one in ruby. ...

Maven doesn't recognize sibling modules when running mvn dependency:tree

I'm trying to set up a multi-module Maven project, and the inter-module dependencies are apparently not being set up correctly. I have: <modules> <module>commons</module> <module>storage</module> </modules> in the parent POM (which has a packaging-type pom) and then subdirectories commons/ and storage/ which define JAR poms with ...