java

Getting java applications to look native on windows - how?

Is it possible to use Java to create apps that look native on Windows? I don't care if the solution is portable or not, because I only plan to target windows users. I am using Scala if that matters. Sorry for the lack of details, but I have never used Java before so I'm not even sure if this is possible. ...

Java 6 and SwingUtilities2

There is component within the application that uses com.sun.java.swing.SwingUtilities2 Now I understand that this class shouldn't be used, but it's a component within the system that uses it. Therefore since it's no longer available in Java 6 I get a NoClassDefFoundError. How can I get around this issue without having to upgrade the co...

Multicore programming: what's necessary to do it?

I have a quadcore processor and I would really like to take advantage of all those cores when I'm running quick simulations. The problem is I'm only familiar with the small Linux cluster we have in the lab and I'm using Vista at home. What sort of things do I want to look into for multicore programming with C or Java? What is the ling...

How can I add an underscore before each capital letter inside a Java String?

I have a string like this "HelloWorldMyNameIsCarl" and I want it to become something like "Hello_World_My_Name_Is_Carl". How can I do this? ...

Getting Java Binding for Dbus to Run on Android

Has anyone succeeded in running the Java bindings for dbus on Android? All indications point at dbus already running as a process within the Android OS, but there is no official access point for them through the Java interface. Thanks in advance! ...

call another applet in an applet

I want to call (just display another applet)one applet from another applet . I just placed a button on my first applet and on its actionperformed method used the getcontextapplet() method. But second applet was not displayed. How can I display a second applet on any reaction of first... The code: import java.io.; import java.applet.; ...

ClassCastException when eclipse "fixed" my code

I get a ClassCastException when eclipse suggested that my code should be like that.. I have a class named Kort. ArrayList<Kort> kort = new ArrayList<Kort>(); then I use toArray(), and eclipse suggest it should look like: Kort[] array = (Kort[])kort.toArray(); But it gives me this exception: ClassCastException ! :( ...

Programming to interfaces and synchronized collections

This question relates to Java collections - specifically Hashtable and Vector - but may also apply elsewhere. I've read in many places how good it is to program to interfaces and I agree 100%. The ability to program to a List interface, for instance, without regard for the underlying implementation is most certainly helpful for decoupli...

What do I need to do to accept an array parameter in webservice?

Hi I am use JAX-WS to make a web service. As parameters I am taking in two strings and an array of a objects whose type are a class in my project. I have the webservice interface and implementation created and it is similar to this: @WebMethod(operationName = "getStuff") @WebResult(name = "result") Mix getStuff( @WebParam(name =...

BigDecimal evaluated as a string in Velocity, Struts2

I am using struts2 with Velocity 1.5 and Velocity Tools 1.3. In my template I want to do a loop like: #set ($count = ${item.qty}) #foreach($i in [1..$count]) ${item.price} ........... #end ${item.qty} is a BigDecimal but it seems like its passed to Velocity as a String maybe. Since this loop does not work. Replacing to $count...

why does junit4 not have Assert.assertArrayEquals() for double[]s?

There appear to be Assert.assertArrayEquals() methods in Junit4 for all primitives other than double, e.g. Assert.assertArrayEquals(int[] expected, int[] actual) and Assert.assertArrayEquals(char[] expected, char[] actual) but not Assert.assertArrayEquals(double[] expected, double[] actual, double eps) or Assert.assertArrayEqu...

Proguard obfuscate Fat jar

My application jar contains classes from swing-layout.jar which contains free layout manager for java 1.5. During obfuscation process i get a lot of warnings such as [proguard] Note: org.jdesktop.layout.SwingLayoutStyle accesses a field 'INDE NT' dynamically [proguard] ...

Java Internationalization

I have a Java string that I'm having trouble manipulating. I have a String, s, that has a value of 丞 (a Chinese character I chose at random, I don't speak Chinese). If I call String t = new String(s.getBytes()); if (s.equals(t)) System.out.println("String unchanged"); else System.out.println("String changed"); Then I get t...

JBoss 5.1.0GA: "java.lang.IllegalStateException: Null beanMetaData" and "java.lang.RuntimeException: failed to initialize bean container"

Hi, I am trying to deploy a ear file, which was originally written for Jboss 4.0.3 SP1. The "upgrade" involved: use of javax.annotation.PostConstruct change activateConfig to activationConfig make sure the bean implements import javax.jms.MessageListener I believe the following stack trace is triggered by a MDB (one and only) withi...

Using new fonts with Apache FOP in Java

I have to internationalize an application, and therefore have to let a user chose a font for a PDF that I will create at runtime. I want to be able to display a list of font choices from the user's system using GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); This works fine for getting fonts, but then it seems that ...

Existence of a table generation framework for experiments

Bounty is for the name of a software package for generating tables and running experiments with particular parameters. That is it! I am running experiments on computer programs with a number of variables whose effect I am measuring. For each run, I record the time, the precision and the recall. Are there any frameworks that exist that...

Where is the displaytag of scheduled reporting?

So I have been making some reports and using displaytag to output these reports in html, csv, excel, pdf, etc. They are paginated, and take a simple object graph... and output excellent results everytime, with very little code. However, I need to use displaytag or its equivalent outside of a jsp. So that a user can schedule a report...

Problems with java.math.BigInteger

I have the following code at the head of a method: BigInteger foo = BigInteger.valueOf(0); BigInteger triNum = BigInteger.valueOf(0); //set min value to 1*2*3*4*5*...*199*200. BigInteger min = BigInteger.ONE; BigInteger temp = BigInteger.ZERO; for(int i=1; i<=200; i++) { temp = BigInteger.valueOf(i); min = min.multiply(temp); }...

Running a jar from shell script

Hello friends I have a jar file named umar.jar in /root/umar/bin directory. I have a shell script file run.sh in same directory. Following is the content of run.sh #!/bin/bash "$JAVA_HOME"/bin/java -jar /root/umar/bin/umar.jar Now when I run the shell script, I get the following error Exception in thread "main" java.lang.Unsupported...

Eclipse classpath does not update changes in Project Properties

I am using Eclipse 3.4.1 Build M20080911-1700 I have tried to change the classpath directories for jar and the source directory using the Project Properties -> Java Build Path -> Libraries Tab or Source Tab. When I click OK button and then return to the properties page, my changes were not applied. I have to resort in the work around ...