[Notepad ++] C language / Java compilation & execution environment construction

Advance preparation

Prepare a compiler and find out how to use it

--This article uses borland

bcc32 -n Output path inputFile.c

Don't put a space behind the -n

Character code

--The character code of the program source file and the batch file to be created are unified to Shift-JIS here. --If you see garbled characters, try changing the character code.

procedure

1. Install the Notepad ++ plugin NppExec

--A plugin that can execute multi-line commands at once. --You can manage those commands like a script. --Create a script as a menu item / hotkey candidate and provide it to Notepad ++. --For installation, Plugin Menu> Plugin Management> Check> Install

2. Prepare a batch file

--Run the compiled EXE file at an external command prompt --Pause automatically at the end of execution to keep the window --The creation folder can be anywhere

runC.bat


@%1
@echo -----------------------------------------------
@echo -----------------------------------------------
pause
  1. Execute the EXE (full path) passed as a parameter
  2. Mark of end
  3. Mark of end
  4. Hold the window

3. Create an NppExec script

--Plugins> NppExec> Execute --Enter the code below and rewrite [Content] according to your environment --Click OK and check the operation --Once confirmed, open Plugins> NppExec> Execute again, name the script and save it (eg runC)

runC


NPP_SAVE
set obj = $(CURRENT_DIRECTORY)\$(NAME_PART)
cd 【C:\C\borland\Bin】
【bcc32 -n$(CURRENT_DIRECTORY) $(obj).c】
cd $(CURRENT_DIRECTORY)
NPP_RUN 【B:\USER_FLODER\document\runc.bat】 "$(obj).exe"
unset obj
  1. Save the open source file
  2. Assign the full path without extension to the variable * $ (XXX) is the [environment variable] of Notepad ++ (https://so-zou.jp/software/tech/tool/editor/notepad-plus/plug- in / nppexec /)
  3. Go to Compiler Director
  4. Compile
  5. Move to the execution folder
  6. Run the batch file externally, passing the EXE full path
  7. Clear variable obj

4. Register the script as a menu item / hotkey candidate

--Plugins> NppExec> Advanced Options> Pay attention to the Menu Item column at the bottom left --Enter the menu item display name (eg runC), select the script, and register with Add / Modify. --Click OK at the bottom right, and the message box "Changes will not be reflected until Notepad ++ is restarted" appears. --Notepad ++ restart

5. Shortcut key setting

--Settings> Shortcut Management> Plugins Tab --Set a shortcut key for runC --If there is a conflict, you can cancel it if the shortcut of the conflicting menu item is not used.

6. Java

runj.bat


@java %1
@echo -----------------------------------------------
@echo -----------------------------------------------
pause

runJ(Script for NppExec)


NPP_SAVE
set obj = $(CURRENT_DIRECTORY)\$(NAME_PART)
cd $(CURRENT_DIRECTORY)
"C:\Program Files\Java\jdk1.8.0_181\bin\javac.exe" $(obj).java
NPP_RUN B:\USER_FLODER\document\Java\runJ.bat $(NAME_PART)
unset obj

Recommended Posts

[Notepad ++] C language / Java compilation & execution environment construction
[Java] Environment construction
Java environment construction
java development environment construction
JavaFX environment construction in Java 13
AtCoder Challenge Environment Construction (Java 8)
Execution environment test after Java installation
Make a language! (JavaCC environment construction)
[Java & SpringBoot] Environment Construction for Mac
Java runtime environment construction method (Tomcat @ Linux)
[Processing x Java] Construction of development environment
Java development environment construction memo on Mac
Play Framework 2.6 (Java) environment construction in Eclipse
Spring Boot + Docker Java development environment construction
Minimal Java environment construction and Hello World
Docker + DynamoDB local + C ++ environment construction and practice
Protobuf and gRPC C ++ environment construction on Ubuntu 18.04
[Java] Build Java development environment on Ubuntu & check execution
Road to Java Engineer Part1 Introduction & Environment Construction
JAVA + STS (Spring Tool Suite) environment construction procedure
Java development environment
[Spring] Environment construction
Docker environment construction
[LeJOS] Let's program mindstorm-EV3 in Java [Environment construction part 2]
Java language from the perspective of Kotlin and C #
[Java] Environment construction procedure for developing struts 1.3 with Eclipse
[Environment construction] Build a Java development environment with VS Code!
Java + Spring development environment construction with VirtualBox + Ubuntu (Xfce4)