Questions tagged [java]

Java (not to be confused with JavaScript or JScript or JS) is a general-purpose object-oriented programming language designed to be used in conjunction with the Java Virtual Machine (JVM). "Java platform" is the name for a computing system that has installed tools for developing and running Java ...

0
votes
5answers
2k views

Locks obtained on instances in java multithreading

I read that the locks in java are obtained on the instance(object) basis (in case of instance method)Also the locks can be obtained on the object of class (in case of static method). But I ...
-1
votes
1answer
206 views

connecting to a different database engine depending on user input

I want the user to specify the name of database and table (eg database login and table customer). Once the user gives these details, the data in the table customer must be displayed no matter ...
15
votes
5answers
11k views

Java Reflection: get instances of a given class found by entering its name?

Is it possible to get all instances of a class by entering this class's name as a string?Something like this?var instances=Reflection.findClass("com.someone.MyClass").getInstances();Any ...
44
votes
11answers
112k views

What is the best way to extract the first word from a string in Java?

Trying to write a short method so that I can parse a string and extract the first word. I have been looking for the best way to do this.I assume I would use str.split(","), however I would like to ...
0
votes
2answers
3k views

KeyListener not being triggered after I swap JPanels

Im making a game and Im having it so that when the user presses "I" in the game, the game panel is set to invisible while it adds the Inventory panel to the JFrame. Then when the user exits the ...
0
votes
7answers
9k views

Perfect numbers 1 to n

Write an algorithm that prints perfect numbers from 1 to n. To determine if a number is perfect add up all the factors of the number that are less than the number. If the sum is equal to the number, ...
1
vote
1answer
635 views

Spring security - How to assign security roles to small groups?

I'm using spring security and have wired it successfully to authenticate users based on roles defined in the authorites table.I've then protected my resources using AOP eg.<security:global-...
2
votes
1answer
186 views

Desk clock scrollable tab bar - what's it called?

I'd like to find some examples, of how to implement a scrollable tab bar as found in the htc's desk clock app as seen belowNot sure what I should be looking for though? What's it called?
18
votes
4answers
5k views

Guice Performance on Android

As a Java developer I've become accustomed to having dependency injection available in applications. For Android though, I am especially wary of performance. What are the performance implications ...
12
votes
3answers
10k views

How uncheck items in AlertDialog (setMultiChoiceItems)?

I'd like to clear selected items when the total came to three items selected, I am doing as follows but is not working ...AlertDialog.Builder builder=new AlertDialog.Builder(this);builder....
3
votes
2answers
8k views

Java RMI : connection refused

I have written following code for the client of RMI. But getting java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:java.net.ConnectException: Connection ...
102
votes
13answers
84k views

JPA: what is the proper pattern for iterating over large result sets?

Let's say I have a table with millions of rows. Using JPA, what's the proper way to iterate over a query against that table, such that I don't have all an in-memory List with millions of objects?For ...
-1
votes
5answers
191 views

Java: Convenient way to refactor the application

We have an agile enterprise application built on JSP and Servlet without any design strategy. This application was built in early 2002 considering 1000 users. After 2002, we received lots of ...
1
vote
2answers
685 views

I can't draw on a mouselistener component

I can't post any code right now, since the computer I'm programming on has no internet connection, and I absolutely refuse to write it out on this phone.Basically, I have a JPanel (which implements ...
0
votes
3answers
258 views

Looking for books on Datastructures(Tree) [closed]

Does anyone know a good book on datastructures where tree's are explained in depth. Language C# or Java.Thanks,G
1
vote
9answers
4k views

Returning two array from a method

I want to return two String arrays from a method(which populates those arrays). Both array are of differnt size from each other. How do I go about ??String[] namesOfColumnsFound=new String[45];...
1
vote
4answers
3k views

How to cancel a System.Exit and Restart the application in Java

For an Application I need to restart the application's Main class/function in itself.So, What is the best way to detect a Application Exit on a Specific code, And then restart itself?
4
votes
3answers
16k views

Struts2 & Tiles: When apache.org is down my webapp fails to start

I am building a Struts2 web application which uses tiles however I have discovered a quite frustrating problem where if apache.org is down (which seems to happen quite regularly) the web application ...
2
votes
3answers
8k views

In Java how do you convert a base 36 number to a decimal number?

Given the base 36 number YPAYPA, is there a library function in Java that would convert this to a decimal number?
0
votes
2answers
276 views

Camel JaxB Problem With Existing Route

I have an existing route that I want to add logging to, currently it passes its object round as an exchange string. In certain java methods that are called from the route it converts it to a model ...
1
vote
4answers
4k views

How to convert Java Object to ASN.1 stream?

I wonder if there is a simple way to convert a java object to a ASN.1 byte stream. Thanks in advance.
0
votes
1answer
230 views

how to cpu scavenging in Java?

My program is a distributed software for a small laboratory. It is written in java but because during daytime the computers are used, I have to manually restart it in the evening. I would solve the ...
0
votes
3answers
4k views

EclipseLink: Wrong number or types of arguments calling a Stored Procedure

I'm using EclipseLink for a web project involving EJB 3 and Oracle stored procedures. We're still in the beginning, so I had a simple procedure set up for testing, here's the signature:p_test....
10
votes
4answers
8k views

How to disable specific apps from starting during Tomcat startup?

My company is preparing a new production box while the current one is running. I would like to proactively install applications in Tomcat container of the new production box but would like to keep ...
0
votes
1answer
1k views

send sms with jsmpp from remote machine

0 [main] INFO org.jsmpp.session.SMPPSession - ConnectedINFO [org.jsmpp.session.SMPPSession] Starting PDUReaderWorker with processor de gree:3 ...23 [Thread-1] ...
1
vote
1answer
2k views

sql generated with hql query with composite user type

I'm using hibernate 3.6.1 and i have a strange behaviour on the sql generated by hql.Here is the hql:from Floor as floor where (floor.type !=:var1)type is a composite user type (see bottom) and ...
1
vote
4answers
8k views

Using ArrayList to store variables

I'm coding a project to store an array of objects, probably in an arraylist.So, my object has data elements, getters and setters. I do not have an idea how to access the elements of the object.For ...
0
votes
3answers
590 views

File Write Vs Memory Storage in Java

I have a requirement where I have to retrieve the contents from excel rows, do some operations write the response in same excel rows using Java class. So I decided to store the response in memory and ...
3
votes
2answers
7k views

Ant create filesets, dirsets from (absolute) properties

In ant, I have defined some properties that define some paths (absolute) needed in my build system.Most of ant tasks need filesets, so to build a fileset from a property I would have to do:<...
0
votes
2answers
2k views

C server code - Java Client Code TCP Connection Problem

I have a server - client java code and the server part has to be written in c.The first part of the code (server side) is to receive multicast message from the client and then connect to client with ...
28
votes
8answers
2k views

Testing initialization safety of final fields

I am trying to simply test out the initialization safety of final fields as guaranteed by the JLS. It is for a paper I'm writing. However, I am unable to get it to 'fail' based on my current code. ...
1
vote
1answer
491 views

Are IdGeneratorStrategy.Identity values reused after a jdo has been deleted

I'm using Google App Engine.If a Long key field is generated by IdGeneratorStrategy.Identity and then the object is deleted from the datastore, is there any chance of the key being used again by a ...
1
vote
1answer
619 views

content versioning and csv import in liferay cms

I am working on survey module .. I want to use Life ray for content management ..The administrator Post set of questions and answers in the cms panel (preferably csv import).The set of ...
2
votes
1answer
2k views

Android Card Game Animation

I have written a small card game. I now want to animate few things like taking a card from a deck and moving it to "open cards pool". I could achieve this by using translate (below code). But the ...
0
votes
1answer
929 views

Android global variables, getter, setter, error,

I try this to add some data to "global variables". Class "Conection" without window in voidfor (int in=7; in < arAll.length; in++) {if (arAll[in].toString().endsWith("/")) {...
4
votes
3answers
2k views

Continous Deployment for Java/JVM Web Application

My team and I would like to implement "Continuous Deployment" for our website. Continuous Deployment basically means deploying to production very frequently (multiple times a day). Supposedly Etsy ...
0
votes
1answer
835 views

TextView setText from another class

My problem is that i've a tabhost with two tabs.The first is a listview and the second only have two textviews.What i want is when i click on an item in the listview on tab one, the array position ...
2
votes
2answers
1k views

Is the DriverManager concept in JDBC based on the provider design pattern

In JDBC we use the Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();method to load the object in memory. Then when we use the DriverManager class to get a connection ...
1
vote
1answer
303 views

Problem with combo component

I have class representive a country COUNTRY CLASSpublic class Country {private String countryCode;private String countryDescription;public void setCountryDescription(String ...
1
vote
2answers
833 views

problem overriding a java method in groovy

I am working on a jTable and want to use setAutoCreateRowSorter(true) and sort it for a defaultTableModel. My code is a mixture of Java & Groovy given the circumstances (I prefer simple java as my ...
0
votes
1answer
2k views

Showing User's personal public page after login instead of Site's public page

I am new to liferay.I created a new user (not Power-user) and created personal Public and Private pages, but when I login I see public pages of the site.How can I make it to display personal ...
0
votes
1answer
560 views

Making a web player frontend for my media server

I have a small media server. It's actually a Netgear GoFlex Home (NAS) running Plugbox Linux. It's currently running a bunch of servers HTTP/FTP/WebDAV/DLNA/Webmin etc and I want to create a frontend ...
0
votes
2answers
1k views

hashMap in Java

I wanna do that: Method will be deleteLeafValue where it will get Object value. This will search all the sub hashMap values and clear all items where third value is Object value.public void put(...
2
votes
3answers
4k views

Compare Pixel Colour - Java

How can I find similar coloured pixels using colour objects? I know to see if two colors are equal you can use:a.equals(b);where a and b are colour objects, but what if I want to find similar ...
3
votes
3answers
3k views

How to clone object in java

I want to create a list/array of object with the same parent class which then I will use it for reference. but i dont know how to clone those object to make a new object.here is the exampleBigFoo ...
1
vote
1answer
4k views

itext pdf header

i am creating one pdf output using iText 5.0.5.I am reading the data in the form of bytes from database and then adding it to the document using HTMLWorker to generate pdf.BUt i am not able to add ...
2
votes
2answers
526 views

Unicode scripts in Regular Expressions

I want to guess the human language of a string. I found the Unicode scripts in Regular Expressions could do the trick. But I don't know what the script name stands for. As far as I know, Han stands ...
1
vote
3answers
2k views

Make JAR as a standalone executable

Is there a way to convert JAR lib into JAR standalone?I need to find a standalone java executable that convert PDF into TIFF and I've found these JARs: http://www.icefaces.org/JForum/posts/list/17504....
7
votes
6answers
31k views

org.dbunit.dataset.NoSuchTableException: Did not find table 'xxx' in schema 'null'

I know there have been discussions wrt to dbunit here. I have read most of them but I cant seem to find a solution to my problem.I have set up hibernate and spring. I am doing TDD so I had to wire ...
1
vote
2answers
815 views

best practice for presentation layer (wicket) and business logic (spring) communication

i want to develop a business application with wicket for the presentation layer and spring/hibernate core for business and data layer.the presentation layer and business layer gonna run on diffenent ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,