B4J Question Compiling of the same subroutine in two different projects fail in one!

johnerikson

Active Member
Licensed User
Longtime User
The following code can be compiled successfully in a small project but fail in a major, with B4J 3.71! However, I have tried to load the same lib in both projects with bad results!

Sub DecreseImage
Dim im As Image
im.Initialize("E:\Server\AppServer\Objects\www\dataloader","2015.jpg")'
Dim can As Canvas
can.Initialize("")
Dim jo As JavaObject
jo=can
jo.RunMethod("setWidth",Array(1000.0))
jo.runmethod("setHeight",Array(800.0))
can.DrawImage(im,0.0, 0.0, 400.0, 300.0)
Dim out As OutputStream = File.OpenOutput("E:\Server\AppServer\Objects\www\dataloader", "2015Grab.jpg", True)
can.snapshot.WriteToStream(out)
out.Close
End Sub

Following error in major project:

B4J version: 3.71
Parsing code. (0.06s)
Compiling code. (1.16s)
Compiling layouts code. (0.01s)
Compiling generated Java code. Error
B4J line: 195
jo=can
javac 1.7.0_40
src\b4j\example\main.java:419: error: cannot access Canvas
_jo.setObject((java.lang.Object)(_can.getObject()));
^
class file for javafx.scene.canvas.Canvas not found

.........and like this in the other .................

B4J version: 3.71
Parsing code. (0.00s)
Compiling code. (0.05s)
Compiling layouts code. (0.00s)
Compiling generated Java code. (0.34s)
Compiling debugger engine code. (0.26s)
Running application. (0.00s)
Completed successfully.

Any comments about that?
 

Roycefer

Well-Known Member
Licensed User
Longtime User
Is your major project a non-UI/server project? You don't have access to the fx Object in non-UI/server programs. That means all UI elements and several other capabilities are off-limits (Image class, Canvas, fx's built-in clipboard utilities, etc...).
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
Thanks for rapid answer!
Japp, its the problem, the major project is a Non-UI application but not the other!
Do think it's possible to resize images and save as file in some other way on a Non-UI application?
 
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
You could probably use inline Java to use the java.awt.image package and its associated classes and methods. You might also check through the B4J libraries. Someone might have made a library useful for your purposes, though I don't recall one off-hand.

If you can't find a library that does what you want and you're out of your depth using inline Java, let me know what capabilities you want and I might add them to my jAWTRobot library. That library has already grown out of control. I might as well add some of AWT's image manipulation stuff to it.
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
Briefly about my project

I work with a comprehensive concept for managing photos, positions, and text from your mobile phone. Own camera function integrated with GoogleMap, GPS and administration for categorization and text attached to pictures. The information is automatically sent to a server (in database) when the mobile phone is connected to the Internet. In a WEB Server app can then the information be visualized after the user's choice.

In the context of work with editing features, I need to show greater amounts of images on the web-site, why I want to reduce the image size. I had considered that it was a simple thing like in B4A. In future I certainly need more image manipulations.

I have searched among B4J librarys but have not found requested features and I have no experience with Java development!

It leads to questions and wishes......

Is it possible to start or call a B4J UI - application for running features that don't need UI (IO)?
Is it possible to start or call to .exe or .dll. (.net)?

if any of the above two questions is possible is the current and future all problems resolved.

Otherwise, to resolve the urgent with resize of images, one can only hope a library –functions that you mentioned.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top