32,204 Topics

Member Avatar for
Member Avatar for lrolsto1

For a CS project, I need to have my program "gracefully terminate" in case of certain user input errors. What is the best syntax to do this?

Member Avatar for aspire1
0
75
Member Avatar for lrolsto1

Assignment: Create a program to practice reading in from a file, search for a particular word when the user inputs a word to search for and a file via command line args. Print out the entire line each time it is found. Progress: It compiles, and runs.... kinda. Problem: I …

Member Avatar for BhagatS
0
88
Member Avatar for rumpleteaser33

Hi, I'm trying my first program using servlets and JSP and would appreciate any help or advice about a problem I'm having. In my servlet I'm connecting to the database and displaying all the records in there. I'm then trying to add data to a JavaBean so that I can …

Member Avatar for peter_budo
0
165
Member Avatar for shroomiin

hey everyone. I am supposed to make a program that finds the smallest number out of a set of numbers. the amount of numbers input is up to the user. i have to print the smallest number, and what input it was (ex, 1st number 2nd number 3rd number...) i …

Member Avatar for dlucke17
0
112
Member Avatar for hsncvs

Hi guys, i need some help on my java homework. i need a text box which will have a piece of text. then i must show how many times every word has written in the text. in my way of thinking i should add every word to an array and …

Member Avatar for stultuske
0
97
Member Avatar for shahab.burki

Hi, I am stuck in building 2D Array from StringBuffer. I am reading data from a file and store it in a StringBuffer object by appending "\n" at the end. My read method is in the following. [CODE]public void tmFileReader() throws IOException { Work wrk=new Work(); StringBuffer buffer=new StringBuffer(); FileInputStream …

Member Avatar for BestJewSinceJC
0
162
Member Avatar for shahab.burki

Hi, I am developing a TM simulation program. But got stuck in execution as it goes wrong. The Code is the follwing. 1. Java Code [CODE]import java.io.IOException; public class TMSimulation{ public static void main(String args[]) throws IOException{ InputReader reader=new InputReader(); reader.tmFileNamereader(); reader.tmFileReader(); //fileReader.display(anArray) } }[/CODE] [CODE]import java.io.*; public class InputReader{ …

Member Avatar for BestJewSinceJC
0
141
Member Avatar for aym312

hello! I have run into a brick wall trying to write a traffic light program. The program must display a traffic light (so far I have tried painting it on a Graphics) and use radio buttons (red, yellow, green) to change the color of the light. So far, I've got …

Member Avatar for aym312
0
1K
Member Avatar for kesh1000

hi please can anyone help me with this code. the prob lies in the add function for some reason it only executes 2 lines of the code and as soon as i enter the data the program finishes [CODE] import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.io.*; class customers{ private …

Member Avatar for kesh1000
0
130
Member Avatar for harika.jo
Member Avatar for chloeclover

Hey all, i'm looking for some help/advise on how to tackel a piece of code i'm stumped on. My project is in netbeans, GUI swing, JForm. Ive made up all my gui appearance, i have a jtext box that shows the calculations of 3 other jtext boxes from a user's …

Member Avatar for peter_budo
0
260
Member Avatar for BEBELINDO

Hi i need an event handler method to let an user use the 4 arrow keys (up,down,left,right) from a keyboard input ... and also the letters "Y" for yes and "N" for no on the keyboard. [code]import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; //group Albers, Rodriguez, Gonzalez, Leys, Larson, and Aponte …

Member Avatar for stultuske
0
123
Member Avatar for OzY360

Hi, I am getting a rather odd error message when I try compile a java program. I have attached the original java code and a copy of the error message in a .txt file. Any help you guys can offer will be much appreciated.

Member Avatar for OzY360
0
132
Member Avatar for rogue005

I am using a PriorityBlockingQueue in my server program for a network printer manager, but the thing is whenever I print the size of the queue its always 1. I think it is cause i am using threads in my program to support multiple clients. How do i solve this …

Member Avatar for rogue005
0
141
Member Avatar for rowdyboudy

Hi guys, I have written the following code which iterates over a integer array and returns a string by concatening the digits. Is there is an easier or more efficient way of writing this in Java similar to the C# function ToString? [CODE] private int[] myArray; public int[] getMyArray { …

Member Avatar for peter_budo
0
136
Member Avatar for mattyd

I have one, reoccurring issue that arises each time I run this incomplete program I am working on; I have spent much time attempting to locate the bug. I am convinced it arises from a simple error. Problem: User has made a "deposit" but when the User makes a "withdrawal", …

Member Avatar for peter_budo
0
94
Member Avatar for ozrayleigh

Hi, I've been giving this little problem of mine a lot of thought and I cant seem to figure out a way to solve it. I'm creating an information system (for a college assignment). The system I've created uses java, and it is able to generate reports (which I use …

Member Avatar for peter_budo
0
127
Member Avatar for aditya_22cent

[B]amru.java :--[/B] [code=java]package test; public class amru { public static void fa() { System.out.println("ADitya"); //return; } }[/code] -------------------------------- [B]INDEX .jsp[/B] [code=jsp]<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@page import="test.amru"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h1>Hello World!</h1> <% amru adi = new …

Member Avatar for peter_budo
0
84
Member Avatar for systemsbiology

Hello Everyone, I am an intermediate developer in programming languages. I have developed some python script and some java applications. In my project, I need to integrate the python script with a java application to put all the tools in a single pipeline to function as a continuous workflow. This …

Member Avatar for ~s.o.s~
0
975
Member Avatar for jtodd

Hey guys! I am new to java and have a newbie question. In a linked list, if I wanted to set the int first = to the first node in the linked list how would I do that. Thank you all in advance for your help!!

Member Avatar for tiny7415
0
83
Member Avatar for SCoder1

what's wrong with my java code? NullPointerException was found by my compiler.... [code] import java.awt.event.*; import java.awt.*; import javax.swing.*; import javax.swing.event.*; class WheelCalc extends JFrame implements ActionListener { public static final int WIDTH = 400; public static final int HEIGHT = 400; public JLabel NewTire; public JLabel OldTire; public JTextField …

Member Avatar for stultuske
0
148
Member Avatar for rpineres

I'm currently working on a small text game project as an exercise in Java. Just recently, I've come to a point where I am having difficulty with the logic behind the flow of the program. It had started out as a console application with a very sequential series of events …

Member Avatar for stultuske
0
120
Member Avatar for David22

Hi guys. I'm having a bit of a 'mare trying to return some ResultSet results. Basically, my method gets the results from a database and builds a String of the information and returns it. However, I can only get the method to return the LAST constructed String, as the "result" …

Member Avatar for vchandra
0
114
Member Avatar for annazpereira

Hi Guys, I know loads of ppl hv seen similar problems but I just can't figure out whats wrong with my code. I keep getting the following error: Upgrade.java:133: unreported exception java.lang.Exception; must be caught or declared to be thrown new SpFwUpgrade(sp, UrlPath); SpFwUpgrade is called in Upgrade.java as follows: …

Member Avatar for annazpereira
0
213
Member Avatar for rowdyboudy

I need to write a method that returns true if all the values in two int arrays are in the range 0-10, otherwise the method returns false. The code I have written is below but is there a better/more effient way to do this? [CODE] private int[] myArray1; private int[] …

Member Avatar for Zetlin
0
83
Member Avatar for johndoe444

from here: [url]http://weblogs.java.net/blog/emcmanus/archive/2007/04/cloning_java_ob.html[/url] [CODE]package serialclone; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InvalidClassException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.ObjectStreamClass; import java.io.OutputStream; import java.util.LinkedList; import java.util.Queue; public class SerialClone { public static <T> T clone(T x) { try { return cloneX(x); } catch (IOException e) { throw new IllegalArgumentException(e); …

0
67
Member Avatar for Zetlin

Ok so I'm learning from the book Head First Java, second edition, and I'm having a little trouble with some code. The code I'm working with compiles just fine and gives the output that I want(sort of) but whenever I run the code is doesn't stop, as if it was …

Member Avatar for Zetlin
0
213
Member Avatar for simplyflawless

hey I'm trying to write a method that converts milliseconds to hours, minutes, and seconds using the following header: public static String convertMillis(long millis) My method needs to return a string as hours:minutes:seconds. For example, convertMillis(5500) returns a string 0:0:5. this is what i have so far, can someone please …

Member Avatar for Zetlin
0
5K
Member Avatar for BEBELINDO

[code]import java.applet.*; import javax.swing.*; import java.io.*; import java.net.*; public class Audioapp extends JApplet { public class Sound // Holds one audio file { private AudioClip song; // Sound player private URL songPath; // Sound path Sound(String filename) { try { songPath = new URL(getCodeBase(),filename); // Get the Sound URL song …

0
51
Member Avatar for emteez

I am Linux server with cPanel. My problem is that i keep getting PermGenSpace error; even though i have set the -Xms and -Xmx attributes in starttomcat under /usr/sbin. I have searched thru the net, but I am not been able to find any solution to my problem. Any suggestions?

Member Avatar for ~s.o.s~
0
64

The End.