I have upgraded to myeclipse 10.7 ,java "com.sun.java.jdk.win32.x86_64_1.6.0.013" and Struts 2.1 (Right now using Struts 1.1 support) from myeclipse 10.7 ,java 1.4 and Struts 1.1. I installed jasperassistant 2.4.2 plug-in using jasperReports 2.0.2 (My old report files were using same version).
All files compile successfully in new environment but when I export I get following error Export to PDF
a. Reports having no crosstab
"Java.lang.NullPointerException"
b. Reports reports having crosstab
"Error loading object from InputStream"
java.io.InvalidClassException: net.sf.jasperreports.crosstabs.base.JRBaseCrosstabGroup;
Export to EXCEL
a. Reports having no crosstab
java.lang.NullPointerException
b.Reports reports having crosstab
java.lang.NullPointerException
I am new to JSF and when i try to implement a sample application im getting this wierd error of page not found(.xhtml). Here is the code i have created..
Bean class :
package com.trail.beans; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean @SessionScoped public class UserLoginBean {
I m new to programming and am working on the college project. I have MySQL 5.6.20, Eclipse Kepler and Apache Tomcat 7.0.54. I m trying to retrieve the whole table from MySQL schema into a jsp. All the possible things i can do, i have already tried, but none of them are working.
The following attachment contains the whole project. I have my sql connection code in Sample.java file, which i want to get working in Fetch.jsp on the Submit button click. But it shows the tomcat error as localhost:8080/Sample HTTP Status 404-/Sample ; type Status report; message /Sample; Description The requested resource is not available.
<%@ 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"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
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.
What I want to do is to deserialize the Java object which is contained within the <Character> element. (The first four characters "aced" reveals that we are dealing with serialized content. So far so good.) I'm using this code to grab the characters within <Character> and deserialize them into a Java object:
Node characterElement = responsesElementChildren.item(0); // <Character> String characterSerialized = characterElement.getTextContent(); ByteArrayInputStream bais = new ByteArrayInputStream( characterSerialized.getBytes() ); ObjectInputStream ins = new ObjectInputStream( bais ); objects.Character retrievedCharacter = (objects.Character) ins.readObject();
However, the above operation fails and I get this exception:
java.io.StreamCorruptedException: invalid stream header: 61636564 at java.io.ObjectInputStream.readStreamHeader(Unknown Source) at java.io.ObjectInputStream.<init>(Unknown Source) at network.requests.RequestRetrieveCharacter.addResponse(RequestRetrieveCharacter.java:99) at network.GameServer.ask(GameServer.java:151) at Client.main(Client.java:43)
I cannot tell if the received serialized data is okay or not, so I really don't know if the problem is here in the deserialization or actually in the serialization (on the sending side where the Java object is serialized and packed into an XML message).
I read that InputStream is used for byte based reading it reads 1 byte at a time.And InputStreamReader is used for charcter based reading so it reads one charcter at a time so no need to convert this first to int then read it.Here is reading using InputStream.
input=new FileInputStream("D:/input.txt"); int c; while((c=input.read())!=-1) { System.out.print((char)c); }
and here is reading using InputStreamReader
input=new FileInputStream("D:/input.txt"); reader=new InputStreamReader(input,"UTF-8"); int c;
so what is difference between InputStream and InputStreamReader in both case i have to use a Int and then read it and at the end if I want to print that data I have to cast that with "(char)c".So what is advantage of using InputStreamReader?
I am new to programming in regards to I/O, channels, SSH, etc...
At the moment I am trying to transform the Shell.java program from the JCraft JSch examples; JSch - Java Secure Channel - Examples
The way in which I am trying to transform it is by instead of having the character input go into the channel automatically from the keyboard (refer to line 77 in Shell.java), I just want to pro-grammatically insert characters in to the channel at my discretion, so for example I have a string called unixCommand that I want to insert into the channel, and I don't want there to be any other way of inserting into the channel such as the standard input stream, so for example I'd have the statement <insert unixCommand to UNIX box at other side of channel> inserted somewhere after line 100 in Shell.java.
I was thinking that maybe I have to use some other InputStream object at line 77 when setting the channels input stream instead of System.in, but I am not sure how to do this (but really I'm not sure if I'm even on the right tracks?). I believe all this confusion may be down to a misunderstanding with the general concepts involved with channels and I/O ...
I am trying to transform the Shell.java program from the JCraft JSch examples : [URL] ....
The way in which I am trying to transform it is by instead of having the character input go into the channel automatically from the keyboard (refer to line 77 in Shell.java), I just want to pro-grammatically insert characters in to the channel at my discretion, so for example I have a string called unixCommand that I want to insert into the channel, and I don't want there to be any other way of inserting into the channel such as the standard input stream, so for example I'd have the statement <insert unixCommand to UNIX box at other side of channel> inserted somewhere after line 100 in Shell.java.
I was thinking that maybe I have to use some other InputStream object at line 77 when setting the channels input stream instead of System.in, but I am not sure how to do this (but really I'm not sure if I'm even on the right tracks?). I believe all this confusion may be down to a misunderstanding with the general concepts involved with channels and I/O.
I'm writing a really simple 1 on 1 chatting program thing using java.net.Socket and reading each other's messages b using writeUTF() and readUTF() of java.io.DataOutputStream and java.io.DataInputStream. Thing is, I wanna write a thread for both sides to continuously read from their respective socket's input streams while ignoring the lack of data coming through like when one user is not sending a message or something. I've written a dumbed down version of this that only reads one message from only one side and another one that sends a file, both of which work fine, I guess.
I'm using java.util.Scanner for user input, if that's acceptable, for I am not too familiar with Java's other readers. Also, I just started teaching myself about java.net.Socket, so I may not be too familiar other than the basics like how to set up a connection and how to send data using the getOutputStream() member function and stuff like that.
I had a Rest web service call and get InputStream.Now i want to Write Input Stream to PrintWriter of servlet.So that it can be downloaded.I am able to write String and file can be downloaded using following code, i want it to work for Input streamFollowing is code:
response.setContentType("application/x-download"); response.setHeader("Content-Disposition", "attachment; filename="" + name + ".pdf""); response.getWriter().write(is);
Write can take following: write(String) write(char[]) write(int) write(String, int len, int off) write(char[], int len, int off)
I think char[] will not harm PDF file which is going to download in it
package home; import java.awt.Color; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class Box{ int x=70; int y=70;
[Code] ....
L a = new L(); causing the error. It will be great to know why it is showing error.
Exception in thread "main" java.lang.NullPointerExceptionat DogTestDrive.main(DogTestDrive.java:19)
Here is the source
class Dog { int size; String name; void bark () { if (size < 60) { System.out.println("Woof woof");
[code]....
Some background: I'm reading "Head first Java 2nd edition" and I'm going through the examples which is showing me how to change the state of an object. The original code looks like the code below, however the previous chapter went over creating array's of an object, so I created an array of the object "Dog" and wanted to re-write it this way. To my understanding, it should work but it's giving me that error when I execute it. The error itself isn't very clear, if I could get a line number pointed to, that would work.
class Dog { int size; String name; void bark() { if (size > 60) { System.out.println(“Wooof! Wooof!”); } else if (size > 14) { System.out.println(“Ruff! Ruff!”); } else { System.out.println(“Yip! Yip!”);
I have my code in 3 different files using encapsulation (Data hiding) and i have 1 problem at the very end of my code in my if and else statement (very bottom) when trying to call the classes from the other 2 documents. I will put the code in 1st document to 3rd document.
// FIRST DOCUMENT public class CollegeCourse { //class name //variables String deptName; int courseNum; int credits = 3; double fee;
[Code] ....
UPDATE: error message is
UseCourse.java:24: error: cannot find symbol LabCourse lc = new LabCourse(department, course, Credits); ^ symbol: variable department location: class UseCourse UseCourse.java:24: error: cannot find symbol LabCourse lc = new LabCourse(department, course, Credits);
I am using a static method to convert a string to an Integer object. Next using a instance method to convert Integer object to an int.
Compiler is giving me two "cannot find symbol" errors:
One pointing to the dot operator between "Integer.valueOf(s)"
The other pointing to the dot operator between "obj.intValue()"
I have latest JDK installed: jdk-7u51-windows-x64.exe
Looks like JCL installed correctly with rt.jar file located in "lib" directory under "Program Files"
Following is source code:
Java Code:
public class StringToInt { public static void main (String args []) { String s = "125"; Integer obj = Integer.valueOf(s); int i = obj.intValue(); i += 10; System.out.println(i); } } mh_sh_highlight_all('java');
I usually code in PHP, C++ and ActionScript.I'm trying to follow an example of how to add images to a full screen application. What he does is that he adds a JPG background image, and then 4 PNG images. I tried to do it like I always do, by writing the code by myself looking at the book. It didn't work. I searched for errors in the code, changed some things, tried different things, but it didn't work. Then I tried to use his own code, that I downloaded from his website. That didn't work either.. I tried to find another way to add an image, and I can't seem to figure out a way to implement images in any other way into this class that's written in this book.. My Java programming level isn't just high enough.
Here's the code for the file where the images load, downloaded from the authors website (I've modified the brackets and some spaces so that it becomes easier to read):
Java Code:
import java.awt.*; import javax.swing.ImageIcon; import javax.swing.JFrame; public class ImageTest extends JFrame { public static void main(String[] args) { DisplayMode displayMode;
how I can change my code so that somebody can actually input the specified file path, rather than having it fixed in the code. I previously used
Scanner in = new Scanner(System.in); System.out.println("What is the filename?"); String input = in.nextLine(); File file = new File(input);
But then the program would not display the frequencies.
import java.io.File; import java.util.*; /* This program will allow the user to enter in a text file name, when prompted the program will anaylser the text and display the frequencies */ public class AssP { public static void main(String[] args ) { Scanner scan; try { Scanner scanner = scan = new Scanner(new File("C:/Users/Mary/workspace/Assingment/src/test.txt"));
[code]....
This is my current code and I need to so the user can load their own files.
I have added the image in the src and bin directories and cross-checked that the name of the image file is correct..Here is the main class
import javax.swing.*; public class apples { public static void main(String args[]) { JFrame frame = new JFrame(); MyDrawPanel wid = new MyDrawPanel(); frame.add(wid); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setSize(300,300); } }
and here is the class that does the image adding part
import java.awt.*; import javax.swing.*;
public class MyDrawPanel extends JPanel { public void paintComponent(Graphics g) {
Image image = new ImageIcon("b.png").getImage(); g.drawImage(image,20, 20, this); } }
So I would like to get information out of a web-API. But my question is how I do this. I guess I need to read the URL first. And parse it after but what is the best way?
We are using an applet in our web application. The applet of our application is dependent on bouncycastle jar,bcprov-jdk15.jar and few other jar's whose size comes around 4 mb. When using the appliaction on jre7, the applet is taking too long time to load than usual time. Is there any way to place these jar's in client machine? Will it improve the performance? Is there any other way to reduce the loading time of applet apart from placing jars in client machine?
How load dynamically load jars? Is it possible to load updated jar in my application by code? My application has to use new and modified class files but application should not be restarted.
I have an assignment where I need to add an interface to an already-created program. I have an array of objects, where each object has a name, price, and priority.
In my original program (which worked), I had all of the objects in 1 class. The professor said that I should split up the name/price/priority into 3 different classes. So what I have is an array that belongs to an interface, and name/price/priority implements. But I am having trouble loading the data into the array (from another class) once I am done with loading name.
Here is what I have so far.
public class Main { public static void main (String[] args){ Interface[] arr = new Interface[7]; Scanner keyboard = new Scanner(System.in); System.out.println
[code]....
Line 18 in the ItemName class is giving me an error, and I know it is because arr is of type Interface, and I am trying to assign is a String. But I don't know how to do this. In my original program I was able to do arr[x].getName(); but when I do that in Main, I get errors.
how to assign to an interface array from multiple classes.