i run my program using maven with the following command:
mvn exec:java -Dexec.mainClass="some.path.to.my.class"
on a Linux multi-cpu server. when i check the CPU usage, i see that java eats only 1 CPU core.
i read somewhere that setting the -server
parameter could help.
what parameters do i have to set and how can i pass them using the mvn exec:java
command?
You would set it in the commandlineArgs section of the configuration in your pom, as described in the documentation
eg:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>maven</executable>
<commandlineArgs>-server</commandlineArgs>
</configuration>
</plugin>
</plugins>
Although I'm not at all sure this is your problem - have you definitely written multithreaded code? You don't need to run the JVM in server mode to use multiple threads.