java

How to determine the Java byte code version of the current class programatically?

I have a situation where the deployment platform is Java 5 and the development happens with Eclipse under Java 6 where we have established a procedure of having a new workspace created when beginning work on a given project. One of the required steps is therefore setting the compiler level to Java 5, which is frequently forgotten. We h...

Losing Facelets support in JSF 2 by adding libs

I'm trying to migrate a JSF 1.2 project running on Tomcat to Mojarra 2 running on Glassfish v3 (b71). I tried creating a new test project in Eclipse (JEE Ganymede) and a simple facelets page works until I add the libaries I'll be using from the old project, then the same facelets page isn't rendered, i.e. the page source in Firefox is j...

getting debug information from the rhino debugFrame

hi, i am using the rhino 1.7 javaScript engine in my project. i have implemented the debugger and debugFrame interfaces, and now i am getting to the public void onDebuggerStatement(Context cx) function. how can i get from the context all the debug information that i need e.g. the list of variables and their value? regards, me :-) ...

java how to write 0x13 unicode character ?

Hi , how to print 0x13 Unicode character in java ??? ...

Java StringBuilder huge overhead

I read somewhere that the Java StringBuilder uses around 1 mb for 500 characters. Is this true and if so, isn't that a bit extreme? Is the StringBuilder doing some incredible things with this amount of memory? What is the reason and does this mean I should not make too much use of this class? ...

how many objects are created in the following code?

class ClassA { void h() { } } class ClassB extends ClassA{ public static void main(String[] args){ ClassA a = new ClassA(); ClassB b = new ClassB(); } } Yes, everyone think it's such simple and there must and definitely should be only two objects created. But after I read the "Think in Java,2nd Edition", I th...

ToStringBuilder append X appendSuper

Hi all... in my classes when writing the toString() method I always use the ToStringBuilder from org.apache.commons And when I'm extending other classes I use appendSuper() and then my appends The question: Are there are any real differences in doing: appendSuper(super.toString()) instead of append(super.toString()) Kind of dum...

Dependency bundle (jar-files/sources/API docs) in Eclipse

I'm developing various in-house extensions for JIRA, the issue tracker we use. So far I worked with Netbeans and everything worked like a charm. However, now I need to switch to Eclipse and I'm having struggle setting up the environment for this development project. First a clarification why I'm using the approach I'm describing here:...

Axis 1.4 AxisFault Premature end of file

I get this error when I use my autogenerated ServiceBindingStub.java. WebService side is working ok, so this error must be in code, but code is autogenerated, so I cannot know why it doesn't work. Some other calls work fine, but this doesn't. This call included updating, while other working calls are just fetching data from WebService. ...

Is there any way to restict the marshalling depth for object graphs in JAXB?

I'm using JAXB for quick-and-dirty XML generation. I have a class that represents a tree structure: @XmlRootElement(name = "element") public class Element { // [...] @XmlElementWrapper(name="childs") @XmlElementRef public List<Element> getChilds() { /*...*/ } } I want to restrict the depth up to which the child collection is...

How to write an external binding file for xjc?

The documentation of JAXB xjc says: -b Specify one or more external binding files to process. (Each binding file must have it's own "-b" switch.) The syntax of the external binding files is extremely flexible. You may have a single binding file that contains customizations for multiple schemas or you can break the customizatio...

Java plugin (JAI) automatic installation

Hi, I was wondering if anyone has any experience getting JAI to auto install from an applet for multiple platforms. I've looked at http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer%5Fguide/extensions.html#specifying And it seems to imply (by the fact nothing to the contrary is mentioned) I can only specify an single platform...

JSR 177 Support on Blackberry

I have been trying to interact with SIM application through APDU exchanges. For exchanging APDUs, I had to create an APDUConnection through Connector.open() API, but this particular API throws up an IO exception stating "JSR 177 is not supported on this platform", I dont know whether this happens because I test this on simulator or wheth...

How to auto-start an application after system boot up in Mac os

Hi I have created a sample java swing application Mac os. Now I want whenever I will start my computer then my java application will start automatically. Thanks Sunil Kumar Sahoo ...

TimeZone ID's in Java

I'm having weird problem with java TimeZone.. Calling TimeZone.getDefault() gives my local time zone, which has an ID "GMT+02:00". Funny thing is that this ID doesn't appear in a list provided by TimeZone.getAvailableIDs(). Apparently my zone appears to be "Etc/GMT+2". I'm trying to populate a combo with time zones, but it's impossible...

Dependency Injection: How to maintain multiple configurations?

Hi StackOverflow, Lets assume we've build a system with a DI framework which is working quite fine. This system currently uses JMS to "talk" with other systems not maintained by us. The majority of our customers like the JMS approach and uses it according to our specification. The component which does all the messaging is injected with ...

Complex Regex getting value from string

Here are some input samples: 1, 2, 3 'a', 'b',    'c' 'a','b','c' 1, 'a', 'b' Strings have single quotes around them, number don't. In strings, double single quote '' (that's two times ') is the escape character for single quote '. The following also also valid input. 'this''is''one string', 1, 2 '''this'' is a weird one', 1, 2 ''''''...

NoClassDefFoundError exception when deploying dynamic web app from eclipse

I have a small Dynamic web project in Eclipse gallileo that references another project. When I deploy my project to Glassfish v2.1, as soon as I try instantiating the class that is located in the other project I get a NoClassDefFoundError. I can't figure out what setting I am missing to make sure that the referenced project is also deplo...

Can an embedded Derby database be accessed for analysis from a program like MS Access/ExcelP

Hello I would like to access data stored in an embedded Derby database by my Java application from a program like MS Access/Excel, Open Office, etc? Is there a way of doing this? I guess the only way this could be achieved is if Apache Derby came with an ODBC driver right? ...

Create a ImageIcon that is the mirror of another one.

Hi, I'll like to know if there is a way to create a ImageIcon that is the mirror of another ImageIcon. Searching on Google, I found how to do it by using many AWT libraries. Is there a way to do it with Swing ? If not, I'm still having troubles with the AWT method : The ImageIcon I want to mirror is a animated gif (with contain a tr...