0

I have a JavaEE Dynamic WEB project developed in Eclipse.

When I edit java classes via Eclipse and then launch an 'mvn package' in terminal to create the war file, everything goes fine.

When I modify the java class in exactely the same way but with vim in terminal and launch the 'mvn command' an error is returned when compiling the project:

org.apache.maven.lifecycle.LifecycleExecutionException: Fatal error compiling
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
    at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:683)
    at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    ... 17 more
Caused by: org.codehaus.plexus.compiler.CompilerException: tools.jar not found: /usr/lib/jvm/java-7-openjdk-i386/jre/../lib/tools.jar
    at org.codehaus.plexus.compiler.javac.JavacCompiler.createJavacClass(JavacCompiler.java:987)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.getJavacClass(JavacCompiler.java:944)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:520)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:167)
    at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:678)
    ... 20 more

Which operations are performed by Eclipse when source is modified that I don't perform when modifying the code via vim?

sthor69
  • 638
  • 1
  • 10
  • 25
  • That's correct. Shame on me! A simple 'export JAVA_HOME' pointing to the jdk solved the issue. If you answer my question I'll accept it. Thanks! – sthor69 Dec 22 '15 at 10:49

1 Answers1

0

It's not an editor issue.

When you run Maven your environment settings are picking up two different instances of Java. The error message indicates you're using a JRE and not a JDK, explaining why the code won't compile. See:

Community
  • 1
  • 1
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185