2,777 Posted Topics

Member Avatar for dck133

[QUOTE]warning: [unchecked] unchecked conversion[/QUOTE] [CODE]private static ArrayList<CheaperStoreItem> itemArray = new ArrayList(); vs private static ArrayList<CheaperStoreItem> itemArray = new ArrayList<CheaperStoreItem>(); [/CODE] [QUOTE]int tempInt = itemArray[i].getQuantity();[/QUOTE] What is the definition of itemArray? Is it an array? Or is it an ArrayList<CheaperStoreItem> object? The variable ending with the [] makes the compiler look …

Member Avatar for JamesCherrill
0
126
Member Avatar for jemz

I suggest you design how your program should work before you start writing code. Have you done that yet? Can you explain how the program will solve the problem, step by step? The if statement in your code doesn't make sense. What is it supposed to do?

Member Avatar for jemz
0
1K
Member Avatar for SeanC

What if menu2 is "4"? The first test will won't be false but the second one will true because 4 != 3 Try AND. You want to stay in the loop if menu2 != 3 AND its != 4

Member Avatar for SeanC
0
92
Member Avatar for Xufyan

To see how to generate the output you want, replace the text in the output with the indexes for that text. For example the indexes for output first shown is: 1,0 2,0 3,0 ... You could generate the above output by printing the indexes vs the contents of the array …

Member Avatar for Xufyan
0
141
Member Avatar for ben1

[QUOTE]when I click on the run button.[/QUOTE] Where is the run button? Are you having a problem with your IDE? If so you should ask the question on a site for that IDE. Try executing your program from a command prompt.Open a command prompt window, change to the folder with …

Member Avatar for ben1
0
130
Member Avatar for gauravk_bhanot

Does the Panel with the listener have the focus? Is it capable of getting the focus? There is a method to call for this.

Member Avatar for adams161
0
81
Member Avatar for kdgeiger

Is there an error message in the browser's Java console? Please copy and paste it here. How are you executing the applet? Locally from a disk file or from a server?

Member Avatar for kdgeiger
0
168
Member Avatar for har58

You have an array of 20 items to chose from and want to chose 5 unique ones at random: Have a parallel array of 20 boolean that you set true if that question has been chosen yet. And another array of 5 that you'll save the indexes to the array …

Member Avatar for tong1
0
175
Member Avatar for java_programmer

Did you read the API doc? It says:[QUOTE]Returns the unique Console object associated with the current Java virtual machine, if any.[/QUOTE] I assume the "if any" means there might not be a console. Why do you think there is a console for the JVM? There wouldn't be if the code …

Member Avatar for NormR1
0
970
Member Avatar for ttunstall07

[QUOTE]how to get the windows to turn black when clicked, and then white when clicked again.[/QUOTE] Sounds like you need a flag to tell the paint() method what color to paint the windows. One setting for black and one for white. Change the setting when you get a click and …

Member Avatar for NormR1
0
113
Member Avatar for AlexN

Do you know what the javac compiler does? It compiles .java files creating .class files. The .class files are what you execute. The .java files are source files. Change your code= to have the filename of the .class file: code=calculator Also the Applet will not be able to read from …

Member Avatar for tong1
0
240
Member Avatar for cjmartin

Can you rewrite your code not to use these packages? They are not part of the JDK. [CODE] import org.dyno.visual.swing.layouts.Bilateral; import org.dyno.visual.swing.layouts.Constraints; import org.dyno.visual.swing.layouts.GroupLayout; import org.dyno.visual.swing.layouts.Leading; import org.dyno.visual.swing.layouts.Trailing; [/CODE] [code]TestMsgDialog.java:24: package org.dyno.visual.swing.layouts does not exist import org.dyno.visual.swing.layouts.Bilateral; ^ TestMsgDialog.java:25: package org.dyno.visual.swing.layouts does not exist import org.dyno.visual.swing.layouts.Constraints; ^[/code]

Member Avatar for cjmartin
0
156
Member Avatar for omg0000

Your title is a little misleading. Not really about executing a jar file. It sounds like you are looking for an installer that will unpackage a file into subparts in specific locations and then execute one of the extracted files.

Member Avatar for stultuske
0
83
Member Avatar for maldemer

Lots of logic to follow. Have you tried debugging by adding more println()s to show code flow and variable states?

Member Avatar for NormR1
0
161
Member Avatar for pi_lord12

What object reference is null causing the NPE? On that line there are three object references. Which one is null?

Member Avatar for pi_lord12
0
145
Member Avatar for cjmartin

The code doesn't compile because of packages and missing method. Did you try the consume() method that we talked about in the other thread on this problem?

Member Avatar for cjmartin
0
110
Member Avatar for pptech

Add a Container object to the code and use that to set the color: [CODE] Container contr; public SetColorWithButton() { contr = getContentPane(); ... contr.setBackground(Color.yellow); ... repaint(); // after setting the color at end of listener [/CODE]

Member Avatar for tong1
0
7K
Member Avatar for gauravk_bhanot

[QUOTE]the first ball does not get to to edge of Frame[/QUOTE] What variables control where the first ball is shown? Have you tried debugging the code by adding println()s to show how the variables are changing and how the execution flow is going?

Member Avatar for tong1
0
312
Member Avatar for tong1

[QUOTE]how do we know the “length” of an enum.[/QUOTE] The values() method returns an array of the contents. Use the .length property on that.

Member Avatar for ~s.o.s~
0
2K
Member Avatar for chandini123
Member Avatar for javaAddict
0
121
Member Avatar for SeanC

The Scanner class buffers the input. If the call to next... sees the wrong data it will fail with an Exception, but the wrong data is still there. You need to nextLine call to clear the bad data. Why do you create a new instance of the Scanner class in …

Member Avatar for SeanC
0
88
Member Avatar for asad_80

[QUOTE]he problem comes when i have been able to match any pair and after that as i try to click any other button to make the next pair then the first pair of cards closes back[/QUOTE] Before I try debugging your code, have you tried debugging your code by adding …

Member Avatar for NormR1
0
89
Member Avatar for comSysStudent

How would the compiler handle that? It needs to decide how to connect the caller to the callee at compile time. You could simulate that functionality by passing an array of Objects to one method and have that method sort out what to do based on the contents of the …

Member Avatar for comSysStudent
0
140
Member Avatar for Xufyan

[CODE]public class EnumProblem { enum Days {Monday, Tuesday, Wednesday, Thursday, Friday} enum Periods {Period1, Period2, Period3, Period4, Period5} // Define 2 dim array using the above enums Object[][] twoDim = new Object[][] {{Days.Monday, Periods.Period1}, {Days.Tuesday, Periods.Period2}}; }[/CODE]

Member Avatar for tong1
0
6K
Member Avatar for Xufyan

[QUOTE]it is not printing values in a table[/QUOTE] What is it printing? Please show the program's output.

Member Avatar for java_programmer
0
420
Member Avatar for Xufyan

[QUOTE]the program is not working.[/QUOTE] Can you explain what the problems are? Show the code that does "not work" and explain what you want it to do.

Member Avatar for tong1
0
122
Member Avatar for kiranpvsr

There are several fields in the Request header that the server can look at to decide if it wants to serve you. Try changing one/some of those to convince the server to serve you.

Member Avatar for NormR1
0
99
Member Avatar for Shreya J

What does "linking" or "connecting" windows mean? Do you want each class that has opened a window to have a reference to the other classes that have opened a window?

Member Avatar for NormR1
0
68
Member Avatar for nocookies92

Check your spellings. The posted jar command shows a g in the class name? Java is case sensitive.

Member Avatar for nocookies92
0
2K
Member Avatar for intes77

To create action listener object. Define a class that implements ActionListener, create a new instance of the class and add it as a listener to the button. Do a Search for ActionListener or addActionListener( on this forum for code samples.

Member Avatar for JamesCherrill
0
220
Member Avatar for gaurav17may

Do you have a problem with your code? Please post it with the sections of code that shows it.

Member Avatar for NormR1
0
34
Member Avatar for arunmani4u

[QUOTE]i need help to fetch software information from system[/QUOTE] What is software information? The presence of an .exe file? Or a jar file? Or a .com file or any of the possible executable files that can be on a disk somewhere.

Member Avatar for NormR1
0
195
Member Avatar for therstonsplace

[QUOTE]get the Scanner object wont resolve[/QUOTE] Do you get error messages when you compile the code? Please copy and post your error messages here. Also show the code that gives the errors.

Member Avatar for therstonsplace
0
132
Member Avatar for priyanka.js28
Member Avatar for JamesCherrill
0
148
Member Avatar for lloydsbackyard

[QUOTE]more than one character ... that must be invalid input[/QUOTE] You could test the length of the String to be 1 by using one of the String methods.

Member Avatar for jon.kiparsky
0
2K
Member Avatar for comSysStudent
Member Avatar for sadhawan

Is this a one time job or will there more input scripts that you want to parse later? If one time, do as suggested above. If more than once, write a program to wrap the scripts in a compileable program to do what was suggested and use the javac class …

Member Avatar for jon.kiparsky
0
179
Member Avatar for EricTetz

[QUOTE]Is this a valid assumption?[/QUOTE] I think it is. 1.4 version programs should run on 1.6

Member Avatar for jon.kiparsky
0
170
Member Avatar for Baadal

[QUOTE]I can't make it work[/QUOTE] Is this a java programming problem or a database question? If a java problem, please post the full text of the error message(s) or explain what the programming problem is.

Member Avatar for Baadal
0
1K
Member Avatar for eman 22

[QUOTE]sub-rectangle 9 2 -4 1 -1 8 maximum sum of its sub-rectangle is : 30[/QUOTE] Please explain how you get the sum of 30 from these 6 numbers. Normal math gives me 15.

Member Avatar for eman 22
-1
128
Member Avatar for nihan1

If you are getting compiler errors, please copy and paste the FULL text here. Don't edit them.

Member Avatar for NormR1
0
83
Member Avatar for jjiceman

If you used a modal Dialog for the 2nd GUI to collect the info, the app would wait until the info was input before proceding. Writing your own code to synch the first app to wait for the second GUI is a pain. To use a dialog vs a frame, …

Member Avatar for JamesCherrill
0
225
Member Avatar for daudiam

Maybe the server doesn't want you to download the file. What do you receive when you have the problem? Rename the file received to .txt and open it in an editor.

Member Avatar for NormR1
0
261
Member Avatar for Guest51

Since the code isn't posted, I can only ask questions. Where in your code do you read the .dat file? Does that code get called at program start up? How do you know that? Where is the data from the .dat file read in? Where is the data read in, …

Member Avatar for Guest51
0
4K
Member Avatar for Danny_501

I don't know where the OS keeps its value of the CLASSPATH environment variable. If you want to get the current value of the CLASSPATH variable, see System Properties: java.class.path and sun.boot.class.path

Member Avatar for Danny_501
0
101
Member Avatar for dylgod

Please copy full text of error message and paste it here. Here is a sample: [CODE] TestSorts.java:138: cannot find symbol symbol : variable var location: class TestSorts var = 2; ^ [/CODE]

Member Avatar for jon.kiparsky
0
116
Member Avatar for mukulnimker

Have you read the Java Tutorial about how to use JTables? You need to understand them before trying to use them.

Member Avatar for mukulnimker
0
151
Member Avatar for yan_izumi

Can you give an example of the input to your program and an example of what the program should output given that input? Then describe the steps that are necessary for a java program to make that conversion.

Member Avatar for NormR1
0
40
Member Avatar for skylarkinoz

[QUOTE]How do I read 1 bit from this file or read 7 bits come to that.[/QUOTE] There isn't a way to read individual bits from a file. You have to read a byte and then extract from it which bit(s) you want. Use the AND operator with the desired bit(s) …

Member Avatar for NormR1
0
70
Member Avatar for dresposure

What java classes have you looked for compressing data? I find this in the API doc: [QUOTE]This class implements a stream filter for writing compressed data in the GZIP file format.[/QUOTE]

Member Avatar for NormR1
0
63

The End.