| | |
I need a good java compiler
![]() |
•
•
Join Date: Sep 2004
Posts: 42
Reputation:
Solved Threads: 0
Hi all, does anyone know of a good compiler I can download for java? It would be nice if it was an IDE but it does not have to be. I currently have the j2sdk-1_4 compiler http://java.sun.com/j2se/1.4.1/download.html and it does not seem to work that well. Also I know that this is really easy, but hey I can't compile anything I make, what is wrong with this code?
Java Syntax (Toggle Plain Text)
public class BuckleShoe { public static void main(String args) { EasyReader console = new EasyReader(); private int choice; do { System.out.print("Enter a number 1-10 (or 0 to quit):"); int choice = console.readInt (); switch (choice) { case 0: System.out.println("Bye"); break; case 1: case 2: System.out.println("Buckle your shoe"); break; case 3: case 4: System.out.println("Shut the door"); break; case 5: case 6: System.out.println("Pick up sticks"); break; case 7: case 8: System.out.println("lay them straight"); break; case 9: case 10: System.out.println("A big fat hen"); break; default: System.out.println("invalid entry"); break; } } while (choice != 0); } }
•
•
Join Date: Jun 2004
Posts: 2,108
Reputation:
Solved Threads: 18
My guess is that your school uses some new packaged classes because they are too lazy to create a one line statement that reads input. EasyReader is not a java class, that is, if you haven't downloaded that add on..
use this:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int x = br.readLine();
use this:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int x = br.readLine();
•
•
Join Date: Sep 2004
Posts: 42
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by server_crash
My guess is that your school uses some new packaged classes because they are too lazy to create a one line statement that reads input.
Java Syntax (Toggle Plain Text)
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } }
I get an error message that says:
Empty.java [1:1] class HelloWorld is public, should be declared in a file named HelloWorld.java
public class HelloWorld
^
1 error
Errors compiling Empty.
I don't understand, am I supposed to save in some sort of special file/format before compiling?
•
•
Join Date: Sep 2004
Posts: 42
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by server_crash
The filename should have the same name as the class:
public class X
so the filename should be:
X.java
Is your filename HelloWorld.java ?
Java Syntax (Toggle Plain Text)
java.lang.NoClassDefFoundError: Mystuff/Empty Exception in thread "main"
•
•
Join Date: Jun 2004
Posts: 2,108
Reputation:
Solved Threads: 18
Sorry, I've never really worked with netbeans, so I don't know anything about setting the classpath on that...Maybe it's the same principle though:
try this:
GOTO: Start -->(right click on)My computer--> properties -->advanced
--environment variables
you should have one that says classpath and path:
set the path variable to the path that points to the bin folder located in your jdk folder
set the classpath variable to the path that points to the tools.jar file located in your jdk folder
Again, not sure if this will work. I don't use netbeans.
try this:
GOTO: Start -->(right click on)My computer--> properties -->advanced
--environment variables
you should have one that says classpath and path:
set the path variable to the path that points to the bin folder located in your jdk folder
set the classpath variable to the path that points to the tools.jar file located in your jdk folder
Again, not sure if this will work. I don't use netbeans.
![]() |
Similar Threads
- Java compiler (Java)
- Looking for good java ide (Java)
- Java Compiler (Java)
Other Threads in the Java Forum
- Previous Thread: problems with bufferedImage
- Next Thread: How to draw a line
| Thread Tools | Search this Thread |
-xlint actionlistener android api applet application array arrays automation bi binary blackberry block bluetooth character class client code compile compiler component consumer database desktop developmenthelp eclipse error fractal freeze ftp functiontesting game gameprogramming givemetehcodez graphics gui health html ide image integer j2me j2seprojects java javac javaee javaprojects jetbrains jni jpanel jtable julia learningresources lego linked linux list mac main map method methods mobile myregfun netbeans notdisplaying number online printf problem program project qt recursion researchinmotion rotatetext rsa scanner screen server set singleton sms sort spamblocker sql string swing system textfields threads time title tree tutorial-sample update variablebinding windows working xor






