java

reading excel cell contents as Java InputStream

this code reads contents of cell of excel file into a string String theCell_00=rs.getCell(j,i).getContents(); is there any method using which the contents of excel cell are read as Java InputStream i need to read excel cell content and pass the contents to InputStream argument of this function public void encrypt(InputStream in, Out...

Why do updating Google site with file upload throws File ItemSkippedException?

I have a media source object MediaStreamSource ms = new MediaStreamSource(is, mediaType); AttachmentEntry newAttachment = new AttachmentEntry(); and try to insert it and in case it already exists then update it instead of insert. try { return service.insert(new URL(getContentFeedUrl()), newAttachment); } catch (Versi...

Cobertura ant script is missing Log4J classes

I tried to get Cobertura running inside my ant script, but I'm stuck right at the beginning. When I try to insert the cobertura taskdef I'm missing the Log4J libraries. Ant properties & classpath <property name="cobertura.dir" location="/full/path/to/cobertura-1.9.3" /> <path id="cobertura.classpath"> <fileset dir="${cobertura.dir}">...

How to edit XML with XSL ?

Hi everyone. I'm writing a dummy "MyAgenda" application in Java which has to allow maintenance of the XML file that stores the data. Say I have a XML file like: <myagenda> <contact> <name>Matthew Blake</name> <phone>12345678</phone> </contact> </myagenda> How can I add a new <contact> by using XSLT ? Thanks. ...

Local variables in java bytecode

I am trying to learn java bytecode and I stumbled on this: I compiled this very simple code with the -g option: public class Test { public static void main(String args[]) { double a = 1.0; int b = (int)a; } } The main code turned out to be: 0 dconst_1 1 dstore_1 2 dload_1 3 d2i 4 istore_3 5 return In addition, main's maximum...

Apache commons file upload and percentage progress in Google Apps

I am trying to use ProgressListener update call to obtain percentage completion of each file. Number of files are dynamically chosen and uploaded. public class ProgressListenerImpl implements ProgressListener Will I be able to use the "item" parameter in the update call? update(long bytesRead, long contentLength, int item) And...

Getting code statistics from big projects

I'm interested in code statistics tools. Specifically I need to get statistics on Java EE code, but any code analyzer would do. Should I start creating one of my own or is there some project that you have used? ex. LOC, number of classes , libs ... What is your experience ? ...

How to stream large Files using JAXB Marshaller?

Hi. The Problem I'm facing is how to marshall a large list of objects into a single XML File, so large I can not marshall the complete list in one step. I have a method that returns these objects in chunks, but then I marshall these using JAXB, the marshaller returns with an exception that these objects are no root elements. This is ok ...

execut jar file many times and analyse output

Hi, I'd like to test which of two implementation in java of a problem is the fastest. I've 2 jar files with the two implementation I can execute from the terminal. I want to execute both about 100 times and analyse which one is the fastest to do that or that task. In the output one of the line is "executing time : xx", I need to catch t...

More advanced Java Course or C?

Hi guys, I just completed a my first semester in Java and I am trying to decide if I should take a more advanced Java course or take a class in C. Long term I plan to continue to learn them both, however, I am wondering if a deeper understanding of Java will serve me better or if learning the basics of another language will be best. ...

Create a setup-frame in Java

My problem is the following: I have a Java application, and I would like to create a setup form on it, so i can declare some variables. How can it be done? And when the setup form is on focus, it should be disabled to perform actions on the main form. Thanks for any help. hectai ...

upload multiple files using java

Hi guys, I want to upload multiple files using java: are there any articles on the subject? ...

How to bulk cleanup imports in Java with eclipse?

On a generated project i 100s of warnings caused by unused imports and the like. Can i bulk cleanup those imports for all files? ...

Enabling/disabling an AWT Button

Dear All, I wrote the following piece of code, which is supposed to return a panel with one checkbox and one button. The idea is that the button should be enabled only if the checkbox is checked. It works, meaning that if the checkbox is not checked, and I try to push the button, nothing happens. However, the visual appearance of the but...

What's JavaCC's ADVANTAGE versus ANTLR

Too many people have told me about the disadvantages, but what is its advantage if any? ...

Run JUnit automatically when building Eclipse project

I want to run my unit tests automatically when I save my Eclipse project. The project is built automatically whenever I save a file, so I think this should be possible in some way. How do I do it? Is the only option really to get an ant script and change the project build to use the ant script with targets build and compile? Update I w...

Encoding codes in Java

Over the past couple of weeks I've read through the book Error Control Coding: Fundamentals and Applications in order to learn about BCH (Bose, Chaudhuri, Hocquenghem) Codes for an junior programming role at a telecoms company. This book mostly covers the mathematics and theory behind the subject, but I'm struggling to implement some of...

Browser based 3D games with LWJGL in Java

I want to create a browser based 3D game using LWJGL with the Java programming language. Can anyone please provide me with a small example of creating a window and a box in it? ...

Running jar from different directory cannot find required dependency

I'm trying to run a jar ec/mobat/MOBAT.jar which depends on some jars located in ec/mobat/lib/. It works if I do: ec/mobat/$ java -jar MOBAT.jar However I want to be able to run the jar from another directory ec/$ java -jar mobat/MOBAT.jar But I get an exception java.lang.NoClassDefFoundError: ibis/io/Serializable ... I tried to...

red5 server-side sharedObject

I'm trying to store all the users inside a sharedObject thats created on the server-side, so all the users get a synchronized list of all the online users. I think I create the sharedObject correct on the server-side but I cant "find" the sharedObject in the flash application. Inside the Java Red5 Application class: ISharedObject user...