Unrecognized option: - Failed to create Java virtual machine

I am trying to run my .jar file on a linux server.

These are im running commands

JAVA_HOME=/app/local/opt/jdk/packages/jdk1.6.0_30/ export PATH=$JAVA_HOME/bin:$PATH cd folder nohup java -jar program.jar & 

When I worked on Friday, it worked perfectly. However today i get

  Unrecognised option: - Could not create the Java virtual machine. 

In my nohup.out

If I run java -v after setting the path, I get the same problem. Can anyone suggest something? really confused about this.

Thanks for any help on this.

+7
source share
3 answers

Usually, when we get such an exception ("Unrecognized option" that raises "Failed to create the Java virtual machine"), the JVM displays an unrecognized option, for example:

 Unrecognised option: -[option details] Could not create the Java virtual machine. 

the fact that you have no data, it seems that you just have a space ("") in your team.

Look again to be sure.

+6
source

First of all, there is no -v command in the java command.

(Link: http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html ... Java version 6 ... 'Because this is what you use. Try java -help for a short list of options.)

Thus, it is expected that java -v will fail.

As an experiment, I tried this (from the OpenJDK Java 8 JDK on Fedora 22):

 $ java -foop Unrecognized option: -foop Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. $ 

As you can see, the message “unrecognized option” tells me which option he does not understand. Looking at the message in your question, we see that he says that it is "-". This does not look like the command line in your question, but on the other hand, there are no invalid parameters on the command line of your question.

Another possibility, I think, is that you have a java shell alias. This will take precedence over any commands in the shell path.

Another thing is that you are using an ancient version of Java. Java 6 has passed the end of its life, and the latest publicly released version is update 45. You have launched update 30, released in December 2011. Since then there have been many security settings. I would recommend switching to Java 8 ... and making sure you are updating it.

+1
source

I have this error when running maven on Win10, where pom.xml is located in a folder named C:\dir\OneDrive - bar\workspace\project .

Moving the project to another folder solved it.

0
source

Source: https://habr.com/ru/post/954923/


All Articles