Questions for java


Is Java's lack of unsigned primitive types a characteristic of Java the platform or Java the language?

There are questions about why Java doesn't support unsigned types and a few questions about dealing with unsigned types. I did some searching, and it appears that Scala also doesn't support unsigne...

Code cannot find my file

I have written a short program that will find a file I have made and print some of its details. It executes all right, but it cannot detect the file size or if it is hidden or not. E.G.

java has not enouth space, how to increase it?

I need to run a very big task in eclipse. So I changed the eclipse.ini to:

Difference between value and itemvalue

What is the difference between the value and itemValue attribute of the radiobutton in Jsf?

Format current date to show day of the week

I want to show the current date in my application like this:

Performance difference between annotating fields or getter methods in Hibernate / JPA

I was curious if anyone had any hard numbers around the performance difference between annotating Entities using private fields instead of public getter methods. I've heard people say that fields ...

Requesting a stack trace for a Java ThreadInfo?

I have an application that calls getStackTrace() on a object, but the StackTraceElement array produced by the invocation is zero length.

How do I add this to an arraylist within a static method?

I'm learning the ropes with Java and I've hit a snag with ArrayLists. The gist of my program is to take some user input parameters, create a class Foo with those parameters, and then add it to an

how to convert double to string in android

i want to convert string in my constructor into double, i can't change it in my constructor, because in one process, the variable must in double, and other class must be string, can you tell me the...

gnuprologjava problem

I am using to perform prolog stuff from Java application.

clever way to avoid try catch at each line

I am currently working with XML files, and am searching to have a better way to avoid try/catch blocks in a nice way.

Can anyone quantify performance differences between C++ and Java?

Java was initially slow before the JIT but today performance is pretty close to C++. I want to know if someone has done measurable performance comparisons between the two languages? Where does Java

Array index out of bounds

I don't know what I'm missing... the full code is pretty big so I'll just put the part throwing exceptions here.

why Dynamic method dispatch?

I am just want to know what is dynamic method dispatch in case of java and why do we need that in case of inheritance(what is the need of DMD) and Which one is better Polymorphism in C++ or DMD in ...

Generic OR instead of AND <T extends Number | CharSequence>

Is it possible to generically parameterize a method accepting EITHER ClassA OR InterfaceB ?

Reflections library not working when used in an Eclipse plug-in

I have developed an application using the Reflections library for querying all the classes having a particular annotation. Everything was working like a charm until I decided to create an Eclipse p...

Java's switch equivalent in Clojure?

Is there an equivalent for Java's switch construct in Clojure? If yes, what is it? If no, do we have to use if else ladder to achieve it?

Java JTextArea Question

I am designing an on-screen form to be filled in, and I think it makes sense to stick it together as a collection of text areas. I note in the documentation of JTextArea that a text area can be

Looking for an embeddable SQL beautifier or reformatter

I am looking for a Java open source beautifier or reformatter for SQL that I can use to clean up DDL statements that I am generating with openArchitectureWare.

Getting to modify events on changes in file?

I am using Watch Service API of nio.2 classes to watch a specific directory( Ubuntu 11.10). whenever a change is made, for eg if I modify in existing file, it fires a MODIFIED event 2 times. Don't...

How to code java jersey REST API with multi-leveled resources?

I want to code a REST API that is multileveled like:

Is there a solution for generating a JSON SMD for a Spring 3 REST Controller?

A colleague and I are setting up an architecture for rapid development of rich client-side apps using REST and JSON. Our server is using Spring 3's MVC and REST features to expose REST services as

Is there any alternative to Java properties for keeping tree-like data?

I have 3 item data that I should keep on remote PC. Let it be: ID, login, password.

Multiple calls, one timer

I've been struggled this java problem for some hours, which i first thought was quite easy.. -.-

Is there any API for constraint based programming in java

Is there any API available for Constraint Based programming in java.

Set System propery to Null in Java

In my unit tests I need to set the "workingDir" system property to Null.

If construct in hashmap.put call

I have a variable of type Hashmap&lt;String,Integer>.

Which opensource java or .net project has best unit test coverage?

I want to dive more into the unit testing concepts. An open source project which will illustrate the best practices in unit testing is required.

How to set up a form in a Spring app that pulls data from different tables

I'm developing a Spring web app and am hoping someone can give me some advice. Currently I've got a form that when submitted populates a simple POJO that is stored in a database. That POJO needs to...

show timing as per own country (and not as per server time)

I am creating web application where I need to store timestamp/ date.

how to pass the value of a variable that is created in the class A in class B

I need to pass the value of a variable That Is created in a class A to a class B. I'm still a beginner and I can not figure out how to proceed. Could you give me a hand?

Fix to grow a square based on user input

I wrote two classes. The main class runs the program. It asks for user input. Based on user input, the second class will print out a square. Each square will print out ---- for every number and |...

JasperReports: access custom data source

I am quite new to JasperReports and I need to create a report from a custom data source. For this I implemented the JRDataSource interface, with the two methods:

Java: How to pass byte by reference?

You can do it in .NET by using the keyword "ref". Is there any way to do so in Java?

Displaying a progress dialog until new activity loads

I have a progress dialog I am trying to show when a user clicks a button to launch a new activity. The spinner should be displayed on the current page until the other activity appears. ( The activi...

JAVA: 128-bit key to String problem and back

I have created a SecretkeySpec object wich contains a 128 bit key.

Struts 2 decorator question

I'm building a website with struts 2. I got a decorator for the layout of my website and I fill the content according an action. I also want to use a column with some tools like login, latest messa...

Get information from HTML by identifying tags

All- I have never done this sort of thing before and am very confused. I have spent hours on Google looking for some example code or any hints but whenever I try to work with the available code I a...

Get visual graph of heap memory usage in Java over a span of time

I am currently using Visual VM to monitor the heap memory usage of my Java application. However I would like to somehow see the heap memory usage over a span of time like for example a day and not ...

Calculating the value of a mathematical function in Java

I have this function and I was trying to get a list of all the calculations.

What sort of database will I get with an Apache Wicket Application?

So I've done my Object Oriented design, put together a database schema to go with my design, and promised an impossibly short deadline for delivery I've decided to make my life "easier" by using a ...

JUnit test for console input and output

I have only one method main. How to check System.out.println() and replace Scanner to input values automatically using JUnit?

Javadoc and linking to a file on a UNC Path

Might sound crazy, but I was wanting to link some javadoc documentation to a file that exists on the network. This is accessed from a standard UNC path.

How to get the invoker name in EJB interceptor's lifecycle event method

I use Java EE 5. I wrote an interceptor for all EJBs with three methods for logging:

how can i pass my instance variable througout my entire activity?

I am trying to make a custom list view adapter. In my public void function I am trying to set the adapter.. (after make the list from the web

How to get line number in ANTLR3 tree-parser @init action

In ANTLR, version 3, how can the line number be obtained in the @init action of a high-level tree-parser rule?

Changing NetBeans UI Look/Feel

Is it possible to somehow change the look/feel of NetBeans? I know it uses Swing and that usually apps using Swing for its UI can usually have their UI scheme changed.