Reputation: 311
I received this isue: com.sun.tools.javac.Main is not on the classpath. Oerhaps JAVA_HOME does not point to the JDK. It is currently set to "C:\Program Files\Java\jre7
"
However, my JAVA HOME is set as follows:
C:\Program Files\Java\jdk1.7.0_51
With PATH
C:\Program Files\Java\jdk1.7.0_51
Any recommendations?
Upvotes: 0
Views: 2567
Reputation: 13577
Just uninstall node js and re install node js. Its solve my problem.
Upvotes: 1
Reputation: 13485
When node.js spawns a forked environment, it doesn't copy over your user's environment variables. You will need to do that manually.
You will need to get JAVA_HOME from process.env and set it in your exec() call. Something like this should work:
var config = {
env: process.env
};
exec('javacmd', config,
function() {
console.log(arguments);
});
Or if you wanted to be more explicit, you could extract only the variables you needed (JAVA_HOME
, etc) from process.env
See here for more details:
How to exec in NodeJS using the user's environment?
Upvotes: 1