- Saved searches
- Use saved searches to filter your results more quickly
- License
- dominikcebula/npp-java-plugin
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Пишем код и компилируем JAVA в notepad++
- Configure Notepad++ to Run C, C++ and Java Programs
- Configure Notepad++ to Run C, C++ and Java Programs
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
License
dominikcebula/npp-java-plugin
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
NppJavaPlugin is a Java Plugin for Notepad++, which allows you to compile and run Java code directly from Notepad++.
Why would I want to use NppJavaPlugin?
NppJavaPlugin was created with following use cases in mind:
- Simple Code Experiments
- Simple Code Creation for Education Purposes
- Preparing for a Coding Interview (Amazon, Facebook, Google, Netflix, …)
- Preparing for a Java Certification
- Oracle Certified Professional: Java SE 17 Developer (1Z0-829)
- Oracle Certified Professional: Java SE 11 Developer (1Z0-819)
- Oracle Certified Associate Java SE 8 Programmer (1Z0-808)
- Oracle Certified Professional Java SE 8 Programmer (1Z0-809)
Whenever preparing for a Coding Interview or a Java Certification, you should create a practice environment that does not provide you with Integrated Development Environment (IDE) features like Code Completion, Syntax Highlight, Code Generation, Early Error Checking. During regular development IDE does a very good job of making developers more productive through those features, however during a Coding Interview or a Java Certification Exam, an environment under which you will take the exam, will not include those features. This is why it is important to practice without those features to make sure that you can write code accurately and fluently without having to rely on mentioned IDE features.
In other cases I recommend using a full IDE like IntelliJ, Eclipse, NetBeans.
What functionalities are provided by NppJavaPlugin?
After installing NppJavaPlugin following options will be available under Plugins -> Java Plugin menu:
On top of it, NppJavaPlugin also includes Java Console which will output compilation issues if those are found. Java Console can be manually shown with usage of “Show/Hide Java Console” option.
Does NppJavaPlugin include any default keyboard shortcuts?
Yes, by default following keyboard shortcuts are configured:
- Compile — Shift + F8
- Run — Shift + F9
- Compile and Run — Shift + F10
- Clear Java Console — Shift + F11
- Show/Hide Java Console — Shift + F12
Those can be changed using Settings -> Shortcut Mapper -> Plugin commands option. If you need more information, more precise instructions can be found here: https://npp-user-manual.org/docs/preferences/#shortcut-mapper
- Java Development Kit (JDK) is installed
- Plugin should work with any version
- Plugin should work with any Java distribution
- Here are some links on where you can download JDK:
- https://adoptium.net/
- https://www.oracle.com/java/technologies/downloads/
- https://www.baeldung.com/java-home-on-windows-7-8-10-mac-os-x-linux#windows
- Go to Plugins -> Plugins Admin
- Search for «Java Plugin»
- Check «Java Plugin»
- Click Install
If you need more information, more precise instructions can be found here: https://npp-user-manual.org/docs/plugins/#install-using-plugins-admin
- Download ZIP file from https://github.com/dominikcebula/npp-java-plugin/releases
- Unpack ZIP file to your Notepad++ installation folder, for example “C:\Program Files\Notepad++\plugins\NppJavaPlugin”
If you need more information, more precise instructions can be found here: https://npp-user-manual.org/docs/plugins/#install-plugin-manually
Ideas for future versions
- Tech:
- Automated Test Coverage and Full CI — Unit and Integration Tests (Testing Pyramid)
- Automated Code Quality Scans
- Automated Security Scans (SAST)
- Support for ARM64
- Compilation Feedback — after compilation is executed, if errors are detected, lines that contains issues are marked as red
- Run Dialog — user can set program arguments for program execution
- Run Dialog — user can set input for stdin from file
- Run Dialog — user can redirect stdout and/or stderr to file
- JDK autodetection — if JAVA_HOME is not set, plugin should automatically detect and find JDK
- Clean Action — plugin deletes all created “.class” files when user clicks “Clean” option from menu
- Configuration Dialog — user can define JDK that should be used, without plugin having to rely on JAVA_HOME system variable or autodetection
- Configuration Dialog — user can set flags for code compilation
- Configuration Dialog — user can set additional classpath elements for compilation and execution
- Run Dialog — user can set environment variables for program execution
- Java Console — ability to configure font, font size, colors for info, warnings, errors
- Configuration Dialog — user can decide if application should execute in a separate command prompt or if it should execute under Plugin Java Console
You are more than welcome to contribute, but please keep in mind few rules:
- Use Modern C++ (C++11, C++17, …)
- Use Clean Code
- Use SOLID
- Use GoF Design Patterns (when applicable)
- Use KISS, DRY, YAGNI
- Use Component Coupling and Cohesion Principles (REP, CRP, CCP, ADP, SDP, SAP)
- Don’t overdesign
Пишем код и компилируем JAVA в notepad++
Превратить notepad++ в более менее адекватную среду для работы с Java достаточно просто. После установки программы заходите в меню Плагины — Plugin Manager и выбираете из появившегося списка следующие пункты:
- Explorer — чтобы быстро перемещаться по файлам прямо из программы
- Emmet — чтобы создавать сниппеты (сокращенные аббревиатуры кода, которые будут автоматически преобразованы в полноценные строки)
- NppExec — плагин для написания скриптов, в т.ч. запуска других программ
При установке Emmet может попросить вас обновить или установить плагин Python Script — соглашаемся. После установки плагинов надо будет перезайти в notepad++
Затем включаем Плагины — Explorer — Explorer слева появится панель навигации по файлам. Следующим настраиваем Плагины NppExec — Execute (или жмем F6). В появившемся окне пишем:
cd $(CURRENT_DIRECTORY) javac -d c:\Путь_куда_скомпилируются_файлы_class $(FILE_NAME) cd c:\Путь_куда_скомпилируются_файлы_class java $(NAME_PART)
Тот кто знаком с консольными командами легко поймет суть написанного. Поясню.
cd $(CURRENT_DIRECTORY) — переводит нас в папку где находится редактируемый нами файл .java
javac -d c:\Путь_куда_скомпилируются_файлы_class $(FILE_NAME) Компилирует наш файл java в байткод и закидывает результат в папку указанную с помощью ключа -d. Дальше я думаю не стоит пояснять.
Пример с моей текущей настройкой представлен на скриншоте:
Следующим шагом настраиваем сниппеты. Сниппеты помогают нам быстрее набирать код. Заходим в папку где установлен наш notepad++ и идем по следующему пути:
Notepad++\App\Notepad++\plugins\EmmetNPP\emmet\
В папке будет находится файл snippets.json Открываем его в текстовом редакторе (можно в самом же notepad++) и идем в конец файла. Перед последней закрывающей скобкой пишем:
"java": < "snippets": < "psvm": "public static void main (String[] args) ", "sout": "System.out.println (\"$1\");", > >
Я уверен вы уже догадались, что psvm будет автоматически преобразовано в public static void main (String[] args) по нажатию забинденной кнопки. Спец символы \n \t | $1 означают следующее:
\n -перевод каретки на следующую строку
\t — табуляция
| — место куда перескочит курсор после всех проведенных преобразований
$1 — так же служит для указания места курсоруНапомню, что назначение клавиш, по нажатию которых вы сможете раскрыть аббревиатуру, производится в меню Опции — Горячие клавиши — Plugin commands. В параметре Expand abbreviation задайте свое сочетание, у меня это Ctrl+Shift+E
По аналогии вы можете написать свои варианты сниппетов. Подробнее можно прочитать тут https://docs.emmet.io Стоит заметить, что это не единственный способ создавать сниппеты — есть отдельные плагины для этих целей, например такие. Я лично привык пользоваться emmet, так как он уже стал де факто стандартом для верстальщиков сайтов и в нем уже заложена куча сниппетов по html, css верстке и JavaScript.
Как видите из notepad++ можно сделать вполне себе рабочий инструмент для написания кода на java. Такая сборка не заменит полноценные IDE (Intellij Idea, Eclipse, Netbeans), но именно с текстовых редакторов я предлагаю начинать писать свои первые программы на java. Во-первых вы «набьете руку» (поначалу лучше не включать сниппеты), во-вторых вы будете лучше понимать процесс сборки приложения компилятором (обычно IDE берут эту заботу на себя).
Configure Notepad++ to Run C, C++ and Java Programs
In this tutorial I will tell you about how to configure notepad++ to run C, C++, Java, Python, JavaScript, etc. programs.
Notepad++ is a popular and free source code editor which is widely used by programmers. Even I use it very frequently. Today while editing a source code on notepad++ I thought that it will be great if there is any way to run the source code on it. Luckily I found a way that I am sharing below. I have mentioned steps only for C, C++ and Java. But the same method can be used to run programs of any other language.
Configure Notepad++ to Run C, C++ and Java Programs
1. First of all download the notepad++ from below link.
2. Now install and open notepad++.
3. We require NppExec plugin that will help us to run programs. You can skip 3rd and 4th steps if the NppExec plugin is already present in notepad++. Go to Plugins > Plugin Manager > Show Plugin Manager.
4. Make sure you have internet connection because we are going to download plugin. In the new window you will get a list of all available plugins. Scroll down and select NppExec plugin from the list and install it.
5. Go to Plugins > NppExec > Execute. Now we have to create a script. In the new window enter following commands and then save it with any name.
For C and C++
npp_save
cd $(CURRENT_DIRECTORY)
C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe “$(FILE_NAME)”
cmd /c “$(CURRENT_DIRECTORY)\a.exe”npp_save
cd $(CURRENT_DIRECTORY)
C:\Program Files\Java\jdk1.8.0_45\bin\javac “$(FILE_NAME)”
C:\Program Files\Java\jdk1.8.0_45\bin\java “$(NAME_PART)”Replace “C:\Program Files (x86)\Dev-Cpp\MinGW64\bin” and “C:\Program Files\Java\jdk1.8.0_45\bin” with the path where compiler is installed in your computer.
6. Then go to Plugins > NppExec > Advance Options. In the bottom left corner you will get a list of Associated script. Select the script that you have just created from the drop down list.
7. Click on Add/Modify button. Now you can see the script in the Menu items box at the top.
8. Click OK button, you have to restart the notepad++.
9. After that go to Settings > Shortcut Mapper. Click on Plugin commands tab, there you will get the list of all the commands. Scroll down until you see the command with the name with which you have saved the script.
10. Click on Modify button to choose a shortcut according to you. Make sure the shortcut is unique. Now close the window.
11. Just write your program and run it using the shortcut key you created in previous step. You can see the output in the Console window as shown below.
So this was the simple method to configure notepad++ to execute C, C++ and Java programs. If you are getting any problem then comment below, I will try to solve your problem.