java

Type erasure, overriding and generics

Can someone explain to me why @Override public void fooMethod(Class<?> c) doesn't override public void fooMethod(Class c) and gives me the following errors instead: - Name clash: The method fooMethod(Class<?>) of type SubClass has the same erasure as fooMethod(Class) of type SuperClass but does not override it - The method f...

serial port twoway communication java

Hi i'm begginer in java,in my project datalogger is connected to com port i have to send 15 integer value to port then other device will send back 15 as a response,now i'm writing to outputstream but i'm not getting response.how to solve this problem plz help me.(i'm using javax.com package) thanks for reply ...

Programmatically convert a video to FLV

Hi all, i am currently working on a web application that needs to accept video uploaded by users in any format (.avi, .mov, etc.) and convert them to flv for playing in a flash-based player. Since the site is OpenCms-based, the best solution would be a ready-made plugin for OpenCms that allowed to upload and play videos doing the transc...

Prefuse Toolkit: dynamically adding nodes and edges

Does anyone have experience with the prefuse graph toolkit? Is it possible to change an already displayed graph, ie. add/remove nodes and/or edges, and have the display correctly adapt? For instance, prefuse comes with an example that visualizes a network of friends: http://prefuse.org/doc/manual/introduction/example/Example.java ...

Best way to automatically check out and compile Eclipse projects with Ant in Hudson or another CI tool?

We have several products which have a lot of shared code and which must be maintained several versions back. To handle this we use a lot of Eclipse projects, some contain library jars, and some contain shared source code (in several projects to avoid getting a giant heap with numerous dependencies while being able to compile everything ...

Eclipse: How to build an executable jar with external jar?

Hi all, I am trying to build an executable jar program which depends on external jar downloaded. In my project, I included them in the build path and can be run and debug within eclipse. When I tried to export it to a jar, I can run the program but I can't when I try to press a button which includes function calls and classes from the ...

Spring IoC and Generic Interface Type

Hi all, I'm trying to use Spring IoC with an interface like this: public interface ISimpleService<T> { void someOp(T t); T otherOp(); } Can Spring provide IoC based on the generic type argument T? I mean, something like this: public class SpringIocTest { @Autowired ISimpleService<Long> longSvc; @Autowired I...

Can someone explain this JDBC Exception to me?

I'm gettting the following exception when performing an insert to an Oracle Databse using JDBC. java.sql.SQLRecoverableException: Io exception: Unexpected packet What could cause this and how can I recover from it? The application I'm writing performs an aweful lot of updates the the databse in rapid succession. Judging from the exce...

Unable to use JConsole with Tomcat running as windows service

I am running tomcat 6.0.18 as a windows service. In the service applet the jvm is configured default, i.e. it is using jvm.dll of the JRE. I am trying to monitor this application with JConsole but cannot connect to it locally. I added the parameter -Dcom.sun.management.jmxremote (which works when starting tomcat with the start.bat scrip...

Eclipse error: This project needs to migrate WTP metadata

We started a Web Project in Eclipse 3.2 a ways back and we've since upgraded to Eclipse 3.4 but now the Project has the error: "This project needs to migrate WTP metadata" We've tried right-clicking and doing the "quick-fix" which is in fact to Migrate WTP Metadata. Unfortunately nothing happens and the error remains. We can delete t...

Give and get the I/O of java program from the source

How can I write a program which will run another java program (should invoke that program) give the input to that program from this program and get the output and print the output to a file. ...

Is there a possibility for smaller JRE / packaging Java software for Softgrid

My Java program is being distributed as a Microsoft App-V package (also known as Softgrid) on a customer. The JRE size is causing some headache, being quite large when distributed over slower connections (the App-V seems to cause the Java package to be included with the distribution and not as a zipped distribution but as a uncompressed,...

JVM for WEPOS

I'm looking into running a j2se(1.5) application on the WEPOS(Windows Embedded for Point of Service) platform. I noticed that Sun offeres a java runtime for Windows XP embedded (Java SE for Embedded 5.0). I'm wondering if Can I use the standard Sun Hotspot on the WEPOS platforms? Will Java SE for Embedded 5.0 also run on WEPOS? (If ...

Passing a million numbers from java to matlab?

I have a bit of code which runs in 10.919 s. Profiling it shows that 10.182 s are wasted in opaque.double Which is called when I use jClass.GetArrays(jArray1,jArray2); struct.prop1 = double(jArray1); struct.prop2 = double(jArray1); What can be done? I have to use Java to interact with external API. EDIT: I used the following hac...

Generics in Java, using wildcards

Hello, I have a question about Generics in Java, namely using wildcards. I have an example class GenClass like this: public class GenClass<E> { private E var; public void setVar(E x) { var = x; } public E getVar() { return var; } } I have another simple class: public class ExampleClass { } I have ...

How can I measure time with microsecond precision in Java?

I saw on the Internet that I was supposed to use System.nanoTime() but that doesn't work for me - it gives me the time with milliseconds precision. I just need the microseconds before and after my function executes so that I know how long it takes. I'm using Windows XP. Basically, I have this code that, for example, does 1 million up to...

Why do people use Velocity and/or NVelocity?

Over the past year I have heard alot about Velocity and NVelocity. Reading their documentation and doing searches on the net hasn't given me the answers I was looking for. In what situation would I use this library in my development? What problem does it solve that didn't already have a solution? ...

1-line IF statements in java

Is it possible to have IF statements without braces in Java, e.g: if (x == y) z = x * y; else z = y - x; It's possible in PHP, and I'm not sure if I'm doing something wrong. Clarification: Here's my actual code that i'm using: if (other instanceof Square) Square realOther = (Square) other; else Rectangle realOther = (Rec...

EL in a JSP stopped evaluating

In a JSP page(index.jsp): ${requestContext.requestURL} is the URL just shows the expression itself. It used to be evaluated to something like "http://.../somerset/" I created the Maven project with maven-archetype-webapp archetype in Eclipse. The Jetty version is jetty-6.1.14. My web.xml is simple: <web-app> <display-name>Arche...

Where can I set the JRE/JDK which is used to run Netbeans besides the command line?

First of all, I know about the command line parameter, but I don't want to use it because I want to learn, not just get it done, so... Where can I set the JRE/JDK which is used to run Netbeans? A little background: I installed JDK 1.6_10 (The system is Windows Vista Business 64) I installed Netbeans 6.5 After a few weeks I uninstalle...