473,388 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Wrong directory in Notepad++

I am a complete rookie at programming, and I've installed NotePad++ on my laptop so I can practise writing scripts outside of uni. I've also installed JDK v 1.6.0 (Java Development Kit), JRE and JDK Documentation onto my laptop.

My problem is that when I try to compile my program in NotePad++ (before I run the application), I get an error saying

CreateProcess() failed with error code 2:
The system cannot find the file specified.

I don't know how to fix this, or where to begin to try and fix it, so any help on this would be awesome!
Apr 8 '10 #1
7 16029
chaarmann
785 Expert 512MB
Can you tell me what's broken on my car without seeing my car?
Maybe yes if you are a fortune-teller. But I am not.
So please show your program, and how you tried to compile it.
Then we can see what file you specified could not be found.
Apr 8 '10 #2
jkmyoung
2,057 Expert 2GB
There's no need to be so patronizing. This is probably an issue with the Notepad++ setup, thus not dependent on the code.

Can your program compile the simplest of code? eg :
Expand|Select|Wrap|Line Numbers
  1. public class Main {
  2.     public static void main(String[] args)  {}
  3. }
You probably just need to set it up to point to the proper java compiler on your computer. Double check the compile time options.
Apr 8 '10 #3
I think it is a problem with my set-up. I've tried compiling the most simplest of codes, but it still comes up with the same error. I'm not sure how to change the java compiler (as I said, I'm a complete rookie at this :) ). Do I have to change something under in Macro>NppExec tab?
Apr 8 '10 #4
chaarmann
785 Expert 512MB
Sorry that it sounded patronizing. Maybe I was in that mood because of so many people making a guessing game: asking for help in their program and not listing their source code or command that lead to the error. My apologies, I should not put all under one umbrella.

If it's a Notepad++ configuration issue, then we really don't need the source code and I am of no help, since I am using jEdit and Eclipse. But in case that it's a general compilation issue (what I bet it is), it would be very helpful for me to give me following information:
  • The compilation command: Somewhere inside the configuration of Notepad++ there must be the command line given for compilation. Something like "javac -classpath ... %1" or so. Please list it here. Maybe this line contains references (directly or through CLASSPATH) to files that are not there.
  • the CLASSPATH and PATH environment variable. Maybe the compiler cannot be found because it's not listed inside the PATH. Or some java library files cannot be found, because the classpath points to a wrong location. So just open a command prompt window and show us the output of the commands "echo %PATH%" and "echo %CLASSPATH%". Then please also try to execute "java -version" and show us the output.
  • The source code. It's needed to verify that the class name is always like the file name, and that all include commands are correct. It's a common mistake for beginners to define a class "A" inside their code that calls a class "B", but they put that class "B" into a file named "C.java" and not "B.java", so you will get the error message like above, that the file can not be found.

So giving us more information would be really helpful in our quest to solve your problem. The more info we get, the less we have to guess, and the faster your problem will be solved.
Apr 9 '10 #5
Oh that's ok, I can imagine it would be frustrating having silly questions like mine. Sorry. I'v tried to include the information you need:
  • Compilation Command: So I tried to compile my file, and this is the entire output:

    NPP_EXEC: "Compile"
    CD: E:\Programming\Assignment 1 resources\A1Resources\Stage01
    Current directory: E:\Programming\Assignment 1 resources\A1Resources\Stage01
    javac A1Stage01.java
    CreateProcess() failed with error code 2:
    The system cannot find the file specified.

    ================ READY ================


  • The classpath and environmental variables - here is my output from the command prompt:

    C:\Documents and Settings\pbtech>echo %PATH%
    C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32 \Wbem;C:Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Java\jdk1.6.0_14\bin

    C:\Documents and Settings\pbtech>echo %CLASSPATHS%
    %CLASSPATH%

    C:\Documents and Settings\pbtech>java -version
    'java' is not recognised as an internal or external command, operable program or batch file.
  • I'm not too sure about the soruce code - is that my application or program files? I tried attaching them, but it doesn't support java type files. Would it help if I wrote out my program/application on here?

I think it does have something to do with all of these points (is that possible?).
Hope that you have the information you requested, thank you so much for your help so far!
Apr 10 '10 #6
chaarmann
785 Expert 512MB
You have "C:\Program Files\Java\jdk1.6.0_14\bin" inside your path. There should be the file "java.exe" (and also "javac.exe" which you need for compilation) inside. But if you try to execute java.exe by calling "java -version" it gives you an error. That means that "java.exe" in not there! Can you please open this folder and see if this folder exists and if yes, if javac.exe is inside? If not, then you must give correct name in PATH (if javac.exe is somewhere else ) or reinstall java (if you cannot find it at all). I bet that's the problem, and after fixing it you will be able to compile in Notepad.

Second, avoid spaces in your pathname. Even if it works now, you will get problems later on! Put your code in a place that has underscores instead.
That means to "E:\Programming\Assignment_1_resources\A1Resources \Stage01" (note the underscore before and after "1"!). If you want to stick to Java coding standards, use Camel-Case, name it "Assignment1Resources".

Third, can you please give the output of %CLASSPATH% again? You typed an "S" at the end by mistake!

Instead of listing your source code yet, you can try to compile the code below. Only if the compilation of this source code works, and you still have compilation problems or other problems, you need to post your own code.

Filename: "Hello.java"
Compile: "javac Hello.java" (on command prompt)
Execute: "java Hello" (on command prompt, it should print "Hello World" on command line)
Expand|Select|Wrap|Line Numbers
  1. public class Hello 
  2.     public static void main (String argv[]) 
  3.     { 
  4.         System.out.println("Hello World!"); 
  5.     } 
  6.  
Apr 11 '10 #7
I'm sure you have probably figured this out being as how its 2 years later, but since i didn't see the answer here ill go ahead and explain.

First you have to install the NppExec plugin in Notepad++. this can be found in the plugin manager. next you have to set your PATH to the jdk. *Note: you HAVE to be using the 32bit JDK as the 64bit version wont work* and yes you can set up the 32bit on a 64 bit system. just install it in the Program Files (x86) directory.

Next hit the f6 key and copy this into the window that pops up:
cd $(FULL_CURRENT_PATH)
javac $(FILE_NAME)
java $(NAME_PART)

hit the save button and and name it something relevant. once its saved hit ok and your program should compile and run in a command window at the bottom of the program.

Don't worry about CLASSPATH at this point as you're probably not dealing with packages. but again, use the 32 bit version of JDK or this wont work. Also, if you're trying to format your output using "printf" you'll have to compile using windows command prompt because the built in console wont display it properly.

Hope this helped anyone that might need it.
Mar 20 '12 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: o'seally | last post by:
solaris/linux admins/rookie_developers that battle with this error are probably all frustrated when it happens. i bet you're also somehow frustrated by this seemingly unsolvable error :-) ...take...
12
by: EAS | last post by:
Does anyone know how to display the current directory using DOS and/or Python? I already tried os.pardir and os.curdir in Python, but all they return are a couple of periods... >>>import os...
4
by: Jesper | last post by:
How can I open a textfile from C# using notepad (or the user assigned application for this).
9
by: Sandy | last post by:
can mfc application, send text data to opened notepad file in desktop?(live transfer of data) . can anybody help
1
by: James | last post by:
this is a console program to convert ANSI to UTF8 format. Although in notepad i open the source file (which is ansi), and after running the program below, and re-open in notepad (it shows utf8...
8
by: dougawells | last post by:
Hi - I'm hoping for help with the auto-generation of a hyperlinked listing of all files in a directory. The server I use does not auto-generate this. So, when someone comes to this directory and...
1
by: thunder54007 | last post by:
hi, here is my script: import win32con import time import wmi c = wmi.WMI() for process in c.Win32_Process(name = "notepad.exe"): print process.ProcessId, process.Name process.Terminate ()
3
by: inungh | last post by:
I have a image control on the design form. I set image url. The image control only show image when I put the image in the same directory. Are there any place I can check? Your help is great...
36
by: Don | last post by:
I wrote an app that alerts a user who attempts to open a file that the file is currently in use. It works fine except when the file is opened by Notepad. If a text file is opened, most computers...
1
by: Samuel R. Neff | last post by:
I have a file in a directory that is returned from Directory.GetFiles() but subsequently fails a File.Exists() check. Test code: string p = @"C:\documents and settings\all users\" +...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.