java

How does ivy:publish work?

I'm completely at loss how the ant task ivy:publish is supposed to work. I would expect that I do my normal build, which creates a bunch of jar files, then I would push those jars to the (local) repository. How can I specify from where to retrieve the built jars, and how would those end up in the repository? Update: <target name="pub...

Struts or Spring MVC or Struts & Spring?

I need some information to understand design decision: Is Struts a better choice than Spring MVC? I hear about Strus-Spring-Hibernae combo - Is struts used at MVC layer because its a matured framework than when compared to Spring MVC? Any one used this combination for projects or aware of issues? ...

How to create value objects from struts form beans?

I need to create value objects from struts form beans. Is it a good idea to use Bean Utils or create the VO manually? Anyone faced any isues with bean utils? ...

How do I get a JEditorPane to highlight the full width of a line (not just the text)?

I'm trying to get a JEditorPane to highlight the full width of a displayed line. All the examples I've tried only highlight the textual content. For example if I have content such as this: --------------------------------- |Here is some text | |some more text | --------------------------------- withi...

How can I get the location of the JDK directory in Java?

Is there an similar property like System.getProperty("java.home") that will return the JDK directory instead of the JRE directory? I've looked http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#getProperties() and there doesn't seem to be anything for the JDK. ...

Lightweight Java Decimal Class

I am considering writing two limited precision alternatives to BigDecimal, namely DecimalInt and DecimalLong. These would be capable of dealing with numbers within the real bounds of int and long with an arbitrary number of decimal places, creatable in both mutable and immutable form. My plan is to make DecimalInt support +/-999,999,99...

Negating literal strings in a Java regular expression

So regular expressions seem to match on the longest possible match. For instance: public static void main(String[] args) { String s = "ClarkRalphKentGuyGreenGardnerClarkSupermanKent"; Pattern p = Pattern.compile("Clark.*Kent", Pattern.CASE_INSENSITIVE); Matcher myMatcher = p.matcher(s); int i = 1; while (myMatcher.find()) { Syst...

Why doesn't `index = index++` increment `index`?

** Dup: http://stackoverflow.com/questions/226002/whats-the-difference-between-x-x-vs-x ** So, even though I know you would never actually do this in code, I'm still curious: public static void main(String[] args) { int index = 0; System.out.println(index); // 0 index++; System.out.println(index); // 1 index = i...

Executing a Jar on Vista with a double click

This pretty much has me defeated. On XP and earlier versions of Windows you could customise Open With filetypes to include java - jar "myjar.jar", but on Vista this functionality seems to have been removed. I can of course create a .bat file to launch my application, but is it possible to make Vista execute a .jar as required? ...

How to rate a connect four game situation in java

Hey, I am trying to write a simple AI for a "Get four" game. The basic game principles are done, so I can throw in coins of different color, and they stack on each other and fill a 2D Array and so on and so forth. until now this is what the method looks like: public int insert(int x, int color) //0 = empty, 1=player1 2=player2" X is ...

Is there a workaround for Java's poor performance on walking huge directories?

I am trying to process files one at a time that are stored over a network. Reading the files is fast due to buffering is not the issue. The problem I have is just listing the directories in a folder. I have at least 10k files per folder over many folders. Performance is super slow since File.list() returns an array instead of an iter...

JAVA Swing GUI Components howto RTL view?

How can i make my Java Swing GUI Components [Right To Left] for Arabic language from NetBeans Desktop Application? ...

What's Up with Logging in Java?

Why one would use one of the following packages instead of the other? Java Logging Commons Logging Log4j SLF4j Logback ...

Anyone here have any experience using gcj's CNI for java external libraries?

I've been interested in doing some work on a desktop application for while now and my most proficient language is Java. Due to wanting to be able to compile down to a native executable, does anyone have any experience they would like to share about using gcj to compile, and CNI for libraries? I was hoping to use of of the native toolkits...

Swing JButton: Icon above Text

How can I create a JButton in Swing with the icon above the text? ...

Reversing a Linked List in Java, recursively

I have been working on a Java project for a class for a while now. It is an implementation of a linked list (here called AddressList, containing simple nodes called ListNode). The catch is that everything would have to be done with recursive algorithms. I was able to do everything fine sans one method: public AddressList reverse() L...

In Java, when should I use "Object o" instead of generics?

For example, I could write either of these: class example <T> { ... public void insert (T data) { ... } } or class example { ... public void insert (Object o) { ... } } Is there a signficant difference between the 2 in terms of performance? With generics I could restrict the type of...

JSF RichFaces and a dual slider

I see in richfaces that there is a single slider, wondering if anyone has created a dual slider like in Scriptaculous for it. Is there any concerns in mixing JSF, Richfaces and Scriptaculous in an application? ...

C# vs Java generics

I have heard that the Java implementation of Generics is not as good as the C# implementation. In that the syntax looks similar, what is it that is substandard about the Java implementation, or is it a religious point of view? ...

StringBuilder and StringBuffer in Java

What is the main difference between StringBuffer and StringBuilder? Is there any performance issues when deciding on any one of these? ...