java

Are varargs allowed in a java enum constructor?

enum MyEnum { A( 1, 2, 3, 4), B(1, 2), C(4, 5, 8, 8, 9); private MyEnum( int firstInt, int... otherInts ) { // do something with arguments, perhaps initialize a List } } Are there any problems with this? Any reasons not to do it? ...

MSInfo32 Permissions

What permissions are necessary to access a XP/2003 Server machines information remotely through MSInfo32? Having the same admin account on the computer seems to work, but doing a runas through another account doesn't, nor does giving global access to WMI. What needs to be there to successful retrieve the information, since MSInfo doesn'...

What is classpath hell and is/was it really a problem for Java?

What is classpath hell and is/was it really a problem for Java? ...

Invoking Java main method with parameters from Eclipse

During development (and for debugging) it is very useful to run a Java class' public static void main(String[] argv) method directly from inside Eclipse (using the Run As context menu). Is there a similarily quick way to specify command line parameters for the run? What I do now is go to the "Run Dialog", click through the various sett...

Simple (standalone) Java SOAP web service client from WSDL using Maven

I'm looking to generate a simple standalone Java client which will make calls to a SOAP web service, given a wsdl. When I say simple and standalone I mean that once I'm done I want to be able to do something like import my.generated.nonsense; public static void main(String[] args) { Client client = new Client(); client.getSome...

Why aren't Java generic type parameters reified at runtime ?

My understanding is that C# and java differ with respect to generics in some ways, one of which is that generic type parameters are available at runtime in C#/.NET but not in Java. Why did the Java language designers do it this way? ...

Taking a snapshot of optimized JVM runtime

I know that the JVM can do some pretty serious optimizations at runtime, especially in -server mode. Of course, it takes a little while for the JVM to settle down and reach peak performance. Is there any way to take a snapshot of those optimizations so they can be applied immediately the next time you run your app? "Hey JVM! Great job o...

How do I use a local HTTPS URL in java?

Using the Java URL class, I can connect to an external HTTPS server (such as our production site), but using a local URL I get "SunCertPathBuilderException: unable to find valid certification path to requested target". How do I get a valid certification path? EDIT: I'm not using this URL to directly create a connection, I am passing th...

Best XML parser for Java

I need to read smallish (few MB at the most, UTF-8 encoded) XML files, rummage around looking at various elements and attributes, perhaps modify a few and write the XML back out again to disk (preferably with nice, indented formatting). What would be the best XML parser for my needs? There are lots to choose from. Some I'm aware of ar...

Headless Eclipse Build returns ERRORLEVEL 13

Everything was going well. Nightly builds ran for more than a month with no problems. However, suddenly when invoking the feature builder from Eclipse the execution ends right away with the message. ERRORLEVEL 13 As far as I know I haven't changed anything, as this computer is normally not touched. (It is only used for the nightly b...

With multi-module Maven projects, is it possible to make my root (pom-packaged) project available in Eclipse?

We have a fairly large group of Maven2 projects, with a root POM file listing 10+ modules and a lot of properties used by the modules (dependency version numbers, plugin configuration, common dependencies, etc). Some of the modules are, like the root project, parents to other sets of modules. To clarify, the root project and said paren...

Struts2 parameters between actions

I have to pass some parameter from an action to another action,for example to keep trace of an event. What is the best way to do that? I would not use session parameters. Thanks ...

How to map different Java-Bean structures onto one another

In our project we have to map one nested structures of beans onto another. (These are actually JAXB mapped Java-Representations of XML documents that, say, represent an incoming order document.) This has to be mapped onto the quite different order document structure of another system. What are the options to do this? I would prefer some...

Is there a Java array/list which is statically typed AND variable length

This would be very handy as typecasting gets boring fast. ...

Editor templates for defensive programming

Recently I worked on FindBugs warnings about exposing internal state, i.e. when a reference to an array was returned instead of returning a copy of the array. I created some templates to make converting that code easier. Which one did you create to support defensive programming and want to share with the SO crowd? Templates I've create...

Is char* supported on Chinese / Japanese machines?

Hi, I am trying to create a DLL for authentication using Java and JNI. To create the DLL, I have created a Win32 application whose Character Set and Runtime Library information are Multi-Byte String and Multi-threaded (/MT) respectively. I have tested the DLL on WinXP with valid and invalid user credentials. Both work fine. I need t...

Should i write my own flash-server in Erlang or use Red5?

I'm a student about to start my exam project, where I will be responsible for the server implementation of an online game targeting the flash player. I have a hard time to decide wether i should write my own lightweight server in Erlang or use the open source Red5. My experience is that java-developers tend to overcomplexify things mak...

Out Of Memory using Postgres in Java

Hi. Well, we have a web app, running over JBoss and we're having an "OutOfMemory" error when trying to insert a lot of rows in several tables of a postgres DB. This is the complete environment for this error: * JBoss 4.3.x GA * Java 1.6.0 * Hibernate 3.0 * postgreSQL-8.3 (driver) About actual code-work environment: * The heavy part abou...

What's a good example of an open-source Java-game?

A good starting point for an own project is to take a look at other code for the same field of problem. So which java-games in open-source you would recommend for a look in the source? Which game helps best to learn some techniques for creating games especially in the Java-environment? ...

How to append the contents of a list at the end of the other list?

How do I append the contents of one list at the end of another list? ...