I'm trying to experiment with project variables in JCAPS, and while I can find some information on how to define them, I cannot find anything on how to actually use them.
Basically, I have a JCD defined that has one item (a filename) that changes between deployments. I would like to be able to re-use the JCD for multiple deployments, s...
What is the option in Java Webstart command line to skip the security check? This is for testing purposes only.
javaws myfile.jar
...
Hi,
I am writting a test program for a server. At the test appl , I try to connect a great number of clients to the server, but after a while a get all kind of errors like these :
Connection reset by peer: socket write error or
java.net.SocketException: Connection reset or
java.net.ConnectExceptio...
Does Java have any syntax for managing exceptions that might be thrown when declaring and initializing a class's member variable?
public class MyClass
{
// Doesn't compile because constructor can throw IOException
private static MyFileWriter x = new MyFileWriter("foo.txt");
...
}
Or do such initializations always have to be mov...
Hello,
I'm interested in different approaches to gracefully shutting down a Java command line program. Sending a kill signal is not an option.
I can think of a few different approaches.
Open a port an wait for a connection. When one is made, gracefully shutdown.
Watch for a file to be created, then shutdown.
Read some input from th...
When creating an FixedThreadPool Executor object in Java you need to pass an argument describing the number of threads that the Executor can execute concurrently. I'm building a service class that's responsibility is to process a large collections of phone numbers. For each phone number I need to execute web service (that's my bottleneck...
I'm using Hibernate's EntityManager as a JPA implementation. What I want is logging of the query (HQL or JPA Query Language) made to EntityManager. This is different than SQL logging (which is enabled with the hibernate.show_sql property).
My application issues several queries to Hibernate. I want logging of both the queries issued to H...
Hi all,
I'm preparing to write a COLLADA importer in Java. There aren't any pre-written importers, and even if there were I would probably be picky, so I believe this is best. I am going with COLLADA 1.4 because I do not need the 1.5 features, and many programs don't yet support it. I found the spec for it and plan on following it, but ...
Are inner classes commonly used in Java? Are these the same as nested classes? Or have these been replaced in Java by something better? I have a book on version 5 and it has an example using an inner class, but I thought I read somewere that inner classes were "bad."
I have no idea and was hoping for thoughts on it.
Thank you.
...
You can create various Java code templates in Eclipse via the
Window->Preferences->Java -> Editor -> Templates
e.g.
sysout is expanded to:
System.out.println(${word_selection}${});${cursor}
You can activate this by typing sysout followed by CTRL+SPACE
What useful Java code templates do you currently use?
Include the name and des...
Which NetBeans plug-ins or tools would you recommend for JSF development?
...
I know how to deploy an applet using applet, object, embed tags and JavaScript, but I'm after the best approach (in terms of end user experience).
Sun suggests using the applet tag, and a mixed embed / object tag on the same page.
What I am considering is the following:
Cross-browser support.
Fallback to download page if incorrect Ja...
Does anyone know or has experience with a pure Java library to select portfolios or do some similar kinds of quadratic programming with constraints?
There seems to be a lot of tools, as already discussed elsewhere - but what I would like to use is a pure Java implementation. Since I want to call the library from within another open-sour...
Good day,
I have a hibernate mapping which goes something like this
<class name="Person">
<id name="id" type="long" column="person_id" unsaved-value="null">
<generator class="sequence">
<param name="sequence">person_id_seq</param>
</generator>
</id>
...
<set name="thinCollection" table="(select perso...
What convention do you use to comment getters and setters? This is something I've wondered for quite some time, for instance:
/**
* (1a) what do you put here?
* @param salary (1b) what do you put here?
*/
public void setSalary(float salary);
/*
* (2a) what do you put here?
* @return (2b)
*/
public float salary();
I always find...
When I ran my web application under Eclipse IDE everything worked fine.
But when I exported my project into war-file and deployed in tomcat I've got following message:
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc
I've tried putting sqljdbc4.jar everywhere:
catalina-home\lib dir
WEB-INF\lib dir
both of them
What I...
ArrayList<ArrayList<Integer>> a = new ArrayList<ArrayList<Integer>>(5);
for (int i = 0 ; i < a.size() ; i++){
a.set(i, new ArrayList<Integer>(10));
}
System.out.println(a.get(a.size()-1).get(9)); //exception thrown
The above snippet throws an exception in the printing part. Why?
...
Another question in large scale programming:
I have a job queue with time stamps and target file name. (For each timestamp, there might be up to 500 target files to process). The processing algorithms are the same for all the 500 target files. I want to do:
Write program in Java
whenever arriving at the timestamp, trigger all the 500...
I need to store key/value info in some type of collection. In C#, I'd define a dictionary like this:
var entries = new Dictionary<string, int>();
entries.Add("Stop me", 11);
entries.Add("Feed me", 12);
entries.Add("Walk me", 13);
Then I would access the values so:
int value = entries["Stop me"];
How do I do this in Java? I've see...
I need to load wikipedia revision histories into POJOs, so I'm using JAXB to unmarshall the wikipeida data dump (well, individual pages of it). The problem is that the text nodes occasionally contain entities that are not defined in the wikipedia xml dump. eg: (`°' pleases keep in mind that I do not know the complete set of entiti...