java

In Java: is where a way to create a subarray that will point to a portion of a bigger array?

Learning Java, so be gentle please. Ideally I need to create an array of bytes that will point to a portion of a bigger array: byte[] big = new byte[1000]; // C-style code starts load(file,big); byte[100] sub = big + 200; // C-style code ends I know this is not possible in Java and there are two work-arounds that come to mind and...

close a particular command prompt

hi, I have opened a commnad prompt using java program and another command prompt manually. Now my requirement is that i need to close the command prompt that i have opened by java program using the program. I tried to close this by giving rt.exec("taskkill /IM cmd.exe"); But the problem is that the command prompt that i have opened m...

Which Weblogic 10.3 JAR contains weblogic.rmi.RemoteException

I am trying to track down the Weblogic 10.3 JAR that contains weblogic.rmi.RemoteException in order to solve a build path issue. Thanks in advance. ...

Eclipse won't quit with my plugin

Hi, I'm developing my own Eclipse plugin and came across a very strange behavior. In some very specific cases, Eclipse won't quit when I close the workbench. It just stays hanging until I kill the process. This happens when running through PDE and when running as a regular installation. It is really hard to provide more details and I ...

Java: reverse sorting without keeping the order

Update: In fact, the only acceptable solution for this problem would be sorting the array ascending and then reversing it. Let S be the following sequence of events: Event | Time A | 0:00 B | 0:01 C | 0:01 D | 0:02 I have a simple Comparator to sort S, which sorts the elements according to the time value. public int ...

How to properly handle error logs?

I tried to do several searches before posting this question. If this is a duplicate, please let me know and I will delete it. My question revolves around the proper way to handle errors produced through our web application. We currently log everything through log4j. If an error happens, it just says "An error has occurred. The IT Depart...

Reading raw data from a video capture in JMF

I'm trying to read raw video frames from a video capture device using JMF - the Java Media Framework. I've successfully written the "capture" part - using a Player object created by Manager, I can display realtime video from a webcam. I don't know how to go about creating a custom component to access the actual frames, however. This is ...

Problem facing while inserting data into dynamically created column of table.

Hi all, I am dynamically adding column to table in db through code using alter table query. But i am facing problem wen i am trying to insert values in that column. it throws an exception column does not exists. And wen i clean and rebuild my project through netbeans it works fine. I am using java and mysql as databse . Is there any...

Java: Generics won't work for my method, what else can I do?

In the code below, I would like the second method to be generic, too, but since I create the Calendar object inside the method, because of type erasure, I don't see how. One possibility would be to pass in the Calendar object, but that would defeat the main purpose for having this method at all (not having to think about the Calendar obj...

Best way of subclassing a JPanel in Swing

I am currently trying to build an expanding panel in Swing (akin the WPF's Expander control) and I'd like to retain the usual methods for manipulating it (i. e. setLayout, add, etc.). Only they should be routed to an embedded panel (the one being shown or hidden). How would one do that? Overriding every method of JComponent and re-routi...

JSF JSTL problem with nested forEach

Inside a nested foreach, accessing the same variable is returning different values. This happens when the page is reloaded, not on first load. <ui:composition xmlns="http://www.w3.org/1999/xhtml" (...) xmlns:c="http://java.sun.com/jstl/core" xmlns:h="http://java.sun.com/jsf/html"&gt; (...) <c:forEach items="#{controller.av...

Howto make javax.faces.model.SelectItem selected

I'm creating a List of javax.faces.model.SelectItem (in a bean) for use with a h:selectManyCheckbox but I cannot figure out how to make a SelectItem selected. Does anyone know how to do this? Must be possible, right?... public List<SelectItem> getPlayerList(String teamName) { List<SelectItem> list = new ArrayList<SelectItem>(); ...

What platform would you recommend to develop a SAAS application?

Should I use LAMP, .Net, or any other platform? I have access to resources with LAMP, .Net, ROR and Java experience. Thanks. Sorry for being vague. Could you give me a few pluses and minuses of each like Paul? Thanks for your time and effort. ...

Java real-time service monitoring framework

Got to create some kind of "counters" for online service monitoring - i.e. Foo_Request_Total, Foo_Request_DB_error, Foo_Request_Timedout, Bar_Request_Total,... Also, some kind of alarm has to be generated when counter passes a pre-defined limit (for example SNMP trap if more than 5 requests per hour were timed out). Could you suggest ...

Eclipse: Build and conform to different JRE versions

Is there a way to build my app using one version of the JRE but have my source conform to another version? I would like to debug my app locally using 1.6 because OS X's 1.6 is much better than 1.4.2, but because of backwards compatibility reasons we actually ship using 1.4.2. ...

Zombie http.proxyHost settings for JVM on OSX

I recently changed network and removed all my HTTP proxy settings from the System Preferences / Networking panel on OSX (Leopard). However, now whenever I use Eclipse the Java HTTP proxy system properties seem to be 'automagically' set to use my now defunct HTTP proxy. I can find no direct reference to this proxy anywhere on my system, ...

Why is my Panel's repaint not being called?

I've got a problem which I just can't seem to get around involving a small animation. For a project we are designing a J9 application to run on a PDA (DELL Axim X51). The problematic code (shown below) is when a mouse click is detected to run a small animation in a nested panel. If the animation is run independently of the mouse click, i...

Using SiteMesh with RequestDispatcher's forward()

I'm attempting to integrate SiteMesh into a legacy application using Tomcat 5 as my a container. I have a main.jsp that I'm decorating with a simple decorator. In decorators.xml, I've just got one decorator defined: <decorators defaultdir="/decorators"> <decorator name="layout-main" page="layout-main.jsp"> <pattern>/jsp/main.jsp<...

JAXB inheritance, unmarshal to subclass of marshaled class

I'm using JAXB to read and write XML. What I want is to use a base JAXB class for marshalling and an inherited JAXB class for unmarshalling. This is to allow a sender Java application to send XML to another receiver Java application. The sender and receiver will share a common JAXB library. I want the receiver to unmarshall the XML into ...

Is there a Perl implementation in Java?

Hi, I am looking for Perl implementation in Java. Something like Jython is for Python. I found PLJava but it needs both JVM and Perl compiler installed. I need something which does not need a Perl compiler. I need to run some Perl code in a Java class. UPDATE: I figured out that PLJAVA is what I need. Does anybody know some tutorial?...