Here is how to compile and execute Java source files. This is used under the run command of Notepad++ (hotkey F5).
Compile command: cmd /c cd "$(CURRENT_DIRECTORY)" && (javac "$(FILE_NAME)" || pause)
Execute command: cmd /k cd "$(CURRENT_DIRECTORY)" && java "$(NAME_PART)"
Open CMD: cmd /k cd "$(CURRENT_DIRECTORY)"
--Additional stuff--
Here are my entries in shortcuts.xml:
<Command name="Javac" Ctrl="yes" Alt="no" Shift="no" Key="49">cmd /c cd "$(CURRENT_DIRECTORY)" & javac "$(FILE_NAME)"</Command>
<Command name="Java" Ctrl="yes" Alt="no" Shift="no" Key="50">cmd /k cd "$(CURRENT_DIRECTORY)" && java "$(NAME_PART)"</Command>
<Command name="Command Prompt" Ctrl="yes" Alt="no" Shift="no" Key="51">cmd /k cd "$(CURRENT_DIRECTORY)"</Command>
Note: shortcuts.xml is in Notepad++'s base folder (C:\Program Files\Notepad PP\) or if you're using Notepad++ portable its in ....\Notepad++Portable\Data\settings\.
Note: Notepad++'s Run can be used to execute CMD commands in the same way I'm showing. The cmd /c executes the command then terminates. The /k executes the command then the CMD stays open.
Here's some info: http://www.ss64.com/nt/cmd.html and http://commandwindows.com/command1.htm
Also note: If the java or javac commands aren't recognized in the command prompt this is because java/javac isn't set under environment variables (Located under MyComputer>Properties>AdvancedTab>EnvironmentVariablesButton) and so CMD doesn't know where to find these programs (java.exe/javac.exe). I'm pretty sure that's right.. try google-ing "java javac environment variables" for more info.
Hope this helps. GL.
-Steven R / TOAST
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I forgot to update one of the commands.. in the shortcuts.xml it should read:
<Command name="Javac" Ctrl="yes" Alt="no" Shift="no" Key="49">cmd /c cd "$(CURRENT_DIRECTORY)" & javac "$(FILE_NAME)"</Command>
The update is to pause when an error occurs (such as a compilation error).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is how to compile and execute Java source files. This is used under the run command of Notepad++ (hotkey F5).
Compile command: cmd /c cd "$(CURRENT_DIRECTORY)" && (javac "$(FILE_NAME)" || pause)
Execute command: cmd /k cd "$(CURRENT_DIRECTORY)" && java "$(NAME_PART)"
Open CMD: cmd /k cd "$(CURRENT_DIRECTORY)"
--Additional stuff--
Here are my entries in shortcuts.xml:
<Command name="Javac" Ctrl="yes" Alt="no" Shift="no" Key="49">cmd /c cd "$(CURRENT_DIRECTORY)" & javac "$(FILE_NAME)"</Command>
<Command name="Java" Ctrl="yes" Alt="no" Shift="no" Key="50">cmd /k cd "$(CURRENT_DIRECTORY)" && java "$(NAME_PART)"</Command>
<Command name="Command Prompt" Ctrl="yes" Alt="no" Shift="no" Key="51">cmd /k cd "$(CURRENT_DIRECTORY)"</Command>
Note: shortcuts.xml is in Notepad++'s base folder (C:\Program Files\Notepad PP\) or if you're using Notepad++ portable its in ....\Notepad++Portable\Data\settings\.
Note: Notepad++'s Run can be used to execute CMD commands in the same way I'm showing. The cmd /c executes the command then terminates. The /k executes the command then the CMD stays open.
Here's some info: http://www.ss64.com/nt/cmd.html and http://commandwindows.com/command1.htm
Also note: If the java or javac commands aren't recognized in the command prompt this is because java/javac isn't set under environment variables (Located under MyComputer>Properties>AdvancedTab>EnvironmentVariablesButton) and so CMD doesn't know where to find these programs (java.exe/javac.exe). I'm pretty sure that's right.. try google-ing "java javac environment variables" for more info.
Hope this helps. GL.
-Steven R / TOAST
Arg, scratch last post:
<Command name="Javac" Ctrl="yes" Alt="no" Shift="no" Key="49">cmd /c cd "$(CURRENT_DIRECTORY)" && (javac "$(FILE_NAME)" || pause)</Command>
I forgot to update one of the commands.. in the shortcuts.xml it should read:
<Command name="Javac" Ctrl="yes" Alt="no" Shift="no" Key="49">cmd /c cd "$(CURRENT_DIRECTORY)" & javac "$(FILE_NAME)"</Command>
The update is to pause when an error occurs (such as a compilation error).