java

Talk to Exchange 2003 from Java

What choices might I have for talking to an Exchange 2003 server from a Java application? I've heard a few references to projects that offer some .NET services to Java. I think I've also heard something about Exchange 2007 exposing web services, but I'm not sure if that's available in 2003. Has anyone done this? Any suggestions? Edi...

How to construct an object with parameters from an array in Java? Or how to add a parameter to a array during construction

I have a class with this constructor: Artikel(String name, double preis){ this.name = name; verkaufspreis = preis; Art = Warengruppe.S; I have a second class with this constructor: Warenkorb(String kunde, Artikel[] artikel){ this.kunde = kunde; artikelliste = artikel; sessionid = s.nextInt(); summe = 0; for(Artikel preis : ar...

Java erasure error with unrelated generic in method

I've read the other questions related to erasures, but I'm still not clear why I get the compile error in the class below. The other questions involve methods that actually use the generic type, whereas I'm just trying to implement a method using the exact same signature. Can anyone explain? Compile error -> name clash: bar(java.util....

Is there a way to modify a Microsoft Word footer using Apache POI?

I need to modify the content of a Word footer using a Java API. The Apache POI project does not seem to support this functionality: WARNING - you shouldn't change the headers or footers, as offsets are not yet updated! My question is twofold: Does anyone know of a way to do this using POI's API? Is there a different java API wh...

Writing a one-at-a-time lock in Java

Hi. I'm trying to implement a Java lock-type-thing which does the following: By default, threads do not pass the lock. (Opposite from normal locks, where locks can be acquired as long as they are not held.) If only one thread is waiting for the lock, execution in that thread stops If more than one thread is waiting for the lock, the th...

java RMI connection to server

I have a very simple rmi client / server application. I don't use the "rmiregistry" application though, I use this to create the server: server = new RemoteServer(); registry = LocateRegistry.createRegistry(PORT); registry.bind("RemoteServer", server); The client part is: registry = LocateRegistry.getRegistry(IPADDRESS, PORT); remote...

Showing Japanese Characters in TItle Bar of Java Program

I am able to display Japanese characters everywhere except for the title bar of the main window (JFrame) in Java. Is there a way to change the font of this title bar so it can display japanese characters? Thanks I am using Windows XP. If this matters I am using the Java Substance look and feel too. ...

Delete Files and Folders Issue

Hi there .... My project is a Web project built using three technologies : Icefaces for presentation layer. Spring for business layer. Hibernate for data access layer. My Project deployed on WebSphere 6.1 and the user can upload files, I use ice:inputFile component to handle the upload process... The first issue is: When the upload...

How to get rid of type mismatch errors when creating objects into arrays of different type?

This is my class: public class Test { Test(){ new Webshop (new Warenkorb[]{"Max", new Artikel[]{new Artikel("AAA",3.0)}, "Joe", new Artikel[]{new Artikel("BBB",3.0), new Artikel("CCC",3.0)} }, new Warenkorb[]{"Sam"...

Java - Problems Rounding Numbers

I wrote some Java code to generate pseudo-random numbers but I'm running into what I think are rounding problems getting it to match up with the same code in Ruby. Here's what I have in Java: public class randTest { private final static Double A = Math.pow(5,13); private final static Integer S = 314159265; private final static Dou...

Static method in a generic class?

In Java, I'd like to have something as: class Clazz<T> { static void doIt(T object) { // shake that booty } } But I get Cannot make a static reference to the non-static type T I don't understand generics beyond the basic uses and thus can't make much sense of that. It doesn't help that I wasn't able to find much info on the ...

Hibernate - Selecting across multiple joins with collections

I'm having trouble getting a hibernate select to return a correctly populated object graph, when the select contains joins across many collections. Eg: String sql = "select distinct changeset " + "from Changeset changeset " + "join fetch changeset.changeEntries as changeEntry " + "join fetch changeEntry.repositoryEntity as re...

Ant meta build

In ant, is there a way to combine multiple ant builds to deploy to a meta-project. For example I have workspace/project1/build.xml workspace/project2/build.xml and I want to make workspace/build.xml that will run specific targets in project1 and project2. ...

Can an executable .jar file be called without having to use its full path?

I have a .jar file that I would like to be able to call without having to use a full file path to its location. For example, if the .jar file is located at: /some/path/to/thearchive.jar I'd like to be able to run it with: java -jar thearchive.jar instead of: java -jar /some/path/to/thearchive.jar when I'm elsewhere in the direct...

Is there a way to use Cygwin to run shell scripts and use proper path seperators for java commands

I'm trying to use Cygwin to test startup scripts for a Java application that is going to run in a Linux environment. The troule is when I specify a boothclasspath or Classpath I need to use OS specific path seperators ";" for windows, and ":" for Linux. This happens because Java is still a native windows application and uses the native ...

Getting the class name from a static method in Java

How can one get the name of the class from a static method in that class. For example public class MyClass { public static String getClassName() { String name = ????; // what goes here so the string "MyClass" is returned return name; } } To put it in context, I actually want to return the class name as part of ...

Java System.getProperty("user.dir") on Mac OS X

I have an application bundle on Mac OS X 10.4 on the desktop. My application looks for a folder named "resources" in which files to be displayed are kept (kept in the same location as the runnable JAR). I know there is a folder named "Resources" within the app bundle too, sorry if thats confusing, but I never programmed on a Mac and didn...

Java crash outside JVM - works on Windows not on Linux

I am using OpenNLP and my English NameFinder on Linux (CentOS 5.3,Java 1.6.0_13) keeps giving me this error: An unexpected error has been detected by Java Runtime Environment: SIGSEGV (0xb) at pc=0x0657e436, pid=3484, tid=2291964816 Java VM: Java HotSpot(TM) Server VM (11.3-b02 mixed mode linux-x86) Problematic frame: V [libjvm.so+0x...

define ant property from environment with default value

Hello Friends, I would like my build script to act property for release and development environments. For this I would like to defined a property in ant, call it (for ex.) fileTargetName fileTargetName will get it's value from the environment variable RELEASE_VER if it's available, if it is not available it will get the default value ...

How to escape SQL keywords in JPAQL

Hi, I would like to have an entity named "GROUP" in my JPA setup. Now I get problems when I try to perform JPA queries, like "select count(group_.id) from Group group_". JPA thinks this is a misplaced GROUP BY attempt and complains. Is there a way I can escape "Group", or do I have to rename my table? Thx! ...