Motivation
In eclipse I'd like to configure a path as a resource path. This path contains some java files that I only want to handle as resources, i.e. I don't want eclipse to try to compile these files. I only want to read them as resources from within junit tests.
Question
Is there a way to configure eclipse so it won't try to compile the java files it found there?
Hi,
In order to overcome a Java heap space problem, I need to extend the Java heap size up to
256 MB. I did it using Eclipse by passing -Xmx256m as a parameter during the execution.
My problem is that I want to export my application as a JAR file. How to keep this configuration during the export?
Thank you
I am new to Java. I just read that class variables in Java have default value. I tried the following program. I was expecting to get the output as 0, which is the default value on an integer, but I get the NullPointerException. What am I missing?
class Test{
static Integer iVar;
public static void main(String...args) {
System.out.println(iVar.intValue());
}
}
int a = 1, b;
if(a > 0) b = 1;
if(a <= 0) b = 2;
System.out.println(b);
If I run this, I receive:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The local variable b may not have been initialized
at Broom.main(Broom.java:9)
I know that the local variables are not initialized and is your duty to do this, but in this case, the first if doesn't initialize the variable?
I'm a big fan of JGraphT, a Java library for graphs. Could anyone recommend a similar Java library for trees? Preferrably FOSS.
What I need is a good API, preferrably typesafe with generics which allows modelling different kinds of trees (with some user data attached to verticies/edges) and run different algorithms and operations on these trees. For instance, traverse or balance.
At the moment I'm not interested in visualization of trees.
I have the following interface in Java
public interface IFoo
{
public abstract void foo();
public void bar();
}
What is the difference between foo() and bar()?
When should I use abstract?
Both seem to accomplish what I want unless I'm missing something subtle?
Update Duplicate of Why would one declare a Java interface method as abstract?
I was wondering if there is any library that can be used to represent SQL queries as objects in Java.
In the code I have plenty of static variables of type java.lang.String that are hand written SQL queries. I would be looking for library having a nice fluent API that allows me to represent the queries as objects rather than strings.
Example:
Query q = select("DATE", "QUOTE")
.from("STOCKMARKET")
.where(eq("CORP", "?"))
.orderBy("DATE", DESC);
I had experience on Java, because of some results, I need to code in C, is it difficult to switch from Java to C? And what is the biggest different between these two languages?
We have some portlets created by a team working on a JEE site.
They would like to include one of these portlets within a site I manage, which is ASP.NET.
Aside from solutions like iframes, is it possible to embed a Java portlet within an ASP.NET page?
(Note: I don't have much Java/portlet experience, so please take that into consideration in your answer)
UPDATE
Is this relevant to my question?
http://download.oracle.com/docs/cd/E13174_01/alui/devdoc/docs60/Portlets/Basics/Hello_World_Portlet_NET.htm
My question is related to memory footprint in java for class without data member. Suppose in java I have a class which doesn't have data member and it only contains methods. So if I am creating instance of particular class then does it occupies memory in primary memory except object reference memory ?
I have been told several definitions for it, looked on Wikipedia, but as a beginner to Java I'm still not sure what it means. Anybody fluent in Java and idiot?
Thanks in advance
Hi, I'm looking for a book or any other resource that will help me learn how to create RESTful APIs in Java.
Looking on Amazon, I saw that there are several solutions for RESTful Java, but I'm looking for the one that is tailored to a novice.
Looking forward to getting your advices/opinions, thanks!
I'm trying to write a rogue-like game for my blackberry and hopefully
any other phone that supports some sort of JVM.
Because I use Java in my job I'm looking to write the game in another language but I cannot find a language that will work on multiple phones.
Am I stuck with Java?
Hi, I am looking for a RPC stack that can be used between a Java Server and C++ clients.
My requirements are:
Ease of integration (for both C++ and Java)
Performance, especially number of concurrent connections and response time. Payload are mostly binaries (8-100kb)
I found some like:
http://code.google.com/p/protobuf-socket-rpc/
http://code.google.com/p/netty-protobuf-rpc/
Are there any other good alternatives?
I want to implement some attractive /path/to/my/app URLs for a java application. There is already an apache instance in front of the app server, with mod_rewrite installed. Do I win anything by using a java-based rewriter like UrlRewriteFilter instead?
I am torn. I want to start making applications for OS X. There is a specifically under-served market that I would like to tap but I don't know if I should develop it only for the mac with Cocoa and Objective C or if I should develop it with Java and JavaFX.
I guess my question is, is Java robust enough to handle the same things as Objective C on Mac and C# (.net) on Windows?
I have a ResultSet object containing all the rows returned from an sql query.
I want to be able to (in the java code, NOT force it in the SQL) to be able to take a ResultSet and transform it so that it only contains 1 (the first) row.
What would be the way to acheive this? Also, is there another appropriate class (somewhere in java.sql or elsewhere) for storing just a single row rather than trimming my ResultSet?
Thanks!
What's the reason Java doesn't allow us to do
private T[] elements = new T[initialCapacity];
?
I could understand .NET didn't allow us to do that, as in .NET you have value types that at run-time can have different sizes, but in Java all kinds of T will be object references, thus having the same size(correct me if I'm wrong).
What is the reason?
I'm writing a Java application that runs on Linux (using Sun's JDK). It keeps creating /tmp/hsperfdata_username directories, which I would like to prevent. Is there any way to stop java from creating these files?
Hi,
is it possible to return a HashMap to R with the rJava extension of R?
E.g. I have a method in Java, which returns a HashMap and I want this HashMap use in R. I tried:
.jcall(javaObj, "Ljava/util/HashMap", "getDbInfoMap")
This doesn't work.
Do I have to put everything into a String[], that I want to pass to R from Java?
Or is there another possibility?
Any help/info on this would be greatly appreciated.
I was asked this question recently during my job interview, and I couldn't answer it. So, what is the most used pattern in java.io and how is it used? What are other patterns used in common java libraries?
Hello I have a problem with GregorianCalendar.
What is wrong in there?
How outcome is 2010/6/1 and not 2010/05/31?
package test;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class Main {
public static void main(String[] args) {
Calendar cal = new GregorianCalendar(2010, 5, 31);
System.out.println(cal.get(Calendar.YEAR) + "/" + cal.get(Calendar.MONTH) + "/" + cal.get(Calendar.DAY_OF_MONTH));
}
}