Error Says Else Without If
Oct 10, 2014
import java.util.Scanner;
public class Pract3CQ2 {
public static void main(String [] args) {
Scanner keyboardIn = new Scanner (System.in);
//Declare variables
int a=20, b=10, diff;
[Code] ......
View Replies
ADVERTISEMENT
May 22, 2014
For my jsp file, the code editor shows no error, but the projects window shows an error. I built my project again, cleaned the project, restart eclipse twice and summoned cthulhu. But my project still shows an error. How do I find the cause.
Eclipse project -
JSP file -
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="mine" uri="DiceFunctions"%>
[Code] ....
View Replies
View Related
Apr 5, 2014
I have written some error checking code
File name ErrorPage.jsp
<%@ page language="java" isErrorPage="true" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Error</title>
</head>
[code]...
I have put error.jsp and badpage.jsp file in public access folder that is web content in eclipsewhen I am running the code I am status code of 500 and not the errorpage.jsp message .
View Replies
View Related
Mar 24, 2015
I need to compile a JAVA code to call a web service. The web service provider gave me this sample code, but compiling with javac i have one error for each row of code.
Code attached!code.txt
View Replies
View Related
Dec 31, 2014
here is code :
public final static void main(String[] args){
double d = 10.0 / -0;
if(d == Double.POSITIVE_INFINITY)
System.out.println("Positive infinity");
else
System.out.println("Negative infinity");
}
now ideally this might throw Arithmetic Exception.. but it prints positive infinity ,.. why.. ??
View Replies
View Related
Oct 23, 2014
I am getting a NullPointerException Error and I cannot seem to figure out what is causing it. I am reading in a grades1.dat text file and putting the values into a 2D array. The error is occuring in my addGrade method, but I am not sure what the error is. Here are the values for my grades1.dat that I am running in through Run Arguments in JGRASP.
Student1
5
a Activities 0.05
q Quizzes 0.10
p Projects 0.25
e Exams 0.30
f Final 0.30
a100 a95 a100 a100 a100
q90 q80 q100 q80 q80 r90
p100 p95 p100 p85 p100
e77.5 e88
f92
Here are the errors that I am getting.
Exception in thread "main" java.lang.NullPointerException
at GradeBook.addGrade(GradeBook.java:114)
at GradeBookApp.main(GradeBookApp.java:55)
import java.util.Arrays;
/**
* Stores students name, a char array of category codes, a String array of categories, a double array of category weights, and a two dimensional double array of grades where each row contains all the grades in a particular category.
[code]....
View Replies
View Related
Jun 16, 2014
Im trying to connect to sql server but i get this error
2014 7:03:38 ΜΜ com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 8ee72721-9ec7-41e2-9f57-ebc16d958073 Prelogin error: host localhost port 3306 Unexpected response type:74
url = "jdbc:sqlserver://localhost:3306;user=root;password=root;database=test";
When i try to connect with mysql workbench i connect succesfully.
View Replies
View Related
Oct 1, 2014
I am having a error in progress bar ... I want to see the progress upon checking the sha1 of files
This is the code:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package program1;
//Import packages
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
[Code] .....
This is the error
Exception in thread "Thread-2" java.lang.NullPointerException
at program1.ProgressBar$thread1.run(ProgressBar.java:98)
at java.lang.Thread.run(Thread.java:744)
View Replies
View Related
Oct 27, 2014
So I am working on a school project and I have 2 classes, class FakeGravity contains all the properites and class BouncyBall is my driver class. For some reason when I try writing
FakeGravity gravity = new FakeGravity( );
I get an error. I am attaching an image of the error, and also attaching the program just in case you need more information. Also I was using blueJ to write the program
dcasarrubias, on 27 October 2014 - 02:44 PM, said:
So I am working on a school project and I have 2 classes, class FakeGravity contains all the properites and class BouncyBall is my driver class. For some reason when I try writing
FakeGravity gravity = new FakeGravity( );
I get an error. I am attaching an image of the error, and also attaching the program just in case you need more information.
View Replies
View Related
Dec 12, 2014
I am getting the following error:
Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier '.2f'
The line it is referring to is:
System.out.println("
Toppings: ");
for (int i = 0; i < toppings.size(); i++) {
System.out.format("%-15s£%.2f
",BBQSpecial.getToppings().get(i)
.name(), BBQSpecial.getToppings().get(i).getCost());
View Replies
View Related
Nov 5, 2014
package calculator;
public class operations {
int a = 5;
int b = 10;
public void add(int a,int b)
{
int c = a+b;
System.out.println(c);
}
}
I am not getting output to this question though it runs.
View Replies
View Related
May 12, 2014
I am using netbeans 7.2, glassfish 3.1.2, JSF 2.1 and Primefaces 3.2. When I add more than three menu tabs, I get this error ui layout initialization error the center-pane element does not exist the center-pane is a required element. This is my template.xhtml code:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
[Code] ....
View Replies
View Related
Jul 23, 2014
I have written the below program and while compiling i am getting error. The program and error details goes as follows,
//compute distance of light travels using Java long variable.
class Light {
public static void main(String args[]) {
int lightspeed;
long days;
long seconds;
long distance;
[code]....
I have given the Java file name as 'Light.java'. I have also verified the availability of the java file and compilation path. both are matching. Also, Java file name and class name defined are also same.
View Replies
View Related
Feb 17, 2014
So I am finishing up a GUI that randomly rolls a dice and shows you the dice face from a file that I have on my computer. It compiles fine, but when I open the GUI and press the button "Roll" it gives me errors and does not display the images.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.util.Random;
[code]....
View Replies
View Related
Mar 14, 2014
import java.io.*;
public class Q2{
public static void main (String[] args) throws IOException,
ClassNotFoundException
[code]....
For this program, i successfully did create an output.txt, but i have some weird characters in front of "hello" when i open it in notepad or wordpad.
View Replies
View Related
Mar 11, 2014
I'm very new to java code I'm currently learning about loops I've tried to write this for a statement in the program I'm making but its not working. I keep getting this message
LoanQualifier.java:26: error: illegal start of expression
if (salary >0||<=250000)
^
LoanQualifier.java:28: error: illegal start of type
if (yearsOnJob >0||<50)
I'm using Jgrasp for a complier
View Replies
View Related
Aug 6, 2014
I am trying to copy all odd value of an array in one array and all even value in another array
this what i have try to so far
private static void arrayOperation(int[] a) {
// TODO Auto-generated method stub
int n=a.length;
int odd_value[] = {};
[Code].....
But i am getting error
View Replies
View Related
Jan 14, 2015
I am pretty new to Java and I am working on a sample Search code from my textbook. I can't figure out why I am getting the following error because I copied the sample exactly as it is in the book. The error is illegal start of expression on the second to last line.
public class Search {
public static final int NOT_FOUND = -1;
public static int binarySearch( int [] a, int x )
{
int low = 0;
int high = a.length - 1;
int mid;
[code]....
View Replies
View Related
Apr 28, 2009
Here is the code I am trying to execute its giving me the error with TextReader..
import java.io.*;
import java.util.*;
public class WordCount {
static TextReader in; // An input stream for reading the input file.
static PrintWriter out; // Output stream for writing the output file.
[Code] .....
The error is:
C:
eha>javac WordCount.java
WordCount.java:20: cannot find symbol
symbol : class TextReader
location: class WordCount
static TextReader in; // An input stream for reading the input file.
[Code] .....
View Replies
View Related
Oct 15, 2014
I have just enabled CDI on Websphere 8.5.5 and added interceptors
In beans.xml file
<?xml version="1.0"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance"
xsi:schemeLocation="http://java.sun.com/xml/ns/javaee http://
java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<interceptors>
<class>com.example.jaxrs.SecurityChecked</class>
</interceptors>
</beans>
[code].....
When i deploy EAR, i get below error.
WebContainerL I WebContainerLifecycle startApplication OpenWebBeans Container is starting...
[10/15/14 14:53:15:259 EDT] 00000067 BeansDeployer E BeansDeployer deploy org.apache.webbeans.exception.WebBeansConfigurationException: Given class : interface com.example.jaxrs.SecurityChecked is not a interceptor class
what would be the cause of this error?
View Replies
View Related
Oct 15, 2014
So I'm trying to add two numbers using a stack class I made myself. I have a main class with a main method in which I use three stacks on holds one number one holds the other and then I sum one digit at a time keeping in midn that there may be a carry before putting the result on a third stack.
My problem is I'm getting a null pointer error when it should be putting an integer into the top of my stack which is index 0, I've checked my code and can't see why it would be doing this.This is my main method in my main class
import java.util.*;
import java.io.*;
public class CS25driver {
public static void main(String[]args) throws FileNotFoundException {
[code]...
my input file looks like a single line of input stating the problem followed by two lines of input which need to be summed.this is the error I'm getting
Exception in thread "main" java.lang.NullPointerException
at StackClass.push(StackClass.java:38)
at CS25driver.main(CS25driver.java:55)
View Replies
View Related
Jan 29, 2015
I am trying to deploy a really simple EJB app-client jar to glassfish but keep seeing the following error in regard to my jar file:
The following extensions or libraries are referenced from the manifest of
C:UsersasmithAppDataLocalTempClient-18654884305939595801.0.jar
but were not found where indicated:
libRemoteInterfaces-1.0.jar libjavaee-api-7.0.jar ;
ignoring and continuing. My jar is set up as follows:
Client-1.0.jar ->
->META-INF
MANIFEST.MF
application-client.xml
sun-application-client.xml
->com.alan.client
Main.class
[Code] ....
I've tried to indent the jar contents correctly but not sure how to do it!
View Replies
View Related
Jun 12, 2014
I am reading a file and sorting a list, and I cannot figure out why I am getting an error on line 15 that contains the following code
Collections.sort(sortedContributorList, new Contributor());
This is the error I keep getting:
The method sort(List<T>, Comparator<? super T>) in the type Collections is not applicable for the arguments (LinkedList<Contributor>, Contributor)
import java.util.*;
import java.io.*;
public class myhashTable {
public static LinkedList<Contributor> sortedContributorList = new LinkedList<Contributor>();
public myhashTable(){
[code]....
View Replies
View Related
Jan 16, 2014
I have been trying my hand at making 2d top down view games and have found myself repeatedly using the same code so i created a file with all the functions so when it is down i just import the jar and dont have to keep rewriting functions. I have trouble because the background is loaded on the screen and i dont know why as i didn't tell it to load. In fact I set the panels visiblity to false. Both of my classes are in the same package. Why I still get the Image.
Walking Turtle
Java Code: import javax.swing.*;
import java.awt.event.*;
public class turtleWalker extends JFrame{
public static void main(String[] args){
JFrame frame = new JFrame("Walking Turtle");
[code]....
View Replies
View Related
Aug 12, 2014
I was almost finished with my program when I noticed I had a big logical error. At the very beginning of my else if statements I would jump down to my else statement.
Java Code:
import java.util.Scanner;
public class InternetServiceProviderNew
{
public static void main(String[] args) {
double packageA, packageB, packageC, extraA, extraB, userHours, aHours, bHours, cHours, userCharges;
packageA = 9.95; packageB = 13.95; packageC = 19.95; aHours = 10; bHours = 20;
String userPackage, A, B, C ;
[code]....
View Replies
View Related
Apr 19, 2014
I'm using a jSpinner Number model:
Here's my code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int qty2, total, payment, change;
String title;
[code]....
I tried using this since the jSpinner's minimum value is 1.. (I want it to reset the jSpinner after updating the database):
jSpinner1.setValue(new Integer(1));
But gives me an error:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.Vector.elementData(Vector.java:730)
at java.util.Vector.elementAt(Vector.java:473)
at javax.swing.table.DefaultTableModel.getValueAt(DefaultTableModel.java:649)
at shop.jSpinner1StateChanged(shop.java:267)
at shop.access$100(shop.java:22)
at shop$3.stateChanged(shop.java:145)
at javax.swing.JSpinner.fireStateChanged(JSpinner.java:457)
View Replies
View Related