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?

6
  • 7
    And you are not using an IDE because...? Commented Oct 1, 2012 at 17:51
  • Have you read stackoverflow.com/questions/4314027/… Commented Oct 1, 2012 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. Commented Oct 1, 2012 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 cs.auckland.ac.nz/courses/compsci101s1c/resources/Notepad/… and I still get the same error. Commented Oct 1, 2012 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. Commented Oct 1, 2012 at 19:16

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Entering javac -version did result in your expected output. How would I add the fully qualified path to my javac and java commands?
"C:\Program Files\Java\jdk1.6.0_33\bin\javac.exe" "$(FULL_CURRENT_PATH)" (actual path should be wherever you have the JDK installed)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.