Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 24 of 24

Thread: Help with Textpad

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Help with Textpad

    Hello everyone, I'm new here and also a total java noob and I have no idea where I should of posted this, if this is posted in the wrong category then I apologize. But please don't just lock this, at least give me some direction if you can because I need to finish this program ASAP.

    I need to write a program for my college Programming assessment, however I usually use one of the college computers. But now I'm at home and I don't have access to them so I need to finish writing the program on my laptop. I have Notepad++, TExtpad7 and Netbeans on my laptop and I've downloaded JDK. But I can't get any of the IDEs to compile or run my programs. I think I need to add JDK to them, but I can't find out how. If you can help me with any of them, my preference is Textpad as I'm most experienced with that. If anyone can help me please do because I need to finish this program ASAP. All help is greatly appreciated.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Help with Textpad

    What OS are you using?

    If you open a console (a system prompt) and type

    javac -version

    what happens?

  3. The Following User Says Thank You to GregBrannon For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  4. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    Sorry should of stated this, I'm using Win8 64-bit.

    When I typed that into the cmd it said "'javac' is not recognized as an internal or external command, operable program or batch file".
    But I definitely have JDK downloaded.

    --- Update ---

    I decided to reinstall Textpad and now it seems I can actually compile stuff but whenever I ever try compile my program "Library.java", it says "Error: Could not find or load main class F:\Programming\Java\Project\Library.java

    Tool completed with exit code 1"

    The files are stored on a Removable Disk, which has worked perfectly in the past.

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    Is the bin folder with javac.exe on the Path variable?

    A quick way for short term usage is to make a batch file that will compile a java file:
    <PATH TO THE javac.exe file> <The java file>.java
    MORE

    Then just double clicking on the batch file will invoke the javac program and give it your program to compile.

    A sample output from when the batch file is executed:
     
    D:\JavaDevelopment\Testing\ForumQuestions9>D:\Java\jdk1.7.0.7\bin\javac.exe -cp . -Xlint  TestCode16.java
    TestCode16.java:207: error: cannot find symbol
          x = 0;
          ^
      symbol:   variable x
      location: class TestCode16
    1 error
     
    D:\JavaDevelopment\Testing\ForumQuestions9>MORE

    The CompileTestCode16.bat file:
    D:\Java\jdk1.7.0.7\bin\javac.exe -cp . -Xlint TestCode16.java
    MORE

    --- Update ---

    whenever I ever try compile my program
    What command are you using to compile the program? That error message looks like a runtime error from the java program.
    If you don't understand my answer, don't ignore it, ask a question.

  6. The Following User Says Thank You to Norm For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  7. #5
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    "Is the bin folder with javac.exe on the Path variable? "

    Sorry I'm a big noob, I don't understand what you mean. I'm used to Textpad being already set and I just press CTRL+1 to compile and CTRL+2 for running. I don't really have any idea on how to set it up. If you can give me simplified step-by-step instructions, I'd really appreciate it.

  8. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    Are you able to compile now? If not, make a simple batch file to do compiles(see post#4)

    There are lots of tutorials on how to set the Path environment variable.

    I don't know anything about TextPad.
    If you don't understand my answer, don't ignore it, ask a question.

  9. The Following User Says Thank You to Norm For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  10. #7
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    No not with TextPad specifically, I'm just asking how you do what you saying in post #4.

  11. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    Create a batch file with 2 lines similar to what is shown in post#4. Replace the path to the javac.exe file with the path on your PC and replace the name of the .java file with the name of your java file.
    Double click on that batch file and the javac command will be executed with your program as input.
    If you don't understand my answer, don't ignore it, ask a question.

  12. The Following User Says Thank You to Norm For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  13. #9
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    I honestly don't trust myself in making a batch file as I read that if you do it wrong it can mess up your system. I don't know what part of your example I should modify to fit with my situation. Is there anyway I can write and run java programs on my laptop without having to do this?

  14. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    A batch file is a way to save a commandline in a file and execute it by double clicking on it. The javac command will not harm your system. A batch file is a simple and quick way to execute a command.

    Changing the Path environment variable's value can hurt your system. Many programs depend on the correct setting of the Path variable to find files they need.
    If you don't understand my answer, don't ignore it, ask a question.

  15. The Following User Says Thank You to Norm For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  16. #11
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    "D:\JavaDevelopment\Testing\ForumQuestions9>D:\Jav a\jdk1.7.0.7\bin\javac.exe"

    Can you tell me what each file location represents so I can know what part of what to change to my files? Why is it a D drive? A local drive is C isn't it?

    My java program file is on a removable disk, so it should look something like this right?
    (F: )Removable Disk/Programming/Java/Project/Library.java

    and jdk should be in my local disk so it should look like this, right?

    (C: )Local Disk/Program Files/Java/java.exe

    With this information would you be able to modify what I should actually type in?

  17. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    Is that from when the batch file was executed? Here is the batch file named: CompileTestCode16.bat
    D:\Java\jdk1.7.0.7\bin\javac.exe -cp . -Xlint TestCode16.java
    MORE
    In Meta format. Replace items inside <> with your values:
    <PATH TO THE javac.exe file> <The java file>.java

    The batch file shown here is in the same folder as the .java file.
    If you don't understand my answer, don't ignore it, ask a question.

  18. The Following User Says Thank You to Norm For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  19. #13
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    I don't know what you mean, I haven't executed any batch file yet because I'm still not sure what to do.

    If the batch file is called TestCode16.bat then why does it say .java instead? Also that looks like the folder where the jdk is located, not where my program is.

  20. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    The batch file contains a command line and the MORE command.

    Can you execute the javac command in a command prompt window? Use that exact same command line as the first line of the batch file. Put MORE on the second line of the batch file.
    If you don't understand my answer, don't ignore it, ask a question.

  21. The Following User Says Thank You to Norm For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  22. #15
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    I haven't tried it since the first time but since I haven't changed anything since then but I imagine I will still get the "'javac' is not recognized as an internal or external command, operable program or batch file". message.

    So can I just copy exactly what your batch file says and it will work?

  23. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    1) find the path to your javac.exe file
    2) replace the path to my javac.exe file with the path to your javac.exe file
    3)replace the name of my java file with the name of your java file.
    4) save the batch file in the same folder with your java file
    5) double click the batch file to execute it.
    If you don't understand my answer, don't ignore it, ask a question.

  24. The Following User Says Thank You to Norm For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  25. #17
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    Ok so is this right before I actually do it?

    C:\Program Files\Java\jdk1.7.0_45\bin/javac.exe -cp . -Xlint Library.java
    MORE

    and I save that, call it Library.bat and save it in the same folder as Library.java?

    What do I do about this bit?

    TestCode16.java:207: error: cannot find symbol
    x = 0;
    ^
    symbol: variable x
    location: class TestCode16
    1 error

    D:\JavaDevelopment\Testing\ForumQuestions9>MORE

  26. #18
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    Ok so is this right
    It looks ok.
    What do I do about this bit?
    That was from the contents of the comandprompt window from when I executed the batch file.
    If you don't understand my answer, don't ignore it, ask a question.

  27. The Following User Says Thank You to Norm For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  28. #19
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    Ok I ran it and this is what I got:


    F:\Programming\Java\Project>C:\Program Files\Java\jdk1.7.0_45\bin/javac.exe -cp
    . -Xlint Library.java
    'C:\Program' is not recognized as an internal or external command,
    operable program or batch file.

    F:\Programming\Java\Project>MORE



    Any Ideas?

  29. #20
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    The space in the folder name requires that the full path be enclosed in quotes:
    "C:\Program Files\Java\jdk1.7.0_45\bin/javac.exe"

    MS has messed up more people with that folder named: Program Files
    If you don't understand my answer, don't ignore it, ask a question.

  30. The Following User Says Thank You to Norm For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  31. #21
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    Ok that worked. Here are the results:

    F:\Programing\Java\Project>"C:\Program Files\Java\jdk1.7.0_45\bin/javac.exe" -c
    p . -Xlint Library.java

    F:\Programming\Java\Project>MORE

    _



    That last underscore is a text prompt


    But what am I able to do with it? How do use this to run my java program?

    Also using preference->tools and then browsing for the javac file in Textpad I somehow enabled Textpad to read java so now I can compile my programs in Textpad, I don't know if the batch file enabled me to do that or what but at least I can now compile, but I have no idea how to run the program after compiling it. Can I use the batch file to do that? Or is there a command in cmd?

  32. #22
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    Use the java command with the classname to execute the class.

    See the tutorial: http://docs.oracle.com/javase/tutori...ava/win32.html
    If you don't understand my answer, don't ignore it, ask a question.

  33. The Following User Says Thank You to Norm For This Useful Post:

    solidMGSsnake (December 7th, 2013)

  34. #23
    Junior Member
    Join Date
    Dec 2013
    Posts
    25
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Help with Textpad

    Ok I FINALLY got it working, that you very much for being so patient with me.

    Is there any way I can give you a Thumbs Up or a Thanks? Because you definitely deserve it!

  35. #24
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Help with Textpad

    Glad you got it working.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. java using textpad. Atm code not having any syntax error but runs funny
    By bukasmayor in forum What's Wrong With My Code?
    Replies: 8
    Last Post: January 28th, 2013, 07:55 AM
  2. JDK and Textpad Downloads for Mac Users
    By jcamana10 in forum Java Theory & Questions
    Replies: 2
    Last Post: November 2nd, 2012, 12:50 PM
  3. textpad & java
    By dvsumosize in forum Java IDEs
    Replies: 3
    Last Post: February 3rd, 2010, 09:27 AM
  4. Textpad Program Running Problems
    By Paddy in forum Java IDEs
    Replies: 4
    Last Post: January 27th, 2010, 09:14 PM
  5. Replies: 4
    Last Post: April 21st, 2009, 09:37 AM

Tags for this Thread