aspose file tools*
The moose likes Beginning Java and the fly likes error in running first java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "error in running first java code" Watch "error in running first java code" New topic
Author

error in running first java code

Mirin Ghosh
Greenhorn

Joined: Jul 30, 2008
Posts: 3
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

Joined: Mar 24, 2008
Posts: 3838

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.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Matteo Di Furia
Ranch Hand

Joined: Jun 20, 2008
Posts: 102
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

Joined: Jul 30, 2008
Posts: 3
where should i give this command:
java -version

ihave tried with

java -classpath but giving the same error.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

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

Joined: Jul 30, 2008
Posts: 3
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

Joined: Oct 27, 2005
Posts: 19722
    
  20

I suggest reinstalling the JRE.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error in running first java code