| | |
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 |
account android applet application apps array automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer homework html ide image inheritance integer integration intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield jtree julia linux loop method midlethttpconnection migrate mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source oracle plazmic print problem program property ria scanner server set sharepoint smart sms smsspam sourcelabs splash sql sqlite subclass support swing testautomation textfield threads tree trolltech unlimited utility windows






