Today, I was using AdaptJ Stacktrace tool. I am wondered how can it run a BeanShell script inside an already running process! The process is not run in debug mode. Even, the JVM is run with attach mechanism disabled! After all, the class path does not contain the BeanShell jar files. But you can easily select a running java process, open...
I'm taking a beginner Java class, with the assignment to create a histogram program with the following output: (100 and 10 are user inputs).
How many numbers? 100
How many intervals? 10
Histogram
--------------------------------------------------------
1 ****(4)
2 ******(6)
3 ***********(11)
4 *****************(17)
5 *****...
Hi,
I am trying to find whether number is prime or not for 1000 digit long. Algorithm i am thinking to use is 6k+/-1
problem i am facing is how can i store such a long number in java, it is taken string as input.
or
for doing divisibility should is consider only the last few digits of the number.
please advise
...
I have a jTable set so that it is read only, and selection is done by single row only.
However, when the user selects a row and the row is painted, the jTable's vertical grid lines between columns are removed, causing a single horizontal block of colour, instead of blocks of colour in each cell.
How can I get the selected row to show t...
I am C# programmer, fairly comfortable with Java syntax and some features. I want to know if a book like CLR via C# exits for Java, something which will give me an in-depth knowledge of the JVM, but still remain high level like CLR via C#.
...
I'm trying to upgrade from BouncyCastle bcprov-jdk14-124.jar (oooold) to bcprov-jdk14-143.jar. When I replace the old jar with the new jar and build everything, my software will no longer establish an SSL connection, failing with a javax.net.ssl.SSLException: Received fatal alert: illegal_parameter. Googling for "bouncycastle javax.net...
I am running a regex in a java function to parse a document and return true if it has found the string specified by the regex and return false if it hasn't. But the problem is that when the document doesn't contain the string specified by the regex It takes a very long time to return false and I want to terminate that function if it take...
Hi all,
I'm making a custom ListCellRenderer. I know that you can have different dimensions for each individual cell. But now I want to have a different dimension for the selected cell. Somehow, the JList is caching the dimension for each individual cell the first time it has to calculate bounds for each cell.
This is my code:
public c...
I have installed a servlet (solr) that requires that I set the variable solr.solr.home equal to solr home. Something like:
JAVA_OPTS=-D=solr.solr.home='/usr/share/tomcat/solr'
The version of tomcat I am using is running as a service setup through plesk control panel. After googling this I found a page that said I should edit the web.x...
Thanks to everyone in advance,
I am trying to access any context parameters in the web.xml from within a servlet filter. Below is a portion from my web.xml file. I have verified that the context-param node is accessible via a jsp page using out.print(getServletContext().getInitParameter("error"));.
<filter>
<filter-name>prePost</filt...
When recursing with Lists in Java, I frequently end up allocating and copying lists many many times. For example, I want to generate a List<List<Integer>> of all possible Integer sequences where:
Every number is between 1 and 9
Every number is greater or equal to the number before it
A number can appear between 0 and 3 times in a row.
...
Started up solving UVa problems again as a way to pass time (going to the army in 6 weeks). I love writing Java, but end up using C / C++. It's not because IO is faster, no need to box data, more memory or use of unsigned, because its algorithm efficiency that counts.
In short i am slowly constructing how to/article/code base for differ...
I have a Java application that sets a listener on a queue, the onMessage(Message) gets a subclass of javax.jms.TextMessage, how can i make it get a subclass of javax.jms.BytesMessage
Note: I don't have access to the application that sends the messages.
...
The stop(), suspend(), and resume() in java.lang.Thread are deprecated because they are unsafe. The Sun recommended work around is to use Thread.interrupt(), but that approach doesn't work in all cases. For example, if you are call a library method that doesn't explicitly or implicitly check the interrupted flag, you have no choice but...
What OSS (or free) tools are available for drafting a single source for documentation that can be used to generate manuals? Specifically, in the following formats:
HTML website
PDF document
Embedded (within an application; possibly HTML)1
Text (optional)
Man pages (optional)
Additional requirements:
Tool is suitable for technical w...
I have a JavaFX applet with the stage's initial height and width defined as such:
var stage:Stage = Stage {
title: "Blah"
scene: Scene {
height: 768
width: 1024
fill: Color.WHITE
...
Additionally, I have elements laid out in the scene that are bound to the height and width for layout purposes. All works fine as...
Hello, I'm trying to create a web user interface for a Java application. The user interface is going to be very simple, consisting of a single page with a form for users to pose their queries, and a results page -- sort of like Google's search engine or Ask.com.
I'm quite familiar with the base API of Java, but I don't have much experi...
I want to build a desktop application - a map viewer , something like this : http://sunsite.ubc.ca/UBCMap/ in Java . Whenever someone hovers the mouse over a building on the map , there should be a balloon tool-tip saying something about that building on the map like its office phone number etc and that building should glow in the 2-d ma...
I import these:
sun.audio.AudioPlayer;
sun.audio.AudioStream;
to use and play a sound, but compiler produce warining.
the sound plays well but when I run the jar file no sound is played!
NetBeans says that I'm using forbidden import.
Can someone tell me "Why the jar file does not play the sound?"
...
I have a vector of user passwords. I would like to save this vector to a file and encrypt it. Then load and decrypt the file to get the passwords. I would like my users to enter a pass phrase to decrypt the files. Which algorithm should i choose? and How can i encrypt the vector before writing the file?
...