• Post Reply Bookmark Topic Watch Topic
  • New Topic

Could not create Java Virtual Machine  RSS feed

 
Zach Christian
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am attempting to execute a beginner's program and I get this error every time:

Could not create Java Virtual Machine
A fatal exception has occurred

What do I need to do to remedy this?

Thank you for your help.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What - EXACTLY - are you doing to get this error? What have you done?
 
Zach Christian
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:What - EXACTLY - are you doing to get this error? What have you done?


I have [tried]running a java program I created in cmd. Directory of my source code: C:\Users\Me\Documents\Party.java

I am just typing javac Party.java then java -classpath.Party

here's the code:


 
Tina Smith
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you've got some issues with the command to run java.

Should be(note the spaces)
java -classpath . Party

or just
java Party

Of course you're going to get a different error when you try that. You need to add a main method to your program, otherwise Java has no idea where to start. The main method can be something like this.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!