user308485
user308485

Reputation: 634

Program compiles fine in javac but not in IntelliJ

I am trying to test a java library I found online. I'm testing each component separately, and they work correctly on the command line when I do javac *.java followed by java test. This works perfectly fine, but if I try to build the same test.java file in IntelliJ 2017, it seems to build other irrelevant source files also present in the project and fails since they require dependencies that are not present (but I just want to compile and run test.java.)

How can I resolve this?

Upvotes: 0

Views: 120

Answers (1)

skomisa
skomisa

Reputation: 17363

I don't know anything about the library you are using, so this may or may not work for you...

  • In the Project panel of Intellij IDEA select the class of the *.java file you want to compile/run.
  • Right-click, and on the popup menu you should see a couple of entries that look something like this:
    1. Recompile 'Test.java' (That entry may or may not be present.)
    2. Run 'Test.main()' (That entry will be present as long as you have a main() method.)

See the screen shot below for clarification.

Do you see similar entries?...

  • If so, what happens when you select them?
  • If not, please update the OP with more information on the error you are getting.

enter image description here

Upvotes: 1

Related Questions