Tagged Questions
Java is a general-purpose programming language designed to be used in conjunction with the Java Virtual Machine (JVM). "Java platform" is the name for a computing system that has installed tools for developing and running Java programs. Use this tag for questions referring to Java programming ...
0
votes
0answers
4 views
Applet visible rectangle
I need to be able to get a Shape Object that defines the visible parts of a JFrame, Container or Applet.
Images below are relevant to what I would like to see as a result. Note: Images say Rectangle ...
0
votes
0answers
4 views
org.postgresql.Driver not found after install application
When I try to open a connection to a PostgreSQL database, I add this to recognize the driver:
Class.forName("org.postgresql.Driver");
When I run the application for Netbeans/Eclipse, it works fine.
...
0
votes
0answers
5 views
Spring 4 @Autowire not binding correctly?
I m trying to Autowire a bean to a implementation but it returns a null pointer Exception.
package org.com.api;
public interface Multiply{
public int multipler(int a, int b);
}
package org.com.core;
...
-2
votes
1answer
14 views
Need help fixing this Rock Paper Scissors game
HELP PLEASE
public static void rockPaperScissors(Scanner input) {
// TODO Auto-generated method stub
String user = null, computer = null;
int computerRand;
...
0
votes
0answers
2 views
Insert bundle into osgi failed
Dear all:
I write a sample plugin and i want insert this bundle into my controller. But error occurs when i start it in the OSGI, it show:
gogo: BundleException: The bundle ...
-3
votes
0answers
17 views
I want to learn java se [on hold]
i cannot afford to attend a course.Please give me some "online resources " to learn code and practice from basics to in-depth java .(I tried some tutorials which don't provide in-depth knowledge . .i ...
0
votes
0answers
6 views
Android - Timer how long it takes to load another activity
Happy 1st April.
I wanted to as you. Do you know how I can time how long it take to load another activity
example:
Activity A
onCreate....
Intent myIntent = new Intent(this, ...
0
votes
0answers
7 views
Error while connecting to SQL database
I am getting the following error while connecting to the MS SQL 2008 R2 from a specific server, from other severs it works fine -
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could ...
0
votes
0answers
3 views
gradlew missing in generated android project
Okay I'm trying to do some android developing via command line / with an alternative IDE.
I have the following path variables set up:
jdk1.8.0_40/bin/
android-sdk-linux/tools/
android-studio/bin/
...
0
votes
0answers
2 views
sj:submit with targets and errorElementId not rendering properly
I have a struts application, In one of the pages I am using sj:submit to submit the page with targets and errorElementId attributes.I have used the struts2 validations on the page and the result type ...
0
votes
1answer
10 views
How to switch back and forth between JFrames
To start I am just playing with buttons and JFrame. The issue is that I can switch from one Jframe to the next with a few lines of code here...
JButton studentLoginButton = new ...
1
vote
1answer
10 views
Parsing String to Calendar in Java?
I am having trouble parsing a string to a calendar object in java by pulling it from an XML element (I'm writing an android app) so I can calculate the length of time between the time in the string ...
0
votes
0answers
2 views
JMeter DB2 Connection
Having trouble establishing connection between JMeter/Db2
I have loaded db2jcc.jar and db2jcc_license_cisuz.jar to the lib dir of JMeter
Here is a screenshot of my current conn set up.. Does ...
0
votes
1answer
13 views
Java Scanner isn't reading my txt file
I am a tad frustrated because something this simple is giving me problems. It's been a while since I fired up some Java but I'm pretty sure I've done everything right. Here is my code:
import ...
0
votes
0answers
6 views
Java iReport JDBC connection error
I am trying to create an iReport using netbeans iReport plugins.
When I Try to test a connection, it gives an error message as,
SQL problems: Access denied for user ''@'localhost' to database
...
1
vote
2answers
25 views
How to split a string without losing any word?
I am using Eclipse for Java and I want to split an input line without losing any characters.
For example, the input line is:
IPOD6 1 USD6IPHONE6 16G,64G,128G USD9,USD99,USD999MACAIR 2013-2014 ...
-4
votes
0answers
26 views
Java Code not running
I am trying to run an exsisting project in Eclispe luna. I am getting the following error. The zip file of the project is available at the following link
...
0
votes
0answers
5 views
Association references unmapped class: com.service.hibernate.entities.Connetion
Sorry for bothering you. I'm newbie with hibernate and I have problem with mapping. I think that it'll be stupid mistake but I'm not able to deal with this problem on my own. I won't decribe whole ...
0
votes
1answer
17 views
How to search an array of objects and then update a part of the object in java?
I have an Array of objects. Each object is a customer record, which is the customer ID (int), first name (String), last name(String), and balance (double).
My problem is that i am not supposed to ...
-2
votes
1answer
9 views
How to loop user input until a sum is reached?
I am very new to Java and StackOverflow (so I hope this question and answer aren't already posted on here). I am writing a code for a vending machine and I need to create a loop so that it continues ...
0
votes
1answer
32 views
Incorrectly passing token to string array
I am writing a program that reads a text file passed as an argument to the main method and extracts all the unique words from the file and prints them in the console one per line. I am having trouble ...
0
votes
0answers
6 views
Has anyone tried to test SCORM in Moodle with Selenium?
I want to test SCORM package in Moodle using Selenium Webdriver with Java. I want to test basic functions - just navigating inside SCORM, like clicking next/previous buttons, ticking radio ...
-1
votes
0answers
13 views
printing an array to get a specific output [duplicate]
The objective of this program is to make a tic tac toe board using a random class to fill in X's, O's or spaces. I have already written the code to fill the a array and then I was required to make ...
0
votes
0answers
14 views
Android: can not show dialog from AsyncTask class
I've builded Updates class for my Android app. It works fine except Download inner AsyncTask-class.
I wanted to display progress dialog in LoadingActivity while file is downloading.
Firstly, I ...
0
votes
0answers
5 views
Can not remote debug JSP in Intellij 13
I can remote debug JSP in Eclipse with a Remote Java Application. But it didn't work in Intellij 13, following is my settings:
It can hit the breakpoint set in Java class, but didn't work for JSP.
...
0
votes
1answer
25 views
StackOverflowError during recursive calls to find closest empty index in 2D array
I am trying to use a recursive approach to figure out the closest empty element in my 2D array if the input index already has an element. For example, I call my method tryPlant(int X, int Y) to put a ...
2
votes
1answer
23 views
Populating ArrayList
I am trying to populate an array list, however, my array list constantly equals 0, and never initializes, despite my declaring it over main().
This is my code.
static ArrayList<Integer> array ...
0
votes
0answers
6 views
Trying to refresh JTable from third party using abstractTableModel
When i am using a button event i success to display the update table in my gui window,
The problem is when i want to refresh my data from an Update() method(=from a third party).
As i read i realize i ...
0
votes
0answers
2 views
org.apache Cradle Dependency errors causing MultiPartEntity to error
I have a dependency in Gradle and i get this message when i sync grade Warning:Dependency org.apache.httpcomponents:httpclient:4.4 is ignored for debug as it may be conflicting with the internal ...
0
votes
0answers
4 views
How To Modify the HTML Body of a MimeMessage
I want to be able to take an RFC-822 MimeMessage, parse it into the java MimeMessage class (or equivalent), walk the content tree to find the HTML message body, modify that BodyPart, and then ...
0
votes
1answer
8 views
Jar command not adding requested manifest file to archive
I am running the following - and the resulting MANIFEST.MF does not contain the one referenced below:
jar -cvf instrument.jar -m instrument/META-INF/MANIFEST.MF -C instrument .
Here is the intended ...
0
votes
1answer
11 views
Is it posible to convert URL parameteres to JSON format in JAVA
I have REST client that delivers URL parameters. My REST infrastructure accept JSON format. is there any way to convert the URL parameters to JSON format in JAVA?
Or eventually any good idea if you ...
-1
votes
3answers
47 views
Can if statements be broken half way through?
I was just wondering if an 'if' statement that is halfway through running will stop running if the conditions it has to meet are no longer met. It is hard to explain with words, here is an example:
...
0
votes
0answers
3 views
Environment variable issue with gdal java under Windows 7
I built gdal and java bindings for gdal.
My environment variables I added (Windows 7 64 bit):
CLASSPATH = C:\Program Files\Java\JDK1.8.0_40\lib; C:\gdal-1.11.1\swig\java\gdal.jar
the dlls ...
0
votes
1answer
38 views
Issues with objects in HashSet
I created a HashSet of Console objects which use 2 strings. One is for the company name for the console, the other is the console name. I have no issues with most of the basic methods (I know how to ...
-2
votes
0answers
25 views
Public vs Public Static and Setters and Getters
I was given a project in my Java class that wanted me to create two classes (Passenger and Flight). They are supposed to work together in order to create an itinerary for passengers who have booked, ...
0
votes
0answers
22 views
Method Binding in Java
When I was reading Thinking in Java (4th Edition) recently, I got a problem about method binding in Java. First let's look at two definitions from the book:
Connecting a method call to a method ...
0
votes
0answers
21 views
Selection two private constructors in public constructor
I have the following Java-class:
public class Permutation {
...
private Permutation(int[] cycle){...} //1
private Permutation(int[] inp, int[] outp){...} //2
public Permutation(int[] array, ...
0
votes
2answers
16 views
2D Array Matrix; Reading Diagonals
I am attempting to write a method for a 5x5 matrix that gives the output:
00004
00030
00200
01000
00000
My output for this specific code is:
40000
03000
00200
00010
00000
Essentially I am attempting ...
0
votes
0answers
5 views
How do you refresh a hibernate hsql.dat file?
I need to update my hsql.dat file. I changed the java hibernate code and now there is a query in it that has a contradiction. Is there a way to administer the database while my web app is running?
...
0
votes
0answers
15 views
Take picture over wireless camera via android app
I'm currently building an android app that capable of remote camera (ipcam) over wireless local area network (offline/no internet required). Now I need to add "Take picture" button and capture the ...
0
votes
0answers
28 views
Java Tic Tac Toe Game Confirming Winner
Below is my code for a Tic Tac Toe game. There are two problems I am running into. For one, I am not sure how to return which player has won (X or O), I can just return if there is a winner. As well, ...
0
votes
0answers
9 views
When using JAMA in Java how do you cast a 2D array into a matrix?
The code I have so far is:
double[][] aTranspose = convertTo2DArray(x, width, height);
Matrix At = new Matrix(aTranspose);
but I get a run time error. I know convertTo2DArray is implemented ...
0
votes
0answers
7 views
spring @SessionAttributes and “Cannot create a session after the response has been committed”
I am trying to set and get a session attribute, but either I have misunderstood how it works or i've done something wrong.
Please could somebody explain why this doesn't work.
I have the following ...
-3
votes
1answer
18 views
My java calculator is returning the error “one can not be resolved to a variable”?
I am trying to make a java calculator that works for multiplication, division, subtraction and addition. I am just starting the division part and it is incomplete, however I am getting an error that ...
0
votes
0answers
19 views
Generate an infinite stream of tuples
I need to generate an infinite stream of tuples, which satisfy the equation:
2 * a * a + b * b = c * c
I am just starting with java 8 and am unsure how to achieve this
I have an interface for the ...
0
votes
4answers
21 views
Object class, java API
When I implement a Queue interface, it requires me to implement all abstract methods within that interface. However, some methods has an input variable of the type Object. what does it refer to, and ...
0
votes
2answers
21 views
How to Reuse BaseAdapter view for multiple lists
I have a BaseAdapter list view that takes a List<objects> and I would like to reuse it with different lists. How do I go about this?
0
votes
0answers
4 views
(LibGDX/JAVA) How can I get a rectangle to rotate with this pendulum so I can start detecting collisions?
One of the objects in my game is a pendulum that swings in a semi-circle. This is done by having an update() method like this:
public void update() {
angleAcceleration = +1.81 / length * ...
0
votes
2answers
18 views
NullPointerException in NavDrawerListAdapter for NavigationDrawer in Android
I am having a really strange problem. I am using a NavDrawerListAdapter for my NavigationDrawer in my Android App. If the list has 13 items (NavDrawerItem), it works OK. However, when I add a 14th ...