java

JavaBeans Classes in Separate JAR Files

Is it possible to build classes for a JavaBean in separate JAR files? Specifically- a JavaBean has the Bean and BeanInfo classes in one JAR file and the Custom Property Editor class inn a different JAR, the JAR file with the Bean and BeanInfo classes has the JAR file with the Custom Property Editor class on the classpath, but during dra...

Java design issue - Adding functionality to fixed classes

I have a set of classes that all need to be acted on in some (individual) way. Ordinarily I'd just create a DoSomethingInterface with a single doSomething() method and have each class implement that method in a way that suits each class' needs. However, I cannot do that in this case as the class definitions are unmodifyable (auto-genera...

Hibernate error: cannot resolve table

I'm trying to make work the example from hibernate reference. I've got simple table Pupil with id, name and age fields. I've created correct (as I think) java-class for it according to all java-beans rules. I've created configuration file - hibernate.cfg.xml, just like in the example from reference. I've created hibernate mapping for...

Accessing a remote GarbageCollectorMXBean

I can access other MXBean types, such as the RuntimeMXBean, but not the GarabageCollectorMXBean: JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL("service:jmx:rmi:///jndi/rmi://coretest:1542/jmxrmi")); MBeanServerConnection mbs = connector.getMBeanServerConnection(); GarbageCollectorMXBean gc = ManagementFactory.ne...

What replaces regexp for XML response assertions in SOAP UI?

My team has switched from J-meter to SoapUI for testing purposes.We are testing regular WSDL-based services. We used this nifty feature in J-meter where you could write assertions in the form of regular expressions to check the XML responses. For example if I wanted to make sure there were so many xml tags contained in the response you c...

Create Java Command Console in JPanel

Hi All, I want to create a "Command Console" similar to the Windows Command Prompt, with command history, etc which is in a JPanel so that it can be added to a JFrame. What I want to do is present the user with the prompt to allow them to execute commands. What I have in mind is similar to the BeanShell Console, however I haven't be a...

Who actually implements serializable methods?

I've been learning how to use Serializable. I know if I create a class 'A' with different variables who implements Serializable and I add Serializable to my class, it's also Serializable. But, who is actually implementing those two methods to serialize? Does Object take care of everything or different classes overloads them when necess...

Threads in Java and Python

Hi all, i have few questions about threads in Python and Java... Is it possible to give priorities to Python threads, as it is in Java? How can I kill, stop, suspend and interrupt thread in Python? Thread groups - what are they really for? Does Python support them too? Synchronization - in Java we use simply keyword synchorinized for a...

Using a jar in a Java project?

Hi All, I'm trying to use the public methods/classed from a project provided as a jar file (called Hello.jar for instance) wrapped in a package called hello. package hello; public class Hello { public static void main(String[] args) { coucou(); } public static void coucou() { System.out.println("Hello there"); } } In...

Using Java Reflection to initialize member variables

I'm hoping someone can point in the direction of some useful information pertaining to the best practices surrounding the use of Reflection in Java. The current project I'm supporting uses Oracle ADF Faces and we've found that based on the objectives at hand certain pages end up with a vast number of components which need to be initiali...

How do get a "nice" scale-widget in SWT under Gnome?

Hi, I would need a scale-widget in SWT that looks like the following example: http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/Scales.htm If I run this example under Ubuntu (Gnome) the scale looks like this: http:// book.javanb.com/swt-the-standard-widget-toolkit/ch10lev1sec2.html But actually I would prefer to have these steps besid...

Efficient way of getting thread CPU time using JMX

I'm currently getting the total thread CPU time using JMX in the following manner: private long calculateTotalThreadCpuTime(ThreadMXBean thread) { long totalTime = 0l; for (ThreadInfo threadInfo : thread.dumpAllThreads(false, false)) totalTime += thread.getThreadCpuTime(threadInfo.getThreadId()); return totalTime;...

Autocomplete server-side implementation

What is a fast and efficient way to implement the server-side component for an autocomplete feature in an html input box? I am writing a service to autocomplete user queries in our web interface's main search box, and the completions are displayed in an ajax-powered dropdown. The data we are running queries against is simply a large ta...

Maven 2 assembly plugin clobbers some META-INF files

Hi, I'm using the Maven 2 assembly plug-in to build a jar-with-dependencies and make an executable JAR file. My assembly includes Spring, and the CXF library. CXF includes copies of META-INF files spring.schemas and spring.handlers which end up clobbering the similar files from the spring-2.5.4 jar. By hand, I can update those two file...

Include Perl in Java

Hi, Is there any way to execute perl code without having to use Runtime.getRuntime.exec("..."); (parse in java app)? ...

Java based OCR SDK/API

Are there any good OCR (optical character recognition) SDK or APIs in Java which will be able to convert TIFF files to txt files (or even html is good enough) with some sort of format retention? The challenge is to read a typical news magazine article and know that it has a header and certain number of paragraphs and pictures. I am Ok w...

JSF unit testing

I'm trying to find a practical unit testing framework for JSF. I know about JSFUnit, but this is very impractical to me. I need to include about 10 JARs to my project, and jump through many other hoops just to get it running. I realize that -- due to the need to simulate a platform and a client -- unit testing web applications is diff...

Looking for easy Instant Messaging protocol for own IM-server/service in in Java

I am thinking of implementing an easy Instant Messaging server in Java, but I don't want to create yet another protocol, but instead use an already simple IM-protocol. But I don't know which protocol I should use. The reason Why I want to use an already existing IM-protocol, is that I would like my 'users' to be able to use their own cl...

SocketException in ActiveMQ when exiting listener application

Hi, I am currently setting up a Tomcat Server that is running an embedded ActiveMQ broker. I'm using Spring to configure JMS. I wrote a test application to listen to topics and when I exit the test application the ActiveMQ broker throws a SocketException. Here is the exception: 2009-06-09 13:12:48,005 DEBUG Transport:229 - Transpor...

Using -Xmx and -Xms in a JME application in a cell phone

Hi, I've a JME application running in a samsung i617 cell phone, and the applications is throwing OutOfMemoryError when its heap goes over 7.1 MB (and the cell phone has 64 mb)... Is it possible to use the -Xmx and -Xms parameters in JME ...