Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
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