How to compile java with external libraries in notepad ++?

I am using Notepad ++ to learn Java. I put it to compile and run Java from the Run menu, only that I am coding small exercises without external libraries, I know what I should use -classpathto tell the compiler which library to use, but I was wondering if there is any way tell the compiler to “use” the libraries in the lib directory of my current project.

Thank.

+3
source share
2 answers

It turns out, you can put any jar file in the ext folder ( C:\Program Files\java\jdk1.6.0_21\jre\lib\extand C:\Program Files\java\jre6\lib\ext), and java will automatically consider it as part of the class path, check: ext directory: Java Glossary

Dirty, but he does what I need.

+3
source

This is only possible with the IDE (Netbeans, Eclipse, etc.).

On the command line, you must define jar exactly using jar dependencies in the -classpath option.

Note: there is a -classpath directory. It will add to your class the path to the classes and files (e.g. conf) of this directory, but it will not magically add the contents of the jar to the class path.

, java- , ( ) .

- ( ). , "java (c) -cp $CLASSPATH MyProgram"

+1

Source: https://habr.com/ru/post/1757010/


All Articles