java

Java App to receive http PUT and Get request

Hi there, I am looking for advice on how to go about writing a small and simple application that will receive http GET and http PUT request, process the data (simple text files) and respond. I have all ready done this using threads and sockets but there must be a simpler and more efficient way. Also when I run my application using ...

OSGi like modularity in other programming languages

Is the concept of a strict modularity provided by OSGi frameworks in Java, available in any other programming language? I felt the concept of friend classes in C++ is somewhat similar, but it seems to be a much more granular control. I'm not sure if the friend concept can be applied at a namespace level. In other languages I have no ...

Read a file in java from a linked folder in eclipse

So I'm attempting to read a file in an Eclipse Java project. The resource itself is in a linked folder that I've added using: New -> Folder. Advanced >> Link folder etc. I couldn't open the file so I wrote a simple method to find out what I could access: public static void main(String[] args) { File folder = new File("."); S...

NetBeans/Tomcat deployment problem

When I tried to run my project in NetBeans 6.9, I got this error: Starting Tomcat process... Waiting for Tomcat... Tomcat server started. Incrementally deploying localhost:8084/hastaneBilgiSistemi Completed incremental distribution of localhost:8084/hastaneBilgiSistemi Incrementally redeploying localhost:8084...

How to retrieve layout_height in code

Hi. I have a layout that contains several sub-views all which set height like: <View android:layout_width="fill_parent" android:layout_height="18dip" android:background="#ff000000" /> How can I retrieve the value stored in layout_height in code? Ultimately, what I would like to do is being able to adjust the size defined in ...

how to handle exception if finally follows try block

If i put only finally without catch block how exception will be handled ...

How can I compile an Java program in Eclipse without running it?

I would like to compile my Java program in Eclipse but not run it. I can't understand how I do it. How can I compile an Java program to .class files in Eclipse without running it? ...

Passing non-string attribute to custom JSTL tag

Hello, is it possible to create a custom JSTL tag that accepts a non-string attribute? I would like to create a tag that would be handle pagination using PagedListHolder from Spring MVC. <%@tag body-content="scriptless" description="basic page template" pageEncoding="UTF-8"%> <%-- The list of normal or fragment attributes can be spec...

Why is it necessary to use a marker interface to serialize an object ?

Why can't just avoid this if I want all objects in my app to be serializable ? Update: I know that some class cannot be serialized like thread but the java system KNOWS also that Thread is not serializable, why doesn't it manage this automatically ? I'd like to know if there are some fundamental reasons. ...

Please help with my basic java implementation of Conway's game of life.

I have spent quite a while trying to write a program to implement Conway's game of life - [Link with more info.][1] . I am following some online guides and was given the majority of the functions. I wrote the "next" and "neighbours" methods shown below. Could anyone tell me if these are good implementations, and how they could be made b...

Problem in Running Java Application in Non JDK/ Non JRE installed system

Hi All, I am working in a java application. It is desktop application for Windows Operating System. I am creating a installer for my application. My application works fine for the system where jdk is insalled. I also want to run my application where jdk/jre is not present. For this i am providing jre1.7 along with the installer. I am u...

What would you change in this program? (Java)

public class Zoo{ public static void main (String[] args){ Animal animal1 = new Animal ("Giraffe", 5, 'M'); Animal animal2 = new Animal ("Lion", 10, 'F'); System.out.println (animal1.getName () + " " + animal1.getAge () + " " + animal1.getGender ()); System.out.println (animal2.getName () + " " + ani...

How can I serve a dynamic JavaScript file from Wicket?

I am building a site in Wicket. I need to serve a JavaScript file, xyz.js, for other people/websites to read directly — that is, not to be included in one of my HTML pages. xyz.js needs some dynamic contents based on the path_info that is provided to it during the request, so it needs to be a template that can be interpolated. Is there...

Detection for of Running Services on Remote Computer using Java

Hi to All, Is there a way to detect running services on a client machine using Java? I need to detect a specific running application and it's status (enabled or disabled) and execute something on my application once the running service is detected and enabled. A little research on my part has come to extent that I have 2 options: 1) ...

Why should I use a container for storing observers ?

It is said here http://msdn.microsoft.com/en-us/library/ee817669.aspx#observerpattern_topic3a This permits a subject to notify a potentially infinite number of observers of state changes, rather than just one. Why can't I just use list<Observer> in the subject class instead of delegating to a container ? ...

Limitation of JPA 1.0 using @IdClass with *nested* composite primary keys?

Given the following example (departments - projects): A department has the following properties (composite primary key): @Entity @IdClass(DeptId.class) public class Department { @Id @Column(name="number") private Integer number; @Id @Column(name="country") private String country; @Column(name="name") p...

Simplest, lightest Java Web Services engine?

I am looking for this simplest, plainest way to get a Java web service up in the air. I used to use Axis-1-on-Tomcat, but with Axis 2 its getting too thick. Some preferences for what I'm looking for: Low memory footprint - A small library with minimal binaries. Axis2.war is 17 MB - I need something lighter. Embedded - Runs from withi...

Reading zip files stored in GAE Blobstore

I have followed the sample code below to upload a zip file in the blobstore. I am able to upload the zip file in but i have some concerns reading the file. Sample Code http://code.google.com/appengine/docs/python/blobstore/overview.html#Complete_Sample_App My zip file has 6 CSV files where my system will read the files and import the ...

java compiler's target version "jsr14" with JDK7/8

Can anybody tell me the "jsr14" target version of javac will be still available with JDK7/8? ...

Informix JDBC PreparedStatement UPDATE Multiset

I want to change MULTISET column of the table, and my code looks something like this: PreparedStatement pstm = preparedStatement("UPDATE table SET mc = MULTISET{?, ?} WHERE ..."); pstm.setString(1, "..."); pstm.setString(2, "..."); pstm.execute(); And I get error: "Illegal attempt to convert a collection type into another type.". Wha...