Computer Hope
Microsoft => Microsoft Windows => Windows Vista and 7 => Topic started by: jon80 on May 12, 2011, 03:33:00 AM
-
I have downloaded NotePad++, and, according to the online help (see page at http://npp-community.tuxfamily.org/documentation/notepad-user-manual/commands), it seems possible to run a command that would allow me to execute a scripted file.
Hence, I would like to create a script file that allows me to capture whatever the user (e.g. myself) has loaded from within the application, and, launch it by the Java compiler, for example:
compile_a_java_program.bat
@echo off
javac %1.java
rem where %1 is the name of the file currently being viewed by the user
java %1
rem usually ending with .class, where this is the name of the file that needs to run
I am running WinXP SP3, and, JVM 1.6.0_24.
???
-
In the Notepad++ run box, use the ... button and find your batch file. Double clicking it will move full path to the run box; then add $(FULL_CURRENT_PATH) to the run box. The run box should look something like this:
compile_a_java_program.bat $(FULL_CURRENT_PATH)
If necessary, add path info for your batch file.
You batch file might need a tweak or two:
@echo off
javac %1
cd /d %~dp1
java %~n1
pause
I threw in the pause so you can see the result before the window closes. I also added a CD command to navigate to the directory where the class file lives, just in case the directory is not on the classpath variable.
Good luck. 8)