Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Textpad Error

Options
  • 29-10-2013 11:00pm
    #1
    Registered Users Posts: 8,387 ✭✭✭


    I've just installed both the latest Java and Textpad v7.09 on my Win 7 PC.

    My understanding is that I need to manually add the External Tools to the Tools drop down in Textpad for "Compile" and "Run" so I did this by following this Youtube guide



    I then tried to compile and run this test program but am getting the following error

    'javac' is not recognized as an internal or external command,
    operable program or batch file.

    Tool completed with exit code 1


    // HelloWorld - Test Program
    //  Java Hello World Program
    
    public class HelloWorld
    {
    	public static void main(String[] args )
    	{
    		// Output Hello World message to user
    
    		System.out.println();
    		System.out.println("Cian says Hello Java World!");
    		System.out.println();
    
    	} // main
    
    } // HelloWorld
    

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



Comments

  • Registered Users Posts: 1,731 ✭✭✭GreenWolfe


    Did you set up the PATH to the Java compiler correctly?

    Open up a command prompt and try running "javac" and "java -version", without the quotes.


  • Registered Users Posts: 8,387 ✭✭✭Gadgetman496


    GreenWolfe wrote: »
    Did you set up the PATH to the Java compiler correctly?

    Open up a command prompt and try running "javac" and "java -version", without the quotes.

    I think I set the path correctly but I'm not 100% sure either.

    I got the path location by navigating to the java bin folder through explorer

    The path on my system is

    C:\Program Files (x86)\java\jre7\bin

    I entered the path via "Advanced" TAB clicked on "Environment Variables" button in System Properties scrolled down to path and added it to the end of the existing string separated by a simi colon.

    When I ran both commands you suggested from the command prompt I got the following

    javac returned
    'javac' is not recognized as an internal or external command, operable program or batch file.
    

    java -version returned
    java version "1.7.0_45"
    java ,TM. SE Runtime Environment ,build 1.7.0_45-b18>
    java HotSpot<TM> Client VM <build 24.45-b08, mixed mode, sharing>
    

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



  • Registered Users Posts: 1,731 ✭✭✭GreenWolfe


    You have the right idea, but you appear to only have the Java runtime installed - it is not able to compile programs.

    Download the JDK (Java Development Kit) and put the location of javac in your PATH, using the process you followed before.


  • Registered Users Posts: 8,387 ✭✭✭Gadgetman496


    Oh I see, thanks.

    Two quick questions before I try that, it might save me annoying you further?

    Do I enter that Java Development Kit path along with the runtime one, or do I remove the original path I had entered?

    When I go to compile and it gives me the option box to "save as type", do I choose "JavaScript (*.js) or what do I save as? It currently defaults to txt

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



  • Registered Users Posts: 1,731 ✭✭✭GreenWolfe


    Oh I see, thanks.

    Two quick questions before I try that, it might save me annoying you further?

    Do I enter that Java Development Kit path along with the runtime one, or do I remove the original path I had entered?

    When I go to compile and it gives me the option box to "save as type", do I choose "JavaScript (*.js) or what do I save as? It currently defaults to txt

    You can remove the original path.

    Save your Java files (classes, interfaces etc) with the .java file extension. For example, the HelloWorld file you posted earlier would be saved as HelloWorld.java


  • Advertisement
  • Registered Users Posts: 8,387 ✭✭✭Gadgetman496


    Really appreciate your help here GreenWolfe & I had success at last.

    It complies and runs fine now in TextPad.

    Thank you once again ;)

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



Advertisement