java

Why Spring Framework ?

I hear now a days alot about Spring Framework ? Why there is soo much buzz around Spring Framework in Industry ? ...

use of invokeLater

Hi all, Pretty sure all of these approaches will work, but I'd appreciate opinions on which is the best. Consider for argument's sake the (unfortunate) scenario where you have UI changing code and reasonably intensive (average 500ms) logic code mixed and inseparable. all of the changing ui components are on the one panel. 01 new Threa...

pass array to method Java

How can i pass an entire array to a method? private void PassArray(){ String[] arrayw = new String[4]; //populate array PrintA(arrayw[]); } private void PrintA(String[] a){ //do whatever with array here } how do i do this correctly? ...

Is it correct to say that "Java is platform independent but version dependent ?"

Our project application uses Java 5 and now when I update Java 6, there are some kind of inconsistency with functionality and seeing this effects our manager passed comment that "Java is platform independent but version dependent", Is it really true ? ...

Java Hash Collection

There is a class called HashSet in Java For example, I'll add following int-shaped value to HashSet, [input] 1,2,3,4,5,6,1,2,3,1, [hash structure] 1,1,1 2,2 3,3 4 5 6 Is there the collection to become such a structure? ...

Is there the console function in Eclipse?

I develop the JAVA in Eclipse. If I want to add argument my java program I must appoint a value by setting of the practice environment . So I try it java myproram arg1 arg2 .. Can I this method in Eclipse? ...

Java tree class's

I'm trying to make my own tree class but keep getting horribly confused. Basically I'm trying to make a weighted tree. I've made the following node class: import java.util.*; public class subdivNode { private int nodevalue; private int nodeID; private List<subdivNode> childnodes; public subdivNode(int value, int id){ nodevalue = ...

Java error: Bad version number in .class file error when trying to run Cassandra on OS X

I am trying to get Cassandra to work on OS X. When I run bin/cassandra, I get the following error: ~/apache-cassandra-incubating-0.4.1-src > bin/cassandra -f Listening for transport dt_socket at address: 8888 Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.de...

Does this stack dump indicate that I have a deadlock ?

I have a REST service built using Jersey. When I performed a "curl" against my REST API, the command hangs. I ran jstack & this is a summarized output of two threads in BLOCKED state. "pool-2-thread-11" prio=6 tid=0x01d51800 nid=0x2394 waiting for monitor entry [0x05e6f000..0x05e6fce8] java.lang.Thread.State: BLOCKED (on object moni...

how to make a jar file that include dll files

hi all, i bought a third-party java library which include a jar file and two dll files. i wrote my own java program which invoke the third-party jar file. now my question is how can i package all my code into a single jar file which include all my code and the third-party jar and dlls? great thanks. ps: i know swt is such a case. the s...

spring security: what is the difference between account locked and not enabled

The UserDetails interface has two properties that seem to be the same, locked and enabled. Aren't these just the opposite one of the other? ...

How to set MIDI out transmitter?

Hello, I'm using a Java library called jMusic to create some sounds. I'm just trying it out for now so I've made this simple program. When I try to run it, I get the following exception: run: Midi System Unavailable:javax.sound.midi.MidiUnavailableException: MIDI OUT transmitter not available BUILD SUCCESSFUL (total time: 2 seconds) I...

Java: Casting Object to Array type

Hello, I am using a web service that returns a plain object of the type "Object". Debug shows clearly that there is some sort of Array in this object (see the image below) so I was wondering how I can cast this "Object" to an Array (or similar)? Debug Image I tried the following: Collection<String> arr = (Collection<String>) values; ...

Returning array from method

In my class, I have a method that returns an array like this. double arrValues[] = ClassX.getValues(); I wonder that, does the array size have any influence on performance. Are there any copy operation for arrValues[] or is it only a reference return ? ...

How to join one thread with other in java?

I have one main thread that starts 10 other threads. I want that the main thread will be finished only after all other threads stopped. So should I call join() on other 10 threads before starting or after starting them. For instance: // in the main() method of Main thread Thread [] threads = new Thread[10]; for(int i = 0; i < 10; i++) {...

Regular Expression problem in Java

Hi everyone, I am trying to create a regular expression for the replaceAll method in Java. The test string is abXYabcXYZ and the pattern is abc. I want to replace any symbol except the pattern with +. For example the string abXYabcXYZ and pattern [^(abc)] should return ++++abc+++, but in my case it returns ab++abc+++. public static Stri...

Expression Tree to Infix: Null in one instance, but not in another?

I have an expression tree class, which has a method buildExpressionTreeFromQueue. As its name suggests, the method takes a queue (just a series of operators and operands) and cycles through it, adding nodes to the tree appropriately. My problem is this: when I try to write the tree as Infix notation (or Prefix or Postfix for that matter...

How to stop threads in Java?

I have made a java program with GUI and I want a stop button functionality in which when a user clicks on the stop button, the program must be stopped. In my program, the main thread starts other 10 threads and I want that whenever the stop button has been clicked all the 10 threads must be stopped before the main thread. Second, I als...

(Selenium) How to test whether a download of a certain file was started?

I want to test whether a certain action results in a file download (a) at all, and (b) with the file having a certain name. Is there any way to use Selenium to do this? ...

Catching Ctrl+C in Java

Is it possible to catch the Ctrl+C signal in a java command-line application? I'd like to clean up some resources before terminating the program. ...