944,147 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 6752
  • Java RSS
You are currently viewing page 1 of this multi-page discussion thread
Feb 15th, 2005
0

I need a good java compiler

Expand Post »
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)
  1. public class BuckleShoe
  2. {
  3. public static void main(String args)
  4. {
  5. EasyReader console = new EasyReader();
  6. private int choice;
  7.  
  8. do
  9. {
  10. System.out.print("Enter a number 1-10 (or 0 to quit):");
  11. int choice = console.readInt ();
  12.  
  13. switch (choice)
  14. {
  15. case 0:
  16. System.out.println("Bye");
  17. break;
  18.  
  19. case 1:
  20. case 2:
  21. System.out.println("Buckle your shoe");
  22. break;
  23.  
  24. case 3:
  25. case 4:
  26. System.out.println("Shut the door");
  27. break;
  28.  
  29. case 5:
  30. case 6:
  31. System.out.println("Pick up sticks");
  32. break;
  33.  
  34. case 7:
  35. case 8:
  36. System.out.println("lay them straight");
  37. break;
  38.  
  39. case 9:
  40. case 10:
  41. System.out.println("A big fat hen");
  42. break;
  43.  
  44. default:
  45. System.out.println("invalid entry");
  46. break;
  47. }
  48. } while (choice != 0);
  49. }
  50. }
Similar Threads
Reputation Points: 12
Solved Threads: 0
Light Poster
the b is offline Offline
42 posts
since Sep 2004
Feb 15th, 2005
0

Re: I need a good java compiler

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();
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Feb 16th, 2005
0

Re: I need a good java compiler

Quote 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.
Your guess is right, ( I probably should have said that) but I can not even compile extremely simple programs such as:
Java Syntax (Toggle Plain Text)
  1. public class HelloWorld
  2. {
  3. public static void main(String[] args)
  4. {
  5. System.out.println("Hello, World");
  6. }
  7. }

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?
Reputation Points: 12
Solved Threads: 0
Light Poster
the b is offline Offline
42 posts
since Sep 2004
Feb 16th, 2005
0

Re: I need a good java compiler

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 ?
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Feb 16th, 2005
0

Re: I need a good java compiler

Quote 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 ?
The file name is the same ( HelloWorld.java ), but here is another error message I get when i try to create the program,
Java Syntax (Toggle Plain Text)
  1. java.lang.NoClassDefFoundError: Mystuff/Empty
  2. Exception in thread "main"
Reputation Points: 12
Solved Threads: 0
Light Poster
the b is offline Offline
42 posts
since Sep 2004
Feb 16th, 2005
0

Re: I need a good java compiler

Ohh I see what it is now, it's your classpath..Have you set it yet?


If you haven't set it to point directly to the tools.jar file

If you have, post it, and I will take a look at it.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Feb 17th, 2005
0

Re: I need a good java compiler

Actually I haven't :o how would I start to do this? I have Netbeans IDE version 3.6 as my compiler, and I am running it on windoze xp home.
Reputation Points: 12
Solved Threads: 0
Light Poster
the b is offline Offline
42 posts
since Sep 2004
Feb 17th, 2005
0

Re: I need a good java compiler

The Sun compiler is the ONLY official one for the language.
There are others that are certified to be correct but the Sun package (which you claim doesn't work...) is the standard.

Anything that doesn't compile with that should not compile with anything.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Feb 17th, 2005
0

Re: I need a good java compiler

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.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Feb 18th, 2005
0

Re: I need a good java compiler

If you don't even know how to use your classpath you shouldn't be using an IDE at all.
For an IDE, you normally set the included libraries for a project in the project options.
RTFM about how to do that.
As to Netbeans, scrap that piece of junk.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: problems with bufferedImage
Next Thread in Java Forum Timeline: Creating a GUI that accepts user input help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC