Results 1 to 7 of 7

Thread: How to use Oxygene for Java Command Line?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    How to use Oxygene for Java Command Line?

    Hi all,
    I am having trouble using the Oxygene for Java Command Line to compile a very simple Java project:
    Code:
    unit Mandelbrot;
    
    interface 
    
    type 
      ConsoleApp = class 
      public 
        class method Main(args: array of string);
      end; 
    
    implementation
    
    class method ConsoleApp.Main(args: array of string);
    const  
      cols = 78; 
      lines = 30; 
      chars = " .,:;=|iI+hHOE#$-"; 
      maxIter = Length(chars); 
    begin 
      var minRe := -2.0; 
      var maxRe := 1.0; 
      var minIm := -1.0; 
      var maxIm := 1.0; 
      var im := minIm; 
      while im <= maxIm do 
      begin
        var re := minRe; 
        while re <= maxRe do
        begin
          var zr := re; 
          var zi := im; 
          var n: Integer := -1; 
          while n < maxIter-1 do 
          begin
            Inc(n); 
            var a := zr * zr;  
            var b := zi * zi; 
            if a + b > 4.0 then 
              Break; 
            zi := 2 * zr * zi + im; 
            zr := a - b + re; 
          end; 
          system.out.print(chars.charAt(n)); 
          re := re + ((maxRe - minRe) / cols); 
        end; 
        system.out.println; 
        im := im + ((maxIm - minIm) / lines) 
      end; 
      //Press ENTER to continue 
      //system.out.println("Press ENTER to exit"); 
      system.in.read(); 
    end; 
    
    end.
    I got the code from here:
    http://blog.blong.com/2011/06/projec...lbrot-set.html

    I did this:

    I saved the code to a "Mandelbrot.pas" file.
    I created a compile.bat script (compile.bat):
    Code:
    Oxygene.exe "Mandelbrot.pas" -rebuild
    Pause
    I then opened the Oxygene for Java command line dos prompt and navigated to the folder containing the project .pas and .bat files.



    Any ideas?
    cheers,
    Paul
    Last edited by paul_nicholls; 12-04-2012 at 03:26 AM.

  2. #2
    I believe you should use namespace instead of unit.

    Regarding the System object I believe it should be available as default but otherwise it exists in the java.lang namespace.

    Unfortunately I'm not at my own computer right now, so I can't test the code myself.
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  3. #3
    You were right pstudio...I had to change the code:

    Code:
    namespace pgd_test;
    
    interface 
    
    
    type 
      ConsoleApp = class 
      public 
        class method Main(args: array of String);
      end; 
    
    
    implementation
    
    
    class method ConsoleApp.Main(args: array of String);
    const  
      cols = 78; 
      lines = 30; 
      chars = " .,:;=|iI+hHOE#$-"; 
      maxIter = length(chars); 
    begin 
      var minRe := -2.0; 
      var maxRe := 1.0; 
      var minIm := -1.0; 
      var maxIm := 1.0; 
      var im := minIm; 
      while im <= maxIm do 
      begin
        var re := minRe; 
        while re <= maxRe do
        begin
          var zr := re; 
          var zi := im; 
          var n: Integer := -1; 
          while n < maxIter-1 do 
          begin
            inc(n); 
            var a := zr * zr;  
            var b := zi * zi; 
            if a + b > 4.0 then 
              Break; 
            zi := 2 * zr * zi + im; 
            zr := a - b + re; 
          end; 
          System.out.print(chars.charAt(n)); 
          re := re + ((maxRe - minRe) / cols); 
        end; 
        System.out.println; 
        im := im + ((maxIm - minIm) / lines) 
      end; 
      //Press ENTER to continue 
      //system.out.println("Press ENTER to exit"); 
      System.in.read(); 
    end; 
    
    
    end.

  4. #4
    Ok, I was able to compile the above file in the Oxygene IDE, but not via the command line version...it still can't find the system.in or system.out

    I must be missing some parameters...

    Well, at least my Oxygene IDE is working now
    I would still like to see if I can get it working via command line though

  5. #5
    If it works trough IDE and not trough command line then it is big posibility that when using command line you don't specify proper folder locations for all necessary libraries. You should check wch parameters are usied when the project is being compiled by IDE.

  6. #6
    Quote Originally Posted by SilverWarior View Post
    If it works trough IDE and not trough command line then it is big posibility that when using command line you don't specify proper folder locations for all necessary libraries. You should check wch parameters are usied when the project is being compiled by IDE.
    Yeah you are probably right - I'm not sure what parameters here:
    http://wiki.oxygenelanguage.com/en/Oxygene.exe

    equate to the .oxygene file values though.

    Anyway, I think I will leave it for now and just use the IDE.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •