I've been trying to set up Notepad++ as a little Java environment, mainly for learning Java as I was having some difficulty getting a simple program to work with NetBeans, unfortunately all the advice on setting up Notepad++ to call the Java code is not working.
I guess notepad++ has changed or the Java development Kit has been massively modified because all examples I have used result in errors, even though there is little room for error.
to begin I found this site: http://blog.sanaulla.info/2008/07/25/using-notepad-to-compile-and-run-java-programs/
this is the code to run Javac to compile the code:
javac “$(FILE_NAME)”
and
java “$(NAME_PART)”
to run the resulted byte code, however this has absolutely no success at all anymore. Java is properly setup and I can call the Java program to do its thing through CMD.
Using a plugin called npp and called through F6 and run with this code (given in the comments) succeeds in compiling the Java program into the correct .class file, however the command failed in running the program
cd “$(CURRENT_DIRECTORY)”
javac $(FILE_NAME)
java $(NAME_PART)
errors from the console in Notepad++ are:
java.lang.NoClassDefFoundError: first
Caused by: java.lang.ClassNotFoundException: first
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: first. Program will exit.
Exception in thread "main"
I figured setting up Notepad++ to compile and run the code would be easy and fun, but its seems all documentation on the internet is outdated as nothing works.
I would like a easy way to compile and run Java code from within Notepad++
I could just used CMD but i'd rather it be more integrated into notepad++
Thanks for any possible help. cheers :)
EDIT: I'm using the latest version of Java, notepad++ and have Windows 7
EDIT 2: the code:
//A Very Simple Example
class ExampleProgram {
public static void main(String[] args){
System.out.println("I'm a Simple Program");
}
}