java

Converting a .so file to a .jnilib file

I've got a .so library compiled for Linux under the ELF format, which is being used by a Java program. I'm trying to port this application to Mac OS X, and have discovered that OS X uses a different extension for these files, .jnilib. I've already figured out how to set up the PATH so that it correctly finds the files. However, OS X Java...

Why does hibernate-entitymanager-3.3.2.GA depend on hibernate-3.2.6.ga?

In my Maven pom.xml I have the following dependencies: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.3.2.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>3.0.0.ga</version> </d...

Problem with generics in Java

I'm sure that my problem is common and I almost sure that it doesn't have easy solution. So: I have an interface: public interface Task<E> extends Serializable { Task<E>[] splitTask (int partsNum); E mergeSolutions (E... solutions); E solveTask (); E getSolution (); Integer getId (); void setId (Integer id); } ...

SAP Business Intelligence (BI): Updating a Cube with Java

I'm a relative newcomer to SAP, so please pardon my ignorance. I'm looking to use Java to work with an SAP BI Cube (select, insert, update, delete type of work). At this point, I'm planning on using JCo to execute the appropriate function modules, but I don't know which function modules to use or how to use them. Does anyone have any ex...

Why does this compile?

I was taken aback earlier today when debugging some code to find that something like the following does not throw a compile-time exception: public Test () { HashMap map = (HashMap) getList(); } private List getList(){ return new ArrayList(); } As you can imagine, a ClassCastException is thrown at runtime, but can someone ...

Convert .class files to binary files?

When compiling a '.java' file it will create a new '.class' file, which is not a pure binary file. To run this file you need an interpreter called 'java'. Is there a way to convert this '.class' file to a binary file? In which you don't need another program to run? F.ex './filename' in Linux. Sorry for my bad english. -Henrik ...

Match a string between two same chars

Hi all, I am trying to use back references in Java regex, but it seems I'm not doing it the right way and can't get it work. I wanted to be able to match parts of string surrounded by 2 same quotes, say find if a string contains "whatever" or 'whatever'. I then wrote the following code : Pattern p = Pattern.compile("(\"|\')whatever\1"...

How to use XmlRepresentation with J2EE?

Anyone have a sample of code using XmlRepresentation? I am currently using a StringRepresentation, but need it to return XML instead. It's for a RESTful web service. import org.restlet.resource.XmlRepresentation; ...

Simple Java Ant build problem

Completely new to Ant and I have just a simple problem. I'm running ant with a input file: ant -Dargs="input.txt" run but it says it cannot find input.txt (No such file or directory). I have the build.xml file and input.txt in the same directory, above src and bin. Here is my build.xml file, am I missing something? <project name="Pro...

How to define a class in Python

Quite simple, I'm learning python and I can't find a reference that tells me how to write the following: public class Team { private String name; private String logo; private int members; public Team(){} // getters/setters } Later: Team team = new Team(); team.setName( "Oscar" ); team.setLogo( "http://......

How to disable SWT event listening if the action is not triggered by user

I notice that the ModifyListener will be triggered regardless the action is caused by user or system itself, for instance, Text t = new Text(shell, SWT.BORDER); t.addModifyListener(new TModifyListener()); ............................................... private class TModifyListener implements ModifyListener { @Override public void...

Easiest frameworks to implement Java REST web services

What are the best frameworks for implementing both client and server REST frameworks in Java? I've been struggling a little to find an easy to use solution. Update: Both Jersey and Restlet seem like good options. We'll probably use Restlet but we'll experiment with both. ...

Customozing JBoss portal login page

I know there is "login.jsp" page for JBoss portal, which is located at \jboss-portal\server\default\deploy\jboss-portal.sar\portal-server.war\ This login.jsp page posts user name and password to the following location. action="<%= response.encodeURL("j_security_check") %>" What I want to do is, instead of above, I want the login p...

Ant Javadoc Question

I want to make a Javadoc from an ant build file, but I don't see where it is. In build.xml I have: <description> A sample build file for this project </description> <property name="source.dir" location="src"/> <property name="build.dir" location="bin"/> <property name="doc.dir" location="doc"/> <property name="main.cla...

What is the Jaxb equivalent of a CData Block?

I am looking to convert a class that looks like this ... public class Amenity { public String id; public String value; } into the following XML using JaxB annotations: <amenity id="id-string-here">value-string-here</amenity> Does anyone know what annotation to use on the value member variable to accomplish this? The closest I...

BlockedLinkedQueue deadlock inside synchronized method

This could be a newbie question - I am running into a deadlock situation while using BlockedLinkedQueue - Here is a snipped of my code: public class mytest { private BlockedLinkedQueue myQueue; public synchronized void consumer() { ... myQueue.take() ... } public synchronized void producer() { ...

java: using a variable's value as an object name (not the eval() way)

Ok, so coming from a background of mostly perl, and mostly writing dirty little apps to automate my tasks, I've read the pages about the evils of eval(), and I always use a hash (in perl). I'm currently working on a little project (mostly for me and a couple of other technical people at work), for creating "canned response" e-mails. To a...

Dynamically changing the column header text in JTable

I have a table with 3 columns which have the following values in the headers: 'No.', 'X [mm]', 'Y [mm]'. This table contain the coordinates of points in millimeters. I have a checkbox on checking of which the table should repopulate to show the coordinates in inches. Moreover, the column header values should be: 'No.', 'X [in]', 'Y [in]'...

Classname + $ . What causes it?

I have a class A. I have a reference ref of class A pointing to an object of type x. What kind of object makes ref.getClass() print A$1 ? And what does $ signify? ...

Call crystal reports through java

Hi, I have one crystal report and i want to create one front end application using java to show the reports to user. Can any one give me the code how can i invoke crystal reports through a java application? ...