Author Topic: Compiling a example ?  (Read 3894 times)

Offline gokernel

  • byte
  • *
  • Posts: 5
    • View Profile
Compiling a example ?
« on: March 27, 2012, 03:35:05 am »
Hello people, first congratulations for the engine !!!

01 - Which the full command should I use to build a small example?
02 - Which link to the source code of the engine?

I am Brazilian and sorry my English;D

gokernel.

Offline zammbi

  • float
  • ****
  • Posts: 361
    • View Profile
Re: Compiling a example ?
« Reply #1 on: March 27, 2012, 03:48:42 am »
Quote
01 - Which the full command should I use to build a small example?
Not quite sure what you mean by "full command"? You using eclipse IDE right?

Quote
02 - Which link to the source code of the engine?
The engine isn't open sourced and from what I've read, it won't be until EgonOlsen has had enough of JPCT.


Offline gokernel

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Compiling a example ?
« Reply #2 on: March 27, 2012, 03:59:14 am »
@zammbi:
"Not quite sure what you mean by "full command"? You using eclipse IDE right?"

Hi !

I'm not using eclipse ... in general for compile i use:
----------------------------------------------------------------
javac program.java ...
----------------------------------------------------------------

I need to know how to complement this command.

gokernel.


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Compiling a example ?
« Reply #3 on: March 27, 2012, 07:48:47 am »
You have to add -classpath <yourpath>/jpct.jar;<yourotherpath>lwjgl.jar or similar, i.e. you have to include at least the jpct.jar (and the lwjgl.jar as well if you are using parts of it) to the classpath of your javac call.

Offline gokernel

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Compiling a example ?
« Reply #4 on: March 27, 2012, 11:53:22 am »
Thanks for help !!!!

Command to compile:
----------------------------------------------------------------------------
javac HelloWorldOGL.java -classpath d:\temp\java\jpct\lib\jpct\jpct.jar;d:\temp\java\jpct\lib\lwjgl-2.8.0\jar\lwjgl.jar;d:\temp\java\jpct\lib\lwjgl-2.8.0\jar\lwjgl_util.jar
----------------------------------------------------------------------------

Command to execute:
----------------------------------------------------------------------------
java -Djava.library.path=d:\temp\java\lib\lwjgl-2.8.0\native\windows -Xmx128m -classpath d:\temp\java\jpct\lib\jpct\jpct.jar;d:\temp\java\jpct\lib\lwjgl-2.8.0\jar\lwjgl.jar;d:\temp\java\lib\lwjgl-2.8.0\jar\lwjgl_util.jar HelloWorldOGL
----------------------------------------------------------------------------

ERRO ON EXECUTE IN PORTUGUES: ;)
----------------------------------------------------------------------------
Erro: NÒo foi possİvel localizar nem carregar a classe principal HelloWorldOGL
----------------------------------------------------------------------------
TRANSLATED:
Error: Could not find or load the main class HelloWorldOGL
----------------------------------------------------------------------------

----------------------------------------------------------------------------
Code: [Select]
import com.threed.jpct.*;

/**
 * A simple HelloWorld using the OpenGL-renderer.
 * @author EgonOlsen
 *
 */
public class HelloWorldOGL {

    private World world;
    private FrameBuffer buffer;
    private Object3D box;

    public static void main(String[] args) throws Exception {
        new HelloWorldOGL().loop();
    }

    public HelloWorldOGL() throws Exception {
        world = new World();
        world.setAmbientLight(0, 255, 0);
    }

    private void loop() throws Exception {
        buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);

        Thread.sleep(1000);

        buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.dispose();
System.exit(0);
    }
}
----------------------------------------------------------------------------


Info about the Java Version:
----------------------------------------------------------------------------
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
Java HotSpot(TM) Client VM (build 22.1-b02, mixed mode, sharing)
----------------------------------------------------------------------------


Offline gokernel

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Compiling a example ?
« Reply #5 on: March 27, 2012, 05:24:15 pm »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Compiling a example ?
« Reply #6 on: March 27, 2012, 05:38:12 pm »
No. And i don't see the point of it...this isn't related to any API. It's just about how to use Java on the command line. Any tutorial that explains this will do...in your case, it can't find the class because it's not in your classpath. Just add the directory that contains your class file/package to the classpath.

Offline brunotrodrigues

  • byte
  • *
  • Posts: 20
    • View Profile
Re: Compiling a example ?
« Reply #7 on: April 03, 2012, 07:49:45 pm »
Egon is right, this is not a problem related to jPCT.
Let's see if I understand: you can compile it, but can't execute it, right?
Are you sure the main class is in the right directory? Your command line seems to be ok, so you shoud check your file structure.

Offline gokernel

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Compiling a example ?
« Reply #8 on: April 05, 2012, 09:16:56 pm »

Hello people, thanks to everyone for the help !!!

After several attempts was finally compiled and executed successfully.

RESOLVED \o/.

Im my directory ( c:\temp\JAVA\jpct ) type:

COMPILING - ( compile.bat ) :
-------------------------------------------------------------------------------
javac -cp ".;lib\jpct\jpct.jar;lib\lwjgl-2.8.0\jar\lwjgl.jar;lib\lwjgl-2.8.0\jar\lwjgl_util.jar" Hello.java
-------------------------------------------------------------------------------

RUNNING - ( run.bat ) :
-------------------------------------------------------------------------------
java -cp ".;lib\jpct\jpct.jar;lib\lwjgl-2.8.0\jar\lwjgl.jar;lib\lwjgl-2.8.0\jar\lwjgl_util.jar" -Djava.library.path=lib/lwjgl-2.8.0/native/windows Hello
-------------------------------------------------------------------------------

Peace, health and success ... for all .

gokernel - gokernel@hotmail.com