Spring's deployment deployed on Tomcat will not start

I have a working Spring application that contains a embedded Tomcat. As a executable war, it works fine. As I'm going to use AngularJ for the front end, it isn't very practical to have the Spring project in an executable jar, as I will do debugging i

How to define an immutable object in a mutable Java class?

In a class, I want to define an empty object and use it anywhere we need it. This object needs to be immutable to avoid accidentally modification. If this object is defined as a public static final member of the class, the object could be changed if

Try to write a method to create a list of tables

I'm using Netbeans/GUI to make a fantasy basketball game program. I'm trying to create methods that create arraylists, that way I can call the method for the array every time I need it for one of my button events, rather than recode the array under e

InvocationTargetException and NullPointerException JavaFX

I am using SceneBuilder to create a GUI to get information from the user via text feilds. I get this InvocationTargetException and stack trace when I click the calcPremiumButton button. > Exception in thread "JavaFX Application Thread" java.l

JPanel position on JFrame

I have a problem with JPanel location. I started the creating a small game... I created 2 panels in design (on a JFrame). All worked good and the panels were on the correct places. In my game I have to use 2 graphic tables so I use 2 panels and I add

Build and deploy a strategy for a Java project using Git

So I am creating a personal Java project with two other friends and we are using git for source control. And we want to just be able to commit changes to the repo which will be on a remote server(sort of staging environment) and then I want to be abl

Loop not accept my key entry - Java AWT

I am using a while loop in my method public void keyTyped (KeyEvent e) The problem here is that, the program enters the loop, it asks the user for input. And if the input is within the parameters, set by "while", it just keeps on repeating that

using the recursive method for the trinary search

I am writing a recursive method that, instead of carrying out a binary search algorithm, splits an array into three and uses a trinary search algorithm. I am fairly positive that my recursive case is correct, yet there seems to be a problem with my b

JAVA: Trying to change an object without making a new object

I am working with a Point object that has an x and y component, Point(double x, double y). I want to write a function that changes the values of the x and y component without having a new Point p = ... For Example, this is my current version: public

Parallel and end execution of multiple threads

I have a simple application in which I create 3 threads inside a class to ping 3 different websites and note the time taken to do so. I wish to enhance it by seeing which thread out of the 3 executes successfully first and terminating the other two .

replace the old JButton with a new one

I've created an array of buttons: JButton bt[][]=new JButton[8][8]; And then I call a function called refreshBoard in the following way public void refreshBoard() { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { bt[i][j] = new JButton()

Add json jar to classpath java

I'm very new to Java world. I want to add the Json lib to compile my program. I downloaded the file from here. When I tried to compile the program with javac -classpath json.jar MyClassName.java I'm getting the error : Note: JsonSimpleExample.java us

.clone () or Arrays.copyOf ()?

In an effort to reduce mutability, should we rather use public void setValues(String[] newVals) { this.vals = ( newVals == null ? null : newVals.clone() ); } or public void setValues(String[] newVals) { this.vals = ( newVals == null ? null : Arrays.c

Recursive explanation

Today in the class of Java the professor came up with this example but I really couldn't understand very well the process how to go through this method in order to get the result = 4. Could any body please put some lines as clear as possible how is t

How to store these values

is there type is there to store the value <string,string,int> if i use Namedlist(Solr),List it can be achieved? if so how to use. Any other way is there? example: <"A",America,code> <"B",London,code> I need this in ja

How can I find the number of days between two dates?

I have two Dates. How can I tell the difference between these two dates in days? I have heard of SimpleDateFormat, but I don't know how to use it. I tried this: String fromdate = "Apr 10 2011"; SimpleDateFormat sdf; sdf = new SimpleDateFormat(&q

List of classes in Java

I have multiple classes (B, C and D) that are subclasses of class A. I need to make a List/Array containing B, C and D and create Objects based on whatever element I pull from the List/Array. In AS3 I would do something like this: var classes:Array =

Eclipse function to organize a class file?

Eclipse has tons of features, i'm wondering if this one exsists? Or if any shortcut ways of doing it exist? I want to arrange my class data into Variables, Constructors, Methods in that flow(Top to Bottom) Further refined I would like to arrange by a

Swing Worker modal dialog box does not close

I have a SwingWorker thread that launches a modal dialog box (from a property change listener that listens to the StateValue of started) and the swing worker proceeds to do its work. However, it looks like the done method is not called because that i

ClassNotFoundException: com.microsoft.sqlserver.jdbc

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