Compiling a example ?

Started by gokernel, March 27, 2012, 03:35:05 AM

Previous topic - Next topic

gokernel

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.

zammbi

Quote01 - 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?

Quote02 - 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.


gokernel

@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.


EgonOlsen

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.

gokernel

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
----------------------------------------------------------------------------

----------------------------------------------------------------------------

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)
----------------------------------------------------------------------------



EgonOlsen

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.

brunotrodrigues

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.

gokernel


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