Very similar to this question, except for Java.
What is the recommended way of encoding strings for an XML output in Java. The strings might contain characters like "&", "<", etc.
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 have a regular Java application and want to access an GWT RPC endpoint. Any idea how to make this happen? My GWT application is on a GAE/J and I could use REST for example but I already have the GWT RPC endpoints and don't want to build another façade.
Yes, I have seen http://stackoverflow.com/questions/1330318/invoke-a-gwt-rpc-service-from-java-directly, but this discussion goes into a different direction.
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 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 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 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?
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!
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'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 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 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?
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
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!
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?
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?
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 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 need to create a SOAP Web Service in C#.
I've done this in the past in Java with eclipse, but couldn't really find something that is SOAP specific when creating a new Web Service project in VS2008.
I need some kind of guidance on how to start this.
Also, the intended client will be implemented in Java,
are there known compatibility issues with this?
Thanks
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'd like to embed code from my SVN repository into my website, using PHP. The SVN has public anonymous access, so the PHP code should be fine reading it.
The code on said SVN is java, and so far I've had no luck finding a syntax-highlighter to make the code more readable. Ideally I'd like one that uses CSS classes so that I can change the colors to match the look of the website.
Could someone point me to a PHP library that highlights Java code?