java

problem with extending classes

Hello, I'm making Braid. I have a class Wall that prevents that an object goes into a wall. Everything with Wall is working. But now I'm trying to make the same with the ceilings. My ceiling class extends Wall. I've simply made a constructor like this: public Ceiling(boolean deadly, int[] xPositions, int[] yPositions) { super(dead...

What is the relationship between OSGi and Dependency Injection

What are they of each other? Specification and implementation? Competitors? Unrelated? ...

IOException: "Received authentication challenge is null" (Apache Harmony/Android)

Hi, I am trying to send a GET via Android's HttpURLConnection (which is an org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection), and upon receiving the response, an IOException is thrown: in doRequestInternal(): "Received authentication challenge is null" What does this error mean, and what is causing this? I am w...

PreparedStatement setNull(..)

Java PreparedStatement provides a possibility to explicitely set a Null value. This possibility is: prepStmt.setNull(<n>, Types.VARCHAR) Are the semantics of this call the same as when using a setType with a null value? prepStmt.setString(null) ? ...

Axis2's wsdl2java fails on RPC/Encoded style web services.

Is there any alternative to Axis2? Or the way to make it work (different data binding, for example)? Retrieving document at '...'. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at org.apache.axis2.wsdl.codegen.CodeGenerati...

Java 5 Does not validate DTD

I am working with a vendor applet, The applet works fine with JRE 1.4.2_X and 1.6.X but fails on every version of 1.5.X. Running with 1.6 is not an option due to another application conflict that does not play nice with Java 6. The issue I believe is that the DTD is not being validated. This is causing the "not declared" problem and the...

How to set the width of a layout in Android?

Is there Any way to set the width of the Layout. Because most of the time it doesn't work? ...

How to access the file system from an EJB 3?

Hello, I would like to know how can I access the file system from an EJB 3 bean? I searched the Internet on the subject and haven't found a good answer. Some suggest using the java.io/java.nio even though the specification prohibits this usage. Most application servers seem to allow the access to this API anyway. Another idea would b...

JPA reference refactoring

I refactor some classes from standard SQL to JPA/ORM usage. In most cases the Objects have a "real" reference but sometimes the references to other objects are only given by an unchecked database id reference (no foreign key, just simple a string with a reference to another table id). The code looks like: @Entity public final class my...

Java program which accepts a list of existing text files from command line arguments

Question: write a Java program which accepts s list of existing text files from command line args and concatenates the contents of all files in "Master.txt". It gives error while testing 4 endsWith(".txt"). Kindly correct it import java.io.*; class FileConcat { public static void main(String[] args) { FileOutputStream fout; FileI...

Is it possible for Scala to have reified generics without changing the JVM?

I've recently started learning Scala and was disappointed (but not surprised) that their generics are also implemented via type erasure. My question is, is it possible for Scala to have reified generics, or would the JVM need to be changed in some way? If the JVM does need to be changed, what exactly would need to be changed? ...

Launch Oracle stored-procedure in Java code.

I wrote a stored-procedure in Oracle and now, I want to launch it in Java code. I will describe a problem. I have a object type: TYPE PERSON_TYPE AS OBJECT (ID NUMBER(38), NAME VARCHAR2(20)); And table type: TYPE PERSON_TYPE_TABLE AS TABLE OF PERSON_TYPE; My procedure looks like this: PROCEDURE EVALUATE_PERSON_PROC(P_PERSON_ID IN ...

java custom annotation: make an attribute optional

I defined my own custom annotation @Target(value={ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface MyCustomAnnotation { Class<?> myType(); } how, if at all, can I make the attribute optional ...

Questions about SUN certifications

1.What are the most wanted (recommended) sun certification in the IT industry? 2.Are they really valuable for a person's career path? 3.Can somebody survive with only doing sun certifications (Without doing any academic qualification) as an example a Bsc? 4.Is there a huge job market with higher salary rate for Java technology withi...

XSD attributes and abstract

I have a hierarchy of Line<--SPLine, Line<--DID_Line Line<--TollFree etc. Then for each line there is a type of action. So I have it looking like this in the xsd: <xsd:complexType name="line" abstract="true"> <xsd:complexContent> <xsd:extension base="tns:executable"> <xsd:sequence> ... ...

how to distinguish between web application or standalone app.?

HI Is there a way to distinguish inside particular method if it is running in a web application(eg whole applications is deployed on tomcat/web sphere etc) or as a standalone application? ...

Any good tips for a PHP programmer starting a GWT project?

Coming from PHP with some Java Struts 2.0 experience any tips/tricks on learning GWT? I have been looking at some tutorials but just wanted to know if anyone has some great gems to pass along? ...

Create a playlist in iTunes with COM and Java

How do I create a playlist in iTunes from Java, using COM (on windows i.e. no AppleScript)? I have found a library here that does most of what I need, and I have added some code to ITPlaylist.java, to call the "AddTrack" method (mentioned in the docs) on the iTunes object ITPlaylist : public void addTrack(ITTrack track) { ITPlayli...

Reading bytecode from an AnnotationProcessor

Possible Duplicate: Plugging in to Java compilers Edit - this appears to be a dupe of Plugging in to Java compilers I would like to implement an AnnotationProcessor for use with the apt tool that will be invoked after compiling a class to bytecode, that can read and modify the bytecode. The reason for doing this is that I wa...

Java println formatting so I can display a table?

How can I utilize System.out.print(ln/f) in a way that will allow me to format my output into a table? If I'm to use printf, what formatting should I specify to achieve the below results? Example table I'd like to print: n result1 result2 time1 time2 ----------------------------------------------------- 5 ...