Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

sample physics java prog  RSS feed

 
daniel java
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I'm a beginner. I just bought the book, Physics for game programmers, but I don't know how to run the sample java progs.

They are named gravityGame.java and in the readMe.txt file it reads:
Compile commands

javac gravityGame.java

please help,
dj

(THERE IS A FOLLOW UP TO THIS QUESTION FARTHER DOWN PLEASE TAKE A LOOK)
[ June 27, 2005: Message edited by: daniel java ]
[ June 28, 2005: Message edited by: daniel java ]
 
Suresh Naidu
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
follow this link.
It explains about basic steps.
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html
U can refer to the same tutorial if u still have any doubts.
Bye
Suresh
[ June 27, 2005: Message edited by: suresh yerramsetti ]
 
Abdulla Mamuwala
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daniel, you need to install the JRE(Java Runtime Environment) on your machine. Than you need to set up the classpath.

Than from the command prompt use the following command, to compile the gravityGame source code,

javac gravityGame.java

The above commands creates a .class file. now execute your program using the following command

java gravityGame

I think you need to read the basics of how to install the JRE and how to set up the classpath. I suggest you refer to some tutorial online which provides the required information. I just gave you a brief idea as to what is to be done.
 
daniel java
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Suresh

dj
 
daniel java
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you abdulla
 
Nigel Browne
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not wanting to rain on your parade, but I think you should spend some time understanding the basics of java before jumping into a games pyshics book. The Java Tutorial is a good place to begin, Thinking in java is also a good book which you can download for free.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the book is about physics as they apply to games programming, it just happens to have examples in Java (but isn't a book for programming games in Java).
I've advanced concept books with examples in Python and C++ (among others), languages I'm not (longer) fluent in.
If the book doesn't explain how to set up a Java environment to get the examples running, that's a small oversight but at least the OP figured out where to go to find answers rather than giving up
 
daniel java
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeroen is right. The book is about Physics and the examples are in java c and c#. The java samples just happen to have a GUI interface which makes understanding physics a little more intuitive.

Now if I could only make the command javac work. I've added it to my path variables but when I call the command I keep getting this message: javac is not recognized as an internal or external command, operable program or batch file.

I tried an explicit call with a fully qualified path name to javac.exe but I get : The system cannot find the path specified.

Does anyone know what could be going wrong?

DJ
[ June 28, 2005: Message edited by: daniel java ]
 
daniel java
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally got it to work by chdir using "Program*" instead of "ProgramFiles". Some of the source code is generating errors when I try to compile. The book would be alot better if the examples came already compiled and ready for viewing. Other than that, the book does its job for a beginner like me.

DJ
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!