1

I have a spring app, and I want to test some services that I created in a simple java console application.

I currently just have a class that has a main that I run using IntelliJ, but I want to move this out to a java main console project, but I need to get the compiled output of my spring application referenced into my console project.

How can I do this?

Does java have the concept of debug mode compilation and release or is it always the same?

codecompleting
  • 9,251
  • 13
  • 61
  • 102

1 Answers1

1

Normally, in IntelliJ, you just setup two modules with a dependency to solve things like this. In this case make the Console module depend on the Spring module (in Project Structure).

If you want them more loosely coupled you could make two IntelliJ project and create a jar with the Spring classes then use that jar in the Console project.

The second question (about debug mode): yes you can set debug mode see javac -help

C:\jdk>javac -help
Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  ...

If you ask this question you should probably have debugging info on, which I think is default in IntelliJ, check in Java complier settings Generate debugging info. For more info on what it means see Is there a performance difference between Javac debug on and off?

Community
  • 1
  • 1
osundblad
  • 2,675
  • 1
  • 29
  • 34