Results 1 to 3 of 3
  1. #1
    JProgrammer is offline Member
    Join Date
    Jan 2015
    Posts
    1
    Rep Power
    0

    Post Can't execute the Java code from the command line in Notepad++

    I have the program written correctly, but it won't execute.

    public class Welcome {
    public static void main(String[] args){
    //Display message Welcome to Java! on the console
    System.out.println("Welcome to Java");
    }
    }

    I compiled the code as written below with "javac Welcome", and use the "Class" name "Welcome"
    The file path is: C:\Java Programs

    Javac Welcome.java
    Java Welcome

    Below is the result of the above commands

    javac Welcome
    Create Process() failed with error code 2:
    The system cannot find the file specified.

    java Welcome
    Process started >>>
    Error: Could not find or load main class Welcome
    <<< Process finished. (Exit code 1)

    Somebody Please Help Me! I am coding in notepad++

  2. #2
    milovan is offline Senior Member
    Join Date
    Jan 2011
    Location
    Belgrade, Serbia
    Posts
    311
    Rep Power
    5

    Default Re: Can't execute the Java code from the command line in Notepad++

    did you programmed java in notepad++ before?

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    18,133
    Rep Power
    26

    Default Re: Can't execute the Java code from the command line in Notepad++

    The first use shown of the javac command works but the second use does not. Notice the difference between the args to the command: the first has the extension: .java, the second does not hava .java
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Is There a way to Only Execute A line Of Code once?
    By AyooNisto in forum New To Java
    Replies: 11
    Last Post: 12-16-2012, 06:51 PM
  2. Execute Cygwin command from Java app
    By ZebraIzToronto in forum Advanced Java
    Replies: 1
    Last Post: 01-21-2011, 06:51 AM
  3. Compiling java code from the command line
    By alman9898 in forum New To Java
    Replies: 5
    Last Post: 10-13-2010, 03:35 AM
  4. Replies: 2
    Last Post: 07-02-2010, 02:20 PM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 12:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •