Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Regarding any Java Issues


  • Please log in to reply

#1
coyne20

coyne20

    Member

  • Member
  • PipPip
  • 35 posts
Alot of people end up posting problems regarding java. I thought it would be good to mention some pre-requisite
checks before posting:

1. Ensure that you are using JVM 1.5.0_xx or greater.
2. Please ensure that you have correctly assigned class path and a java home environment variable.
3. Any code written, compiled and executed should be done so within an IDE (Eclipse is recommended).

Following these rules will make it easier for the person trying to resolve your programming problem.

Many Thanks
  • 0

Advertisements


#2
Sockdown

Sockdown

    Member

  • Member
  • PipPipPip
  • 393 posts

3. Any code written, compiled and executed should be done so within an IDE (Eclipse is recommended).


Not quite. I can write the code in notepad, open cmd, go to the path where the .java is, use "javac path" to compile the program and then use "java path" to execute it. You do have to set the path of java sdk (Example: C:\Program Files\Java\...) before doing it unless you set it perminently. So, an IDE it's not necessary but makes the programmer's life easier since it controls indents, the errors are friendlier, etc...

But it does make it easier for a programmer to use an IDE like you said. NetBeans is another free alternative.
  • 0

#3
coyne20

coyne20

    Member

  • Topic Starter
  • Member
  • PipPip
  • 35 posts

3. Any code written, compiled and executed should be done so within an IDE (Eclipse is recommended).


Not quite. I can write the code in notepad, open cmd, go to the path where the .java is, use "javac path" to compile the program and then use "java path" to execute it. You do have to set the path of java sdk (Example: C:\Program Files\Java\...) before doing it unless you set it perminently. So, an IDE it's not necessary but makes the programmer's life easier since it controls indents, the errors are friendlier, etc...

But it does make it easier for a programmer to use an IDE like you said. NetBeans is another free alternative.


Using the cmd prompt and typing in both javac and java seems to be the long way around. Eclipse and Netbeans IDE takes care of all the adhoc duties. This leaves the programmer free to focus on getting the code right, bug free and running quickly.
  • 0

#4
Sockdown

Sockdown

    Member

  • Member
  • PipPipPip
  • 393 posts
Well, yeah. That's true. But, it not a bad idea to practice with it. I would only need to do 4 things lol. :)

(1)Open cmd prompt and move to the directory
(2)Set the path to sdk
(3)javac path
(4)java path

And done. :)
But the errors are hard to interpret and finding the line and correcting it it's harder. Especially when it's more than 1,000 lines of code.
But for very simple programs, else, IDE. Anyway, the industry uses IDE's. :)

Edited by Sockdown, 16 March 2009 - 08:23 AM.

  • 0

#5
coyne20

coyne20

    Member

  • Topic Starter
  • Member
  • PipPip
  • 35 posts

Well, yeah. That's true. But, it not a bad idea to practice with it. I would only need to do 4 things lol. :)

(1)Open cmd prompt and move to the directory
(2)Set the path to sdk
(3)javac path
(4)java path

And done. :)
But the errors are hard to interpret and finding the line and correcting it it's harder. Especially when it's more than 1,000 lines of code.
But for very simple programs, else, IDE. Anyway, the industry uses IDE's. :)


I thought it would be good to make their lives alot easier w/o having to resort to the notepad or dos prompts. Yet again it is good to learn how to do it manually on a simple individual class file but not for larger / numerous packages.
  • 0

#6
Sockdown

Sockdown

    Member

  • Member
  • PipPipPip
  • 393 posts
Yeah, you're right. it will make their lives easier. But it's an alternative heh. I had to do a WebCrawler for my DataStructures class and had 8 classes. Had to do it with notepad only. But yeah, those two Eclipse and NetBeans are awesome free IDE alternatives to all the mess it could be to do it manually. :)
  • 0

#7
coyne20

coyne20

    Member

  • Topic Starter
  • Member
  • PipPip
  • 35 posts
One final thing, any methods defined should ideally have some form of exception handling. There are 2 ways to do this:

eg 1. Declare it at the method signature as shown:

public void someMethod() throws Exception
{
// your implementation goes here.
}

eg 2. Insert try,catch, finally blocks within the body of your implementation:

public void someMethod2()
{
try{






}
catch(specific exception e)
{

}







}
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP