unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, math;
function isNarcissistic(num: integer): boolean;
function ProperDivisors(num: integer): integer;
function UglyNumber(num: integer): boolean;
implementation
function isNarcissistic(num: integer): boolean;
var
k, n, sum: integer;
begin
if num <= 0 then result:= false
else begin
k:= trunc(log10(num)) + 1;
n:= num;
sum:= 0;
while n > 0 do
begin
sum:= sum + trunc(intpower(n mod 10, k));
n:= n div 10;
end;
result:= sum = num;
end;
end;
function ProperDivisors(num: integer): integer;
var
i: integer;
begin
result:= 0;
if num <= 0 then result:= -1
else if num = 1 then result:= 0
else for i:= 1 to num div 2 do if num mod i = 0 then result:= result + i;
end;
function UglyNumber(num: integer): boolean;
begin
result:= true;
if num <= 0 then result:= false
else begin
while num <> 1 do
begin
if num mod 2 = 0 then num:= num div 2
else if num mod 3 = 0 then num:= num div 3
else if num mod 5 = 0 then num:= num div 5
else begin
result:= false;
break;
end;
end;
end;
end;
end.
pas2jni unit1 -UC:\Users\Pc\Downloads\Lazarus;C:\lazarus\fpc\3.0.4\units\x86_64-win64\*
pas2jni Unit1 -UC:\Users\Pc\Downloads\Lazarus;C:\lazarus\fpc\3.0.4\units\x86_64-win64\*
pas2jni unit1 -UC:\Users\Pc\Downloads\Lazarus;C:\lazarus\fpc\3.0.4\units\x86_64-win64\rtl
pas2jni Unit1 -UC:\Users\Pc\Downloads\Lazarus;C:\lazarus\fpc\3.0.4\units\x86_64-win64\rtl
fpc unit1jni.pas successful with no errors
Both above give the same result. Error when run javac system.java and javac unit1.java
If I use the eclipse ecj compiler which allow compilation of source files have errors and pack it using jar tool:
jar -cvf pas.jar system.class unit1.class
it will give me a pas.jar file which later I could add to my Java project and it will compile and run flawlessly.
Please help. I have to use javac, not ecj