I'm having problems with my for loop. Please assist me quickly. THANKS! Code: //java study import javax.swing.*; public class HELP { public HELP() { for(int i=1; i<=20;i++) { JOptionPane.showMessageDialog(null,i); } } public static void main (String args[]) { new HELP(); } }
no! I'm studying now. the issue is actually with XCode itself error with ?developer/Private/Jam can anyone upload the file?
Bump, please help me quickly... I know that this board is very not active right now but any help is good. All I need is that one Xcode file. All you have to do is attach it to your post.
Post as much detail as you can of the error. The chances are that the file is fine and you are doing something wrong.
Nope, I checked the file. it opens terminal and says "Missing file or directory: all" Just up the file and I'll bet it will work!
Sorry. I was wrong. so is there another fix? here's the exact error: Command /Developer/Private/Jam failed with exit code 1
I don't know. We need more details. I've never done Java in Xcode, so I may not be of any help, anyway, but to have a chance of helping we need to know what you've done so far in Xcode. How did you create the project and what kind of project is it? Are there other files in the project. Have you done any changes to the project settings, if so, what? When does the error come up, and do you have any more info about the error?
It's pretty longwinded but here we go: >Make a JOptionPane.showMessageDialog(null, variable ); >the variable must be a number/character >ERROR APPEARS! >JOptionPane works great with Strings though It's a basic ant based java and my original post is the entire code.
OK. How did you get this Java into XCode? I mean step by step like: Open XCode Start New Project via menu item Choose <Project Type> Jam is part of the build system in XCode and something about your project is making it upset. As you seem to be compiling a simple single file could you not just use javac in Terminal?
open xcode Start New Project via menu item new java tool selsct desktop as save location paste skeleton code insert for loop typing but ignoring code completion ERROR when compiling. //javac works but it's a hassle I want Xcode to work with it's error correction and all.
OK. What did you name the tool? Basically does the classname match the filename (it won't work otherwise). You could just compile it on the command line with javac: Open Terminal cd Desktop javac <filename>
Works fine here. Are you sure you don't get another error, too? I got a failed build at first because I forgot to use the same name for the constructor and the class, and that gave me two errors, the first was the one you're describing and the second was the error for the wrong constructor name.
the tool name? the whole file is called "HELP" I know how to compile in terminal. it works! but XCode doesn't. //what XCode version do you have? and what steps did you go through?
OK, can you post a screenshot of the same content that I have in my attached screenshot. Make sure the project is selected in the left pane. Then, also double click on the Manifest file and say what it says. Mine says: Main-Class: JavaTest Edit: Xcode version 2.2.1 1) New Project -> Java Tool -> Project name: JavaTest 2) Cut and paste from your code into JavaTest.java 3) Edited the pasted code so that it says JavaTest instead of HELP 4) Build, got error because I forgot to rename the constructor 5) Rename constructor 6) Build, success 7) Run, success, screen capture, post macrumors post
it says: Main-Class: HELP //I got 2.4 intel build. Maybe that's the problem?? The PPC mac @ home has no issues...
OK, that looks good. How about a screen shot of the error window after a "Build". This is how mine looks if I introduce an error in the code.
I think XCode must be broken! This sucks! iMac G5 is running 2.1 no hitch! iMac C2D 2.4 PROBLEMS, this really sucks. <Refering to the currents situation.
OK so it's clear that there is a problem with the line it's highlighted. There is a symbol on that line that the compiler does not recognise. Most likely it cannot find JOptionPane. Have you double checked the capitalisation, spelling etc of the class and method. XCode is not broken.
Code: //java study import javax.swing.*; public class test { public test() { int i=1; JOptionPane.showMessageDialog(null,i); } public static void main (String args[]) { new test(); } } no one can go wrong with that /\/\/\ basically xcode is busted. the update (2.4.1) is like a gig. and my crappy south african cap is only one gig. so this must be one of "those bugs" that was fixed in the update.
The chances of that are vanishingly small. It's much more likely that you are using the wrong SDK, have not included the correct path to Swing or something similar.
So instead of blaming the tools I tried compiling it on the command line (OK on Solaris as I'm at work) and got this error: test.java:12: cannot resolve symbol symbol : method showMessageDialog (<nulltype>,int) location: class javax.swing.JOptionPane JOptionPane.showMessageDialog(null,i); ^ 1 error Which seems to be the same as the screenshot you posted: cannot resolve symbol. The answer is very simple: there is no showMessageDialog method that takes Object, int. It takes an Object as it's second paramater. An int is a primitive type in Java. It's not an Object. This is a basic, fundamental problem with your understanding, and not any issue with XCode as I've said all along.