java

From arrayList to long[]

Hi. I am doing a method that needs to return a long[]. It looks like this: public long[] parseString(String input) input are strings like: 1, 3, 4 10, 30, 40, 50 Inside parseString I use a regex to get all numbers and add them to an ArrayList as I can't know how many oconcurrences it will find. At the end I create a long[] with ...

ms sql2000 arabic problem

I hava a table in ms sql2000 with a column defined as nvarchar when query this table in java i get data for this column like this : يا هلا بالشباب الحلوين يا شباب ا٠شلونكو؟. When i try php with adodb i get the data as it should be ,in arabic. but i need to use java not php ,please can any one help m...

Java interface: method signature declared as throws Exception; implemented as throws a subclass of Exception [CLOSED]

Hi all, I have the following interface declaration: public interface SomeInterface { void someMethod() throws Exception; } I use a third party to generate an implementation of this class (JavaCC - for the curious) The generated class looks naively like this: public class SomeClass implements SomeInterface { public void so...

java proguard: library doesnt work after optimization

hello, i am optimizing a jar with proguard, but it crashes after optimization. here is my proguard task: <proguard> -injars ${dist}/${jarname} -outjars ${dist}-proguard/${jarname} -target 5 -libraryjars '${java.home}/lib/rt.jar' -dontobfuscate -optimizationpasses ...

Struts2 multiple files upload with a twist

Let's say I have the following model classes package com.example.model; public class Product { private int productId; private String productName; //Getters and setters } package com.example.model; public class ImageTypes { private int imageTypeId; private String imageLocation; private String description; ...

What is your "favourite" Java API annoyance?

What is your "favorite" API annoyance or missing feature or misengineered part? ...

Difference between various Array copy methods

What is the difference between System.arraycopy(), clone() manual copying by iterating through the elements and just doing arraynew = arrayold? ...

Is there a Java utility which will convert a String path to use the correct File separator char?

I have developed a number of classes which manipulate files in Java. I am working on a Linux box, and have been blissfully typing new File("path/to/some/file");. When it came time to commit I realised some of the other developers on the project are using Windows. I would now like to call a method which can take in a String of the form "/...

Basic Java Question, Classes updating GUI

I will try and illustrate my question with examples, I am attempting to create a Java program that will (eventually) incorporate a complex Swing GUI. I have Main.java public class Main extends JFrame implements ActionListener { JTextArea example; public Main() { //... Missing, basic swing code example = new J...

Java Class AudioFormat: Byte ordering

Hi, I'm working with java, trying to use the AudioFormat Class. I have the following piece of code: AudioFormat Baseformat = input.getFormat(); AudioFormat Finalformat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, Baseformat.getSampleRate(), 16, Baseformat.getChannels(), Baseformat.getChannels()*2, Baseformat.getSampleRate(),fal...

Tomcat servlet problem - class not found

I'm trying to learn how to develop a servlet to run under Apache's Tomcat server on Windows XP. I'm using Tomcat 6.0 with Java SDK 1.6.0_17. My webapp is a simple Hello, world type which I'm building using the latest version of the Eclipse IDE. I'm able to run all the examples in the Tomcat installation but when I export my app from Ecli...

Starting with Liferay and a bit overwhelmed with how to begin

Hello I would like to start developing a lifeRay theme and am a little bit lost! I am a Mac user and i have installed liferay and also Xcode but i am not clear how to begin. I have downloaded the SDK for liferay but i do not understand how to install it or use it for that matter, so questions: Is Xcode an appropriate development envir...

Is there a Union in Java Generics?

Can I contain two different types in a collection? For example, can I have List< String U Integer > ? ...

What are "Code Listing"

For a university assignment in Java the specification requires that Code Listings: in 10-point Courier New typeface, and in Landscape mode if you have lines that are too long to fit into Portrait mode. are included in the documentation. The term seem ambiguous to me and it's a bit late to consult my tutor, how would you defi...

Java, HttpUrlConnection. Problem with getResponseCode()

I try to create the simplest Simplest WebServer and Client using HTTP. (Please, don't tell me to using Apache HTTPClient). Client: try to PUT some file to Server. // **PUT** if(REQUEST.toUpperCase().equals("PUT")) { File sourceFile = new File(fileName); if(!sourceFile.canRead()) { System.out.println("Have not access to this...

Add an SWT widget to a swing JPanel

I understand that this may be impossible, but I would sure like to know if somebody has accomplished this, or have a work-around. I have an SWT Button and am wanting to overwrite an existing JPanel's contents with just the Button being present. My current strategy is to have the SWT Button as an initial null field and then set it throug...

Java Drag and Drop on Mac OS X

I am making a Java program, and one way to load files is to drag the file onto the application window (swing). I have code that works in Windows and Linux. It works in OS X, but the 1st file I drag throws an exception, and then the rest work fine. Here is the code I use to enable DnD. /* * Allow a file to be opened by dragging it on...

Java AWT/Swing: Get notified on change of position/size of my window

Hello I've got a window and I would like to get notified when the position or the size has changed. Which type of listener ist the best to take? WindowListener didn't work for me... Any way? Thanks and regards ...

How to render Asian characters in a PDF using xhtmlrenderer

I was wondering what steps were needed to render Asian characters using the java based xhtmlrenderer (flying saucer) library? I am wanting to render the following: <html> <body>同名の映画のモデ</body> </html> Without any font settings being added to the HTML this renders fine in normal browsers, but I can't find anyway to render this to ...

Does Java have Automatic Properties?

In c# you can setup properties like this: public int CustomerId {get;set;} Which sets up an automatic property called CustomerId, but I was wondering if there was anything similar in Java? ...