I noticed the following in the Java Language spec in the section on enumerations here: link
switch(this) {
case PLUS: return x + y;
case MINUS: return x - y;
case TIMES: return x * y;
case DIVIDE: return x / y;
}
throw new AssertionError("Unknown op: " + this);
However, looking at the switch statement definition section, I didn't…
Suppose we have a class called AccountService that manages the state of accounts.
AccountService is defined as
interface AccountService{
public void debit(account);
public void credit(account);
public void transfer(Account account, Account account1);
}
Given this definition, what is the best way to implement transfer() so that you can…
I have java.util.LinkedHashMap with Integer as Key and Character as Value. I know the key of the element i want to access. In addition to the element value for the key, i also want to retrieve the next 3 element values so that i can append all the 4 element values and form a string with 4 chars. I am asking for something like how we will do in…
According to debian control file ant package's dependency list is:
Depends: default-jre-headless | java2-runtime-headless | java5-runtime-headless | java6-runtime-headless, libxerces2-java
That means it depends on default-jre-headless or java2-runtime-headless or java5-runtime-headless or java6-runtime-headless. But how could i determine…
I just got Java5 project that has this error, i tried using Java5 and Java6, but its still there. it worked somehow before(since it was in svn), how can i bypass that compiler error?
I have installed Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-23-generic x86_64). Some info about the machine:
$ grep --color "model name" /proc/cpuinfo
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
model name …
What's is the most efficient way to install multiple Java JDK versions on the same Linux machine?
I need Java5 whilst my current Ubuntu 9.10 Karmic comes loaded with Java6.
I know I could setup a VM for this but I am looking for alternatives.
What usually happens is, the logs get filled up and begin getting overwritten, which makes them useless. To avoid it, use these 2 properties in the logging.properties file to suit your requirement:
java.util.logging.FileHandler.count = x (it is 1 by default, increase it to a bigger value)
This number specifies the number of log…
If I migrate java5 code to java6 a lot of @Override are missing = NetBeans gives me a lot of hints. How can I accept multiple hints at once? (The same would be nice to have for @SuppressWarnings and other hints)
I've checked the man/info page, but there is no reference to some aspects of the output fomat of apt-cache depends
The man/info page tried to be helpful (in an obtuse manner); quote: "For the specific meaning of the remainder of the output it is best to consult the apt source code"
Now in fairness to the info page, that quote was in…
I'm attempting to compile Java 1.4 code that was created by IBM's WSDL2Java on Java5 without recreating the stubs and saw this error in Eclipse. I'm under the assumption that the stubs created should just compile as long as the runtime jars are available (they are).
Access restriction: The type QName is not accessible due to restriction…
I have to admit that I'm new to Java and Android. db4o seems to be an excellent DB framework to replace SQLite http://developer.db4o.com/Platforms/Java/Android.aspx. I want to use it for my Android application. I don't know how to: Import/Install/Attach/Upload db4o to Android phone. Where should I put the JAR file…
Keep getting this error when compiling using Maven:
type parameters of <X>X cannot be determined; no unique maximal instance exists for type variable X with upper bounds int,java.lang.Object
Generics type interference cannot be applied to primitive types. But I thought since Java5, boxing/unboxing…
I have a number of projects running on a Hudson slave. I'd like one of them to run Ant under Java6, rather than the default (which is Java5 in my environment).
In the project configuration view, I was hoping to find either:
An explicit option allowing me to set a custom JDK location to use for this…
I'm still investigating issues I have with GC tuning (see prior question), which involves lots of reading and experimentation.
Sun Java5+ JVMs attempt to automatically select the optimal GC strategy and parameters based on their environment, which is great, but I can't figure out how to query the…
Some Load Balancers like Big-IP have build in interoperability with
Weblogic Cluster, this means they know how Weblogic understand a header
named 'WL-Proxy-Client-IP' to identify the original client ip.The
problem comes when you have a Web Server configured with weblogic
plug-in between the…
I'm using Eclipse 3.3. In my project, I've set the compiler compliance level to 5.0 In the build path for the project. I've added the Java 1.5 JDK in the Installed JREs section and am referencing that System Library in my project build path. However, I'm getting compile errors for a class that…
Hi all
I have been since 2 days trying to figure out why my servlet does not connect to the database MySql.
I have mysql installed and working properly and eclipse.
Whenever i try to etabilish a connection i get the ClassNotFoundException for the com.mysql.jdbc.Driver, which is actually…
We have a legacy program that was ported from Java 1.3 to Java 1.5. This application involves applets which worked fine before. After porting however, the applet would not load. However there are no errors or exceptions. The app would just try to load it forever. We tried to run it with…