1

I'm trying to compile and run a java program in notepad++ and I get error code 2, the system cannot find the file specified.

Here is my program code:

public class test {
    public static void main(String[] args) {
        System.out.println("It worked!!!!!");
    }
}

And I'm attempting to run and compile it using

javac "$(FULL_CURRENT_PATH)"
java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"

Here's the link to the the page where I found this: http://www.dreamincode.net/forums/topic/113551-compilingrunning-java-programs-in-notepad/

What am I doing wrong?

Alwaysdeadfred
  • 227
  • 4
  • 15
  • 7
    And you are not using an IDE because...? – Peter Lawrey Oct 01 '12 at 17:51
  • Have you read http://stackoverflow.com/questions/4314027/using-notepad-to-compile-java-code – Werner Kvalem Vesterås Oct 01 '12 at 17:56
  • @PeterLawrey I am not using an IDE because I am trying to simulate working on a Linux system as I have to in my Computer Science course where we only have access to text editors. – Alwaysdeadfred Oct 01 '12 at 19:03
  • @WernerVesterås I have read over that page, but the only solution was to switch to netbeans, which is not what I want. I have followed the steps on http://www.cs.auckland.ac.nz/courses/compsci101s1c/resources/Notepad/Notepad++.pdf and I still get the same error. – Alwaysdeadfred Oct 01 '12 at 19:15
  • I use an IDE on linux every day, but if thats all you have and you don't even have maven, I guess you have no choice. – Peter Lawrey Oct 01 '12 at 19:16
  • Not that it matters here, but class names should start with a capital letter. – midhunhk Oct 01 '12 at 20:47

1 Answers1

0

javac isn't available on your path. Can you execute javac -version from a command line? I would expect that you get the message:

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

You can add the fully qualified path to your javac and java commands above, or you can add the java bin directory to your path.

Jeff
  • 3,669
  • 1
  • 23
  • 33
  • Entering `javac -version` did result in your expected output. How would I add the fully qualified path to my javac and java commands? – Alwaysdeadfred Oct 01 '12 at 23:01
  • `"C:\Program Files\Java\jdk1.6.0_33\bin\javac.exe" "$(FULL_CURRENT_PATH)"` (actual path should be wherever you have the JDK installed) – Jeff Oct 02 '12 at 13:42