java

Java in a Microsoft shop

I've been introduced to this wonderful project, xhtmlrenderer; the flying saucer project. Problem is, is that where I work, it's strictly a microsoft shop and I haven't done any java development since college, and a smidge of WebSphere a few years back. I was wondering what it takes these days to do java development? I set up a quick p...

Why does the "protected" modifier in Java allow access to other classes in same package?

What is the reason that in Java, a member with a "protected" modifier can not only be accessed by the same class and by subclasses, but also by everyone in the same package? I am wondering about language design reasons, not actual applications (e.g., testing) ...

remote screen capturing and controlling

hi... i m doing a project on "remote screen capturing and controlling"....in java it is desktop application... thre is client-server architecture....here server can capture the clients and make wath on client but, that is not known to client that someone is watching him/her.... and after captureing the client the server can also control...

Keeping a pair of primitives in a Java HashMap

I have a list of files. I would like to scan through and keep a count of the number of files with the same size. the issue is with filesize which is a long, as we know, hashmap will take in only an object and not a primitive. So using new Long(filesize), i put it into the hashmap. instead of getting a pair of (filesize, count), i got a l...

richfaces suggestionBox passing additional values to backing bean

When using the rich faces suggestionBox how can you pass more than one id or value from the page with the text input to the suggestionBox backing bean. ie: to show a list of suggested cities within a selected state? Here is my autoComplete method. public List< Suburb > autocomplete(Object suggest) { String pref = (String) suggest;...

Optional injection in EJB3 bean or runtime dependency checks

I want to define injection so that only if the injected interface has EJB it will be injected. This is used as a plug-in to the main EJB. How to do this? Is there some annotation for this? I can use @PostConstruct to manually "inject" the variable. But then I have to handle the dependencies by myself. How can I handle dependencies knowi...

Synchronize dates between Java and C++

I have an application that runs on a device that is not connected to the internet. The OS is Windows XP. There're C++ module and Java module that interact over a socket. The Java part needs to get a file from the C++ part according to its date and time. When DST switch arrived they stopped working. It seems that the C++ ignores DST becau...

Implementing a chat server as a WebService

I have a school project in which I have to implement a chat application, who's server will be a java web service. The problem is that I've always thought of a web service as a way of calling remote functions, and I have no idea how to keep a "session" active on the web service, nor how to keep track of all the people currently in chat, r...

Cursor : get the field value (Android)

Hi, I have problems with Cursor in my Android application. I have a SQLiteDatabase that return me Cursor when I try to fetch the values with : public Cursor fetchOption(long rowId) throws SQLException { Cursor mCursor = mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE...

List sorting and ordering problem...

So I've resigned myself to not being able to use the order of a List reliably because hibernate reverses it and everyone says don't do it, so I've added a field to my class as position. I have: @Entity class Procedure { ... int procedureId; List tasks; ... } @Entity class Task { ... int taskId; int position; } Now I don't know how ...

maven jetty does not shutdown properly in eclipse

I am currently running jetty from eclipse as an external java program. The problem is when I terminate jetty and I try to relaunch it again, it cannot due to the port still being in use. What I have to do is open up Windows Task Manager and kill the java process manually. How do you get jetty to shutdown/terminate/end nicely? The follo...

Strange problem with JDBC, select returns null

Hello everybody. I am trying to use JDBC and my query is working in some cases but not working in others. I would really appreciate any help. Some of my code: public Result getSpecificTopic() { String query = "Select msg_body, msg_author from lawers_topic_msg";// where msg_id=2 order by msg_id desc"; try { ...

Basic JNI Question : java.lang.UnsatisfiedLinkError

Hey all, JNI on Ubuntu 8.10 using Eclipse and gcc (Standard with Ubuntu if there are flavours) i can't seem to load my library despite the make file creating it succesfully. The main java class is as follows; class Hello { public native void sayHello(); static { System.loadLibrary("hello.so"); } public static...

Reusable C#, Java and/or Flex components

I am looking for reusable open source components. The level of depth, breadth and hopefully quality that I'm looking for is similar to this. Although I need them in programming languages C#, Java and Flex (which I often use in my projects), other languages such as PHP, Perl, Python, Ruby etc. are welcome. I see this as a big help for ...

How Can I create different selectors for accepting new connection in java NIO

I want to write java tcp socket programming using java NIO. Its working fine. But I am using the same selector for accepting reading from and writing to the clients. How Can I create different selectors for accepting new connection in java NIO, reading and writing. Is there any online help. Actually when I am busy in reading or writing...

Java 2D Game engine for tile-based Game

Can anyone recommend a good Java game engine for developing simple tile-based games? I'm looking for an engine that will allow me to build maps using something like Tiled www.mapeditor.org Slick is exactly what I'm looking for, slick.cokeandcode.com but I can't get it working on Vista-64. The best I can manage is:Can't load IA 32-bi...

How can I write to XML via Java and display it via HTML?

How can we insert a record into an XML file using Java? How can we display one record from this XML file using HTML? ...

How to run an OSGi framework within usual java-code?

Hi there! Can anybody give me an example how to use the osgi framework classes? I haven't a clue how to use those classes ... BR, Markus ...

Deleting Java's "temporary internet files"

In the Java Control Panel on Windows there are settings for "temporary internet files" wherein all the applets and webstart stuff is cached. For certain users of our application this caching doesn't work properly and they need to delete all the files through the control panel before our webstart application will update itself properly. ...

Which class would load first when Web application starts?

I have a web application and two class files, First class is MyClass.class which is inside the abc.jar file (WEB-INF/lib/abc.jar) and Second class is YourClass.class which is inside classes folder (WEB-INF/classes/ YourClass.class). My question is which class would load first when the Application starts? And Why ? ...