java

C++ equivalent of Java ByteBuffer?

I'm looking for a C++ "equivalent" of Java ByteBuffer. I'm probably missing the obvious or just need an isolated usage example to clarify. I've looked through the iostream family & it looks like it may provide a basis. Specifically, I want to be able to: build a buffer from a byte array/point and get primitives from the buffer, e.g. g...

How to use izPack to create an installer

Hi I have installed izPack in linux operating system. I have my own java application in jar format. I want to create a installer of that jar file for a linux operating system. I want to display license agreement when some one wants to install using that installer So can anyone tell me the step by step approach to create installer using ...

Java source upgrade from 1.4.2 to 1.6.0_10 recommended ? (skipping 1.5)

Our desktop-only product at work has been using JDK 1.4.2 until now (also 1.4.2 JRE shipped with product). I am trying to convince the management to let us upgrade to a newer version in order to get the performance, API/features and developer comfort benefits. Since 1.5 has reached EOL transition, I'm I thinking of the upgrade to 1.6.0...

String replaceAll() vs. Matcher replaceAll() (Performance differences)

Pretty simple question, but this is coming from a C/C++ person getting into the intricacies of Java. I understand I can fire up jUnit and a few performance tests of my own to get an answer; but I'm just wondering if this is out there. Are there known difference(s) between String.replaceAll() and Matcher.replaceAll() (On a Matcher Objec...

Eclipse compiling problem

Is there a way to set Eclipse report compile errors same as javac? I stumble upon few cases where something is working in eclipse, and cannot be compiled with javac. I understand that eclipse uses ECJ and that cannot be changed, but can it anywhere be set that everything that cannot compile with javac be a compile error in Eclipse? (sin...

Convert a hex string to a byte in Java

Let's say I have the string "1e". In Java, how can I convert it to the byte 0x1e? ...

Spring-MVC is adding on an extra .jsp extention to the URL a user enters

The error message I get is description The requested resource (/gradebook/WEB-INF/jsp/hello.jsp.jsp) is not available. I have a WEB-INF/jsp directory that contains hello.jsp Spring appears to be adding the jsp extension and I can't figure out why. I've pasted my web.xml and my gradebook-servlet.xml below. <?xml version="1.0" encoding="U...

Umlaut in Java SAX Parser

Hello everybody! I am currently having trouble with German umlaut values in a XML document I received. It displays / saves the value as a "ü" instead of a "ü". The XML Encoding is set to UTF-8 which should be capable of displaying umlauts. Also I couldn't find any option to set a locale on the SAX parser. Is there any other way I c...

Java serialization of multidimensional array

Hey everyone, Is it possible to make a 2D array in java serializable? If not, i am looking to "translate" a 3x3 2D array into a Vector of Vectors. I have been playing around with vectors, and I am still unsure of how to represent that. Can anyone help me? Thanks! ...

How to access Collection Generic Type class

I have a class like this : public class SubClass <T> extends SuperClass<Collection<T>>{ public Class<T> getInner() { // What goes here? } } Where SuperClass is simply a generic class. My question is how to gain access to a Class object in order to return it? I can't seem to be able to do this because of Type erasure. Any ...

list directories and files without using the java.io package

Hi everybody, I'm trying to list all the directories and files on windows mobile but I can't use the java.io package because it's not supported. Does anyone have an idea if there is some other package I can use. Thanks for the help. Dim ...

Hibernate: How to eagerly fetch un-associated entities?

Java Persistence with Hibernate shows lots of examples of how to eagerly fetch associated entities, such as: Adding @org.hibernate.annotations.BatchSize to the associated class Adding @org.hibernate.annotations.Fetch to the field that references the associated class Using the "fetch" keyword in the HQL query, etc... However in my cas...

Reading Unicode data from an Access database using JDBC

Hello, I have an MS-Access database, which I am connecting to in Java using the JDBC (I think the JDBC-ODBC bridge). My access database has some values which are in hebrew. When I try to read these values using String str = rs.getString(1) (rs is a RowSet), the string I get is just a string of question marks. I have other strings in h...

what exactly runs the quarz cron job in spring?

Hi! good people. i'm trying to use quartz with spring in a very simple project managed by maven.So in the module in which the mycron job class is i included a java main class to it just to see the job output some text and new date. here is my spring config: <!--Scheduling--> <!--Job--> <bean id="projUpdater" class="org.springframewo...

Struts help needed

I am working on a Struts application.Now I have a strange situation.The current application has a config file something like this <action path="/validate" type="test1Action" scope="request" validate="false"> <forward name="cat1" path="path1/value1"/> <forward name="cat2" path="path1/value2"/> <forward name="cat3...

"Java & XML" job title

When people say they are a "Java & XML" developer, what do they mean? Are they saying they create XML data to be used in applications, or they use XML to configure a framework like Spring or Hibernate? What other ways are there to use XML in a Java application? ...

How do you unit-test controllers that oauth?

I like Spring MVC because you can unit test your controllers. But testing controllers that oauth is another thing. For instance if I want to get the authorization url because I want to Oauth to GData, I would have to deploy the web-app because Google will only accept authorization requests from my domain (the url of my web app), not my...

what graphics library would i need to run java?

i am looking into making my own OS just to say i've done it. i know that there is a project called JNode that has done one in assembly and java. what i was wondering was, what embedded graphics do you need to run java? i know java uses the graphics of the specific os so this confuses me ...

Changing default Servlet response

I have a Java Web application that has several servlets with the following mappings. ServletOne -> /one ServletTwo -> /two ServletThree -> /three When I make a request for an action that doesn't exist I get a 403 (Forbidden), ie: /foo. I would like to change that to give a 404 (Not Found). How can I do that? If getting a 404 is def...

Arrays.asList() not working as it should?

I have a float[] and i would like to get a list with the same elements. I could do the ugly thing of adding them one by one but i wanted to use the Arrays.asList method. There is a problem though. This works: List<Integer> list = Arrays.asList(1,2,3,4,5); But this does not. int[] ints = new int[] {1,2,3,4,5}; List<Integer> list = Arr...