Well, I have been looking around for a way to compile Java using Notepad++ I think I managed to do so, but I receive this error in command prompt:
java Main
Exception in thread "main" java.lang.NoClassDefFoundError: Main
How should I fix this? I'm new to all of this.
So far I went to run in np++ and placed $(NPP_DIRECTORY)\CompileJava.bat $(FILE_NAME) $(NAME_PART)
Into the box.
Oh, and I created a CompileJava.bat file with this: @echo off
path=%path%;"<path to your BIN directory of JDK>" @echo on
javac %1
java %2
pause
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The 2 commands you have pasted over here will work. But this again assumes that your environment variable JAVA_HOME is set. This may not always be the case. Easy way to test this is : Open command prompt anywhere on your file system and type "java". If it says "Command not found", then you would have to set the variable.
When you press F6, by default it is set to the NppExec Plugin of NPP. A pop-up would appear. Paste the first line in the box, click on Save. Type the name as "Java Compile", and click OK.
Similarly save the next line as "Java Run".
Now everytime you press F6, you can choose to compile or run from the combo box and then click OK. Voila! You would see your results in the console output below.
Re,
Sam
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looking at your error message, I can figure out that "java" is not able to find your class that is being created. One reason could be improper path in your %2 argument. Simple way to test this is to echo both %1 and %2 before executing.
Hope this helps,
Sam
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It did not work when I individually tested each path. But, I found another piece of information:
compile:
cmd /c cd "$(CURRENT_DIRECTORY)" && "%JAVA_HOME%\bin\javac" "$(FULL_CURRENT_PATH)"
run:
cmd /k cd "$(CURRENT_DIRECTORY)" && "%JAVA_HOME%\bin\java" "$(NAME_PART)" && exit
I read press f6 to place the first line of code. Is this also true for the second part?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I have been looking around for a way to compile Java using Notepad++ I think I managed to do so, but I receive this error in command prompt:
java Main
Exception in thread "main" java.lang.NoClassDefFoundError: Main
How should I fix this? I'm new to all of this.
So far I went to run in np++ and placed $(NPP_DIRECTORY)\CompileJava.bat $(FILE_NAME) $(NAME_PART)
Into the box.
Oh, and I created a CompileJava.bat file with this:
@echo off
path=%path%;"<path to your BIN directory of JDK>"
@echo on
javac %1
java %2
pause
Hello,
The 2 commands you have pasted over here will work. But this again assumes that your environment variable JAVA_HOME is set. This may not always be the case. Easy way to test this is : Open command prompt anywhere on your file system and type "java". If it says "Command not found", then you would have to set the variable.
When you press F6, by default it is set to the NppExec Plugin of NPP. A pop-up would appear. Paste the first line in the box, click on Save. Type the name as "Java Compile", and click OK.
Similarly save the next line as "Java Run".
Now everytime you press F6, you can choose to compile or run from the combo box and then click OK. Voila! You would see your results in the console output below.
Re,
Sam
Hi Yuki,
Looking at your error message, I can figure out that "java" is not able to find your class that is being created. One reason could be improper path in your %2 argument. Simple way to test this is to echo both %1 and %2 before executing.
Hope this helps,
Sam
It did not work when I individually tested each path. But, I found another piece of information:
compile:
cmd /c cd "$(CURRENT_DIRECTORY)" && "%JAVA_HOME%\bin\javac" "$(FULL_CURRENT_PATH)"
run:
cmd /k cd "$(CURRENT_DIRECTORY)" && "%JAVA_HOME%\bin\java" "$(NAME_PART)" && exit
I read press f6 to place the first line of code. Is this also true for the second part?