B4J Question b4j doing nothing in release mode

kostefar

Active Member
Licensed User
Longtime User
Dear All,

At the moment, what I´m doing works fine in debug mode where it writes and reads to/from file, and logs with the log command in the b4j log window.
But as soon as I go to release mode - which I need cause I´m gonna add some gui things to it later - none of the above, nor anything else happens.
I´ve tried to start a new project where I made sure that it´s a GUI application I´m working on, but this did not help.

I was told by someone to read this thread:

https://www.b4x.com/android/forum/threads/non-ui-applications.34657/

But I´m not sure which part is answering my question.

This is prolly bigtime b4j beginners stuff, so please bear with me - it´s b4a I´m normally using

Any ideas?
 

Cableguy

Expert
Licensed User
Longtime User
Are you creating an UI or NON-UI app? (console = NON-UI)
 
Upvote 0

kostefar

Active Member
Licensed User
Longtime User
1) maybe you're not loading a layout/attach nodes on Appstart?
2) If you attach the code it will be more easy to answer what's the problem

Ok, quick example. The below works only in debug mode:

B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
Log ("yo")
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Check that you have you JRE updated, sometimes the JDK that the IDE uses does not match the JRE registered in the computer.

for better understanding of what is happening open a CMD, locate your jar and run:

java -jar myjar.jar

it will give you a detailed reason of why your app is not starting
 
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
You're not loading any layout, so there'a nothing to show

B4X:
 'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
uncomment this one

Have you created any layout on Designer view ?

Edit: is the log that doesn't show ? Test to move Log before the mainform show
 
Upvote 0

kostefar

Active Member
Licensed User
Longtime User

Should it even work in debug mode if there´s such a problem?
I´m gonna do what you suggested and will get back.
Also, can I not run UI apps in debug mode? Just wondering.
 
Last edited:
Upvote 0

kostefar

Active Member
Licensed User
Longtime User

Nope, Release mode does not do anything regardless of whether if I even do this:

B4X:
'MainForm = Form1
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    Log ("yo")
    'MainForm.Show
 
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
Strange,works here

Look for Enrique suggestion (see what's configured on Tools --> Configure Paths )



Otherwise, try to create a new UI project from scratch and test again this code
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User

the jar file is in the objects folder of your project, only when you compile in release. if you compile in debug there will be no jar file.

You can check the registered JRE version with:

java -version

if this is different from your javac version, that may cause the problem
 
Upvote 0

kostefar

Active Member
Licensed User
Longtime User
Ok, I figured out where the jar was, and if running from cmd prompt, it shows "yo" as it should.

Here´s my path, 32-bit btw:

 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
I can duplicate your problem 'Only if' I use LogDebug("yo") instead of Log("yo")
in which case in release it logs nothing in the ide, but in debug, it will log the message.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Have you downloaded the latest version of B4j? Last release is currently 5.90
 
Upvote 0

kostefar

Active Member
Licensed User
Longtime User
Guys, I figured it out! It´s my Comodo security software that auto contains the app when in release mode, running it virtually, somehow prevending it from doing what it should!
Thanks for all your guidance
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…