I put jdbc driver. Put it in the java folder in Program Files. I specified the path to the file in the classpath. It leaves ClassNotFoundExeption . I try to start with -cp C:\Program Files\Java\postgresql-42.2.5.jar , also -cp C:\Program Files\Java\postgresql-42.2.5.jar an exception. I launch through IntelliJ, -cp specified in> Edit Configuration > Program Arguments
|
1 answer
I suspect that you have the path to the file, but without the name of the file itself
java -cp .;"C:\Program Files\Java\postgresql-42.2.5.jar" com.example.MyApp And it's not a good idea to put the jdbc driver in Program Files.
- With the file name. But without com.example.MyApp. Is this command to run through cmd, or is it to point to IntelliJ in Program Arguments? - Anton Sorokin
- Updated the question, it is written about -cp - Anton Sorokin
- Try running via cmd. If the command line works, then the problem is in the IDE and you should carefully study the instructions or contact their support service. - Sergey Gornostaev
- Yes. When you run through cmd everything turned out. But why didn't the classpath work? - Anton Sorokin
- one@AntonSorokin that you pollute the system environment. Each project should have its own environment with isolated dependencies in it. - Sergey Gornostaev
|
jarand stackraces - GVArt