• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error in running first java code

 
Mirin Ghosh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i am getting this error

C:\FirstJava>java hello
Error: could not open `C:\Program Files\Java\j2re1.4.2_18\lib\i386\jvm.cfg'

I have checked hello.class has been created under the folder "FirstJava"
One more thing:In my file structure it is "\Java\j2sdk1.4.2_18" not the one mention in the error.ie,"\Java\j2re1.4.2_18"
Please help me....
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try "java -version" in the command prompt. It should display the version of the your JAVA Installation. Check you have installed the Java Runtime Environment also.

Hope this helps.

Regards.
 
Matteo Di Furia
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you've java executable in your PATH system variable.
When you're done, launch it like



This way should run
 
Mirin Ghosh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where should i give this command:
java -version

ihave tried with

java -classpath but giving the same error.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where should i give this command:
java -version


I mentioned earlier in the command prompt(where you compile/run the java code/class).
 
Mirin Ghosh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After giving this command:

C:\Program Files\Java\j2sdk1.4.2_18\bin>java -version
java version "1.4.2_18"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_18-b06)
Java HotSpot(TM) Client VM (build 1.4.2_18-b06, mixed mode)

i am getting this.
 
Rob Spoor
Sheriff
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest reinstalling the JRE.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic