Compiling/Running Java Programs in Notepad++?

Has anyone successfully and consistantly accomplished this?

Page 1 of 1

13 Replies - 56990 Views - Last Post: 12 January 2012 - 03:50 AM

#1 cmwise  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 169
  • Joined: 14-February 09

Compiling/Running Java Programs in Notepad++?

Posted 07 July 2009 - 10:37 AM

I'm a huge Notepad++ fan and I'm just wondering if anyone has found successful ways to compile and run java programs through Notepad++. I've found some different documentation on the subject, but none of it seems to work.

Hoping I'm posting this in the correct message board, if not... my appologies!

Thanks!
Is This A Good Question/Topic? 0
  • +

Replies To: Compiling/Running Java Programs in Notepad++?

#2 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Compiling/Running Java Programs in Notepad++?

Posted 25 July 2009 - 07:39 PM

I don't use notepad++ but I use a very similar program called Programmer's Notepad. What I ended up doing was making a little Python script that inserts parameters into an ANT script. Most IDE's actually work like this (as far as I know) -- they use a build tool like ANT or make to drive the actual build.

So I am not familiar with notepad++ but I would imagine that it has a scripting ability and so it should not be hard to make a little ANT template.

Even if it does not have a scripting ability, you can pass parameters to a script in python or perl etc to control the overall build.

Building a single file is easy, it when you have to work with projects that it gets a little strange. PN has the idea of projects which can include multiple files -- the support for projects is very simple at this point but a little scripting makes it useable for small projects.
Was This Post Helpful? 1
  • +
  • -

#3 markhazlett9  Icon User is offline

  • Coding is a lifestyle
  • member icon

Reputation: 60
  • View blog
  • Posts: 1,666
  • Joined: 12-July 08

Re: Compiling/Running Java Programs in Notepad++?

Posted 04 August 2009 - 12:18 PM

Notepad++ is just a fancy text editor and does not include the javac compiler to my knowledge. You will have to compile it through the command line using javac.

Cheers
Was This Post Helpful? 0
  • +
  • -

#4 misyel  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 1
  • Joined: 02-September 09

Re: Compiling/Running Java Programs in Notepad++?

Posted 02 September 2009 - 10:32 PM

View Postmarkhazlett9, on 4 Aug, 2009 - 11:18 AM, said:

Notepad++ is just a fancy text editor and does not include the javac compiler to my knowledge. You will have to compile it through the command line using javac.


I agree with this. Notepad++ is almost just the same with Windows Notepad.
Was This Post Helpful? -1
  • +
  • -

#5 Guest_WagnerSQ*


Reputation:

Re: Compiling/Running Java Programs in Notepad++?

Posted 19 February 2010 - 07:17 AM

View Postmisyel, on 02 September 2009 - 09:32 PM, said:

View Postmarkhazlett9, on 4 Aug, 2009 - 11:18 AM, said:

Notepad++ is just a fancy text editor and does not include the javac compiler to my knowledge. You will have to compile it through the command line using javac.


I agree with this. Notepad++ is almost just the same with Windows Notepad.


It's possible !!!!
To compile and execute java class file, just install NPPExec plugin (Plugins --> Plugin Manager --> Show Plugin Manager), restart N++.
Write a simple Hello World java file and press F6. Enter the following code -->

javac "$(FULL_CURRENT_PATH)"
java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"

OK.

More information at --> http://notepad-plus....k/run-HOWTO.php

Enjoy.
Notepad++ Rocks !!!!!
Was This Post Helpful? 3

#6 Guest_Rich*


Reputation:

Re: Compiling/Running Java Programs in Notepad++?

Posted 20 March 2010 - 07:43 AM

View PostWagnerSQ, on 19 February 2010 - 06:17 AM, said:

View Postmisyel, on 02 September 2009 - 09:32 PM, said:

View Postmarkhazlett9, on 4 Aug, 2009 - 11:18 AM, said:

Notepad++ is just a fancy text editor and does not include the javac compiler to my knowledge. You will have to compile it through the command line using javac.


I agree with this. Notepad++ is almost just the same with Windows Notepad.


It's possible !!!!
To compile and execute java class file, just install NPPExec plugin (Plugins --> Plugin Manager --> Show Plugin Manager), restart N++.
Write a simple Hello World java file and press F6. Enter the following code -->

javac "$(FULL_CURRENT_PATH)"
java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"

OK.

More information at --> http://notepad-plus....k/run-HOWTO.php

Enjoy.
Notepad++ Rocks !!!!!


Thanks misyel

big help- other directives stated multiple lines; only I might add: no quotes around the java - classpath.... I treated it like it was a regular Dos command line input for java, and it worked...
Thanks again.
Was This Post Helpful? 0

#7 kiran kir  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 10-May 10

Re: Compiling/Running Java Programs in Notepad++?

Posted 20 May 2010 - 07:21 AM

:balloon: tanx man was really helpful!!! :rockon: :flowers:
Was This Post Helpful? 0
  • +
  • -

#8 singularity  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 17
  • View blog
  • Posts: 184
  • Joined: 17-October 08

Re: Compiling/Running Java Programs in Notepad++?

Posted 21 May 2010 - 05:31 AM

Here is a thread/tutorial on various Java IDE's

Java IDe's
Was This Post Helpful? 0
  • +
  • -

#9 Guest_javac*


Reputation:

Re: Compiling/Running Java Programs in Notepad++?

Posted 26 September 2010 - 08:19 AM

View PostWagnerSQ, on 19 February 2010 - 06:17 AM, said:

View Postmisyel, on 02 September 2009 - 09:32 PM, said:

View Postmarkhazlett9, on 4 Aug, 2009 - 11:18 AM, said:

Notepad++ is just a fancy text editor and does not include the javac compiler to my knowledge. You will have to compile it through the command line using javac.


I agree with this. Notepad++ is almost just the same with Windows Notepad.


It's possible !!!!
To compile and execute java class file, just install NPPExec plugin (Plugins --> Plugin Manager --> Show Plugin Manager), restart N++.
Write a simple Hello World java file and press F6. Enter the following code -->

javac "$(FULL_CURRENT_PATH)"
java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"

OK.

More information at --> http://notepad-plus....k/run-HOWTO.php

Enjoy.
Notepad++ Rocks !!!!!


Sorry for diging out this old thread but I can't run java programs in n++:

I installed the plugin, pressed F6 und inserted your code

javac "$(FULL_CURRENT_PATH)"
java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"


After that I get this error in the console:

javac "D:\Dokumente\Java\HalloWelt.java"
CreateProcess() failed with error code 2:
Das System kann die angegebene Datei nicht finden.
(translated into english like: "the system could not find the specified file")

java -classpath "D:\Dokumente\Java" "HalloWelt"
Process started >>>
java.lang.NoClassDefFoundError: HalloWelt
Caused by: java.lang.ClassNotFoundException: HalloWelt
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: HalloWelt.  Program will exit.
Exception in thread "main" <<< Process finished.
================ READY ================


What am I doing wrong?
Was This Post Helpful? 0

#10 Guest_JimmyRay*


Reputation:

Re: Compiling/Running Java Programs in Notepad++?

Posted 19 January 2011 - 10:09 PM

Should be


cd "$(CURRENT_DIRECTORY)" 
javac $(FILE_NAME)
java $(NAME_PART)



Peace
Was This Post Helpful? 1

#11 odeni  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 31-August 11

Re: Compiling/Running Java Programs in Notepad++?

Posted 31 August 2011 - 01:07 PM

View Postjavac, on 26 September 2010 - 08:19 AM, said:

Sorry for diging out this old thread but I can't run java programs in n++:

I installed the plugin, pressed F6 und inserted your code

javac "$(FULL_CURRENT_PATH)"
java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"


After that I get this error in the console

What am I doing wrong?


Add the JDK/bin directory to execution path. (Set the PATH environment variable in Windows.)

This post has been edited by odeni: 31 August 2011 - 01:09 PM

Was This Post Helpful? 0
  • +
  • -

#12 gokulforum  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 06-September 11

Re: Compiling/Running Java Programs in Notepad++?

Posted 08 September 2011 - 01:58 AM

View Postcmwise, on 07 July 2009 - 10:37 AM, said:

I'm a huge Notepad++ fan and I'm just wondering if anyone has found successful ways to compile and run java programs through Notepad++. I've found some different documentation on the subject, but none of it seems to work.

Hoping I'm posting this in the correct message board, if not... my appologies!

Thanks!

Ans: firstly u need to set path variable
copy java/bin directory path & go to envirnment variable in that system variable edit path variable & pest bin directory path click on ok..
now save note pad file with dot java extention open command prompt
type javac your file name with extention
e.g javac Myprogram.java
here u r program is compile
then type java filename without extention
e.g java Myprogram
press enter u r program is running now
Was This Post Helpful? 0
  • +
  • -

#13 musicman1234  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-January 12

Re: Compiling/Running Java Programs in Notepad++?

Posted 10 January 2012 - 04:10 PM

This is my first post on here, so here it goes.
I have Java installed and it runs fine on the command line.
When I run my code in Notepad++, it compiles fine. It gives me the *.class file.
But it will not run the code. When I press F6 and put in:

cd "$(CURRENT_DIRECTORY)"
javac $(FILE_NAME)
java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"

I get this:
CD: C:\Documents\Java
Current directory: C:\Documents\Java
javac testApp.java
Process started >>>
<<< Process finished.
java -classpath "C:\Documents\Java" "testApp"
Process started >>>
Error: could not open `C:\Program Files (x86)\Java\jre6\lib\i386\jvm.cfg'
<<< Process finished.

Note: I do not have a Java folder in my Program Files (x86) folder.
My Java folder is in my Program Files folder.
Like I said, the file runs fine on the command line but not in Notepad++.
Thank you.
Was This Post Helpful? 0
  • +
  • -

#14 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2872
  • View blog
  • Posts: 11,031
  • Joined: 15-July 08

Re: Compiling/Running Java Programs in Notepad++?

Posted 12 January 2012 - 03:50 AM

NotePad ++ likely added a different path to Java than your actual PATH variable describes. Go into the settings and point it to the proper location.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1