user1907849
user1907849

Reputation: 980

Setting JAVA_OPTS in windows using command prompt

I am running the java program on windows server 2012, I want to set the JAVA_OPTS variable and use it, here is how I am doing it:

Open a command prompt in the bin of jdk where it is installed ,and executing the following command :

$set JAVA_OPTS = “-Xdebug , server=y”

Then in the next line in the command prompt only , when I try to run

$java $JAVA_OPTS –cp .Server

(where Server is the name of the java program), I get an error saying that: Could not find or load assembly $JAVA_OPTS. Please let me know what mistake I am doing here. I am not using IDE for this purpose.

Upvotes: 1

Views: 20627

Answers (2)

Jens
Jens

Reputation: 69439

on windows you have to set the variable like:

set JAVA_OPTS = “-Xdebug , server=y”

and use it this way

java %JAVA_OPTS% –cp .Server

Upvotes: 3

Khanna111
Khanna111

Reputation: 3913

Windows uses "%JAVA_OPTS% rather than "$JAVA_OPTS" which is UNIX/LINUX. You can check if the environment is updated with JAVA_OPTS by echoing that: echo %JAVA_OPTS%.

Upvotes: 2

Related Questions