java

Detect a new network connection (linux-server) and it's status in java

Is there any way that java can detect that I have just plugged in a wired-network, and monitor it's bandwith? (I'm using linux, if that matters) ...

Why is import of class not needed when calling method on instance (Java)

Something that's confused me - an example: Thing.java: import java.util.Date; class Thing { static Date getDate() {return new Date();} } (same package) TestUsesThing.java: // not importing Date here. public class TestUsesThing { public static void main(String[] args) { System.out.println(Thing.getDate().getTime(...

Reports in Java. What tool to use?

Hi, I need to create some reports, in different formats (xls, pdf, rtf). I am currently using JasperReports, in conjunction with IReport. I have no major complaints about it (except for the cases when IReport messes up my xml files), but i've been having some problems with it, when exporting to xls files and with some "special" character...

Problem generating Java SOAP web services client with JDK tool wsimport from a WSDL generated by a .NET 2.0 application

I'm trying to generate a client for some SOAP web services using the JDK 6 tool wsimport. The WSDL was generated by a .NET 2.0 application. For .NET 3.X applications, it works fine. When I run wsimport -keep -p mypackage http://myservice?wsdl it shows several error messages like this: [ERROR] A class/interface with the same name ...

How does one run a .jar file in S60 OS?

I want to run a .jar file on my Nokia N73 phone. I cannot figure out what I need to do this. I have downloaded the Sun Java Wireless Kit but that just connects to its own emulators. ...

Are there any Java libraries which I can use for automated testing of Windows GUIs?

Currently I am doing automated integration testing using FitNesse (Java) and have successfully plugged-in Watij to access a web-based application. I would like to extend this to also drive Windows GUI (non-Java) applications. To this end, are there any Java libraries available which I can use in a similar way? ...

Loop with switch vs. different loops

I have a method which loops over user elements, and sets a boolean value according to some given constraint: public void checkUsers( int constraint ) { for(int i=0; i<nodeUsers().size(); i++) { UserElement elem = nodeUsers().getUsersElementAt(i); switch (constraint) { case CHECK_ALL: elem.set...

Use custom Soap Header using Axis 1.4

I'm trying to consume a .Net 2.0 web service using Axis. I generated the web services client using the Eclipse WST Plugin and it seens ok so far. Here the expected soap header: <soap:Header> <Authentication xmlns="http://mc1.com.br/"&gt; <User>string</User> <Password>string</Password> </Authentication> </soap:Header> I didn'...

How do I upgrade the version of a maven plugin?

I am using the maven-ear-plugin version 2.3.1 - I know there is a new version available: http://maven.apache.org/plugins/maven-ear-plugin/ I can't work out how to upgrade to the latest version?? ...

How To Check Dependencies Between Jar Files?

Hi all, This is my first Q here :) I recently have taken the support and programming of a web system written in JSF. The code is kind of messy and redundant, and yes, no documentation exists. The system has over 40 jar libraries, and most of them are redundant due to old versions and testing. To remove one jar, I must check that it...

How do I access the root of a WAR?

I need to determine if an image exists in a JSP tag so I can display a default if it doesn't exist. What is the best way to access the War root so that I can check to see if the image exists? Or is there a better solution? ...

How to avoid the "unused param" warning when overriding a method in java 1.4 ?

In this code : public class MyClass { private Object innerValue; public Object getInnerValue() { return this.innerValue; } public void setInnerValue(Object innerValue) { this.innerValue = innerValue; } } public class MyClassReadOnly extends MyClass { MyClassReadOnly(MyClass cls) { // Mak...

Annotation support in Struts 2

Hi, I'm currently evalutating Struts 2. The official documentation contains a HelloWorld example with the following Java and JSP code: Java import com.opensymphony.xwork2.ActionSupport; public class HelloWorld extends ActionSupport { public static final String MESSAGE = "Struts is up and running ..."; public String execute(...

Tutorial regarding the development of a custom Eclipse editor

I wish to learn about developing an editor for Eclipse for a particular programming language. Is there a tutorial available to help me with this? It would be beneficial if it covered such topics as syntax highlighting and auto-completion. ...

EJB3 Native Query Problem

I have the following inner class: @Entity @Table(name = "SATTET0") public class SATTET0Key { @Column(name="IESTATUT") public String estatut; @Column(name="IINICIO") public Date dataInicio; } In the same class i have the following code: Query q = exp.createNativeQuery("SELECT IESTAT...

How to properly manage Tomcat web apps inside Eclipse?

I used to run Tomcat separately on my machine. I had an Ant script that would rebuild my project, deploy it locally, and restart Tomcat. That all worked ok, but I wasn't able to debug the web app inside Eclipse. So I learned how to setup Tomcat inside Eclipse and got my web app running. Now the problem is that I don't understand fu...

Can I Determine the Set of First Chars Matched by Regex Pattern?

I would like to be able to compute the set of all characters which may be matched as the first character in a string by a given instance of java.util.regex.Pattern. More formally, given the DFA equivalent to a certain regular expression, I want the set of all outgoing transitions from the start state. An example: Pattern p = Pattern.c...

Can a datefield be set by a string value in J2ME?

I was just wondering if a DateField can be set by a String value. Would help me out thanks. ...

Java: my method wants the double type instead of float?

In another Bruce Eckel exercise, the code I've written takes a method and changes value in another class. Here is my code: class Big { float b; } public class PassObject { static void f(Letter y) { y.c = 'z'; } //end f() static void g(Big z) { z.b = 2.2; } public static void main(String[] args ) { Big t = new ...

Spring MVC controller HTTP GET query parameters

How do I, without annotations, create and wire a controller that will perform an action based on a query parameter? So maybe I've got a page with a list of items on it, and each one is a link like "edititem.htm?id=5". When the user clicks a link I want the controller to load up "item #5" and pass it to my edit form. I'm sorry to ask ...