java

AIR (Flex) vs Java

I am writing a desktop application and trying to decide between using AIR (FLex) or Java. Some of the requirements for the application are: needing to securely connect to web services and JMS have a very interactive UI (lots of little and big features) displaying video Communicate with a C++ application To implement the web service...

Advice for embedding a Java scripting language for debugging/remote admin

I have a fairly sophisticated server-side application which frequently requires me to see what is going on with its internals to debug and fix problems. I've therefore embedded a Beanshell instance, which I can telnet into (normally over a ssh tunnel), but I'm wondering if there is a better way. A few limitations: No readline support...

What is the correct way of manipulating Swing components at program startup?

I'm creating an application in Swing using NetBeans. I would like to be able to manipulate some components during its startup (just once), after the window's made visible, for example update a progress bar. To this end, I have the app's main class, called MainWindow: public class MainWindow extends JFrame { public MainWindow() { in...

How do you debug a hanging socket connection?

We are connecting to a web service as follows: URL url = new URL("https://..."); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-length", "" + data.length()); conn.setDoOutput(tr...

Why does a dependency with scope "provided" hide transitive dependencies in Maven?

I have three modules in my Maven project (this is slightly simplified): model contains JPA annotated entity classes persistence instantiates an EntityManager and calls methods on it application creates instances of the classes in model, sets some values and passes them to persistence model and persistence obviously depend on javax.pe...

Java - Check Boxes in a JComboBox

I would like to make a JComboBox that has check boxes for items instead of text. In addition, it should be possible to check multiple items and retrieve the selected items from the component. Should I be make a custom ComboBoxUI, ComboBoxEditor, ListCellRenderer, ComboPopUp, or something different entirely? Is there an existing Java cont...

CSE 214 , Java, complex number help

This is a CSE homework, I was hoping there might be some friendly guys and gals out there that might take a quick look and see if it looks good to turn in, thanks Y'all. Here are the instructions and the code I wrote, -Kyle write a ComplexNumber class with: (1) a constructor which does not take any parameters (where the defaul...

Running a java application through shell script in a JSP/Servlet

I am running a shell script through a web application. This shell script looks something like `#! /bin/bash user="" pass="" db_url="" db_instance="" sqlplus -s $user/$pass@$db_url/$db_instance @ ./SqlScripts/foo.sql sqlplus -s $user/$pass@$db_url/$db_instance @ ./SqlScripts/bar.sql CLASS_PATH="./lib/*" java -classpath $CLASS_PATH pack...

Video game bookings datastore

The assigned homework problem needs a function to store a user-selected video game. This is a small school project, and I was wondering what would the best way to store the information. The program must access the video game bookings, but I think a database is a little overblown for such a small task. What would you do? ...

Eclipse - find all classes that extend interface

We have an interface that has a child interface. Ie: public interface GenCalculator extends Serializable {} public interface SpecialCalculator extends GenCalculator {} In Eclipse, how can you find all interface-s that extend in this case GenCalculator? If I right click, select "Open Type Hierarchy" in the GenCalculator interface, I...

Java: Pass by reference / ListIterator.add()

Java doesn't pass variables by reference. In that case, how do data structures like ListIterator make changes to their corresponding list? Here is an example iterator I am writing: public class OdpIterator<E> implements ListIterator<E> { private OdpList<E> list; private int cursor; public OdpIterator(OdpList<E> list) { ...

Java Program Performance (running time & memory consumption)

Which tools can I use to know the life-time or run-time of a program(from the beginning until the program ends)? I also want to know how much memory that program consumes from start to end. The program is written in Java and I'm running it on Windows XP. ...

what is this ANT build ?

I am new to jav/Eclipse. I installed eclipse and working on a JAVA 1.4 file using it as an IDE. I made my code changes and saved it and wanted to Run (cntr F11) or debub (F11) every time i am getting select what to run Ant Build Ant Build.. what is this Ant Build ? How to rectify /connect/ Ant Build? Ant ...

How to know on which drive an Java Application is installed ?

Hi everyone, Is there already an existing object/method able to tell us on which drive our running Java Application is installed ? Thanks. Farid ...

Exceeding Maximum Idle Time in Java Web Application with Oracle DB

I have a Java web application connecting to an Oracle database running on another machine (not sure if this is relevant or not). I am using DBCP for connection pooling. The web application is running in JBoss 4.2.2 and we are defining our datasource as a bean in Spring. We are using Hibernate for ORM. We are getting errors occasional...

DDLUtils and autoincrement values

When trying to use DDLUtils it always seems to take over the id values for the columns that are set to autoincrement. How can I prevent this? For example, I have a Dogs table with a column called ownerID. The column ownerID is set to autoincrement. However my list of owners is not continuous, there are gaps (for example, ownerID's 2, 4,...

ConcurrentHashMap constructor parameters?

I am wondering about the parameters for constructing a ConcurrentHashMap: initialCapacity is 16 by default (understood). loadFactor is 0.75 by default. concurrencyLevel is 16 by default. My questions are: What criteria should be used to adjust loadFactor up or down? How do we establish the number of concurrently updating threads? W...

How can I clean up this method I wrote in Java?

I'm working on writing a Maze generator. I have a "Cell" class which is as follows: public class Cell { public boolean northWall; public boolean southWall; public boolean eastWall; public boolean westWall; public Cell north; public Cell south; public Cell east; public Cell west; public boolean visi...

Android:NPE while trying to activityForResult with ACTION_APPWIDGET_PICK intent

Hi all, I have a problem then trying to put an intent with AppWidgetManager.ACTION_APPWIDGET_PICK there is a problem somethere inside of android AppWidget ecosystem as I can see from the logs. So that I doing wrong? See sample code and stack trace below public class NPEDemoActivity extends Activity { private final static int HOST_C...

How do I mix JVM based languages in a single Netbeans project?

For example, is it possible to have Scala, Java, and Clojure source all compile/build together properly inside the same project? Or, do I have to do them as separate project libraries then used by whatever I pick as the "master" project? If neither of those, how's everyone else doing it? ...