You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

1

Monday, October 14th 2013, 7:53pm

Using a final variable in Jabaco

Hi,

If we have a constructor in Java, which takes a final variable, as in the constructor for whatthe() with the EnvVar variable below:



public whatthe(final EnvironmentalVariable EnvVar)
{
...
...
}


, how do you call the constructor from Jabaco?

I've tried declaring and setting an EnvVar as private const, then using whatthe( EnvVar ), but the compiler complains. It says that 'whatthe' is not found with this parameter.

In Jabaco, what's the equivalent of Java final?

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

2

Monday, October 14th 2013, 10:41pm

For me it works correct.

Compiled

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public class Test {

  public static void main(String[] args) {
    System.out.println(addIt(5,7));
    System.out.println(addIt(9,14));
    System.out.println(addIt(13,4));
  }


  public static int addIt(final int a, final int b) {
    return a+b;
  }


}
and it works.
Then I packed it to a zip-file and included in the Jabaco-Classpath.

Running this

Jabaco Source

1
2
3
Public Sub Command1_Click()
   MsgBox (addIt(14,78))
End Sub
works then, too.


Quoted

public whatthe(final EnvironmentalVariable EnvVar)
{
...
...
}


I hope you have fogotten, to write
public void whatthe(final EnvironmentalVariable EnvVar) {
}

or
public int whatthe(final EnvironmentalVariable EnvVar) {
}

etc.
Otherwise it is a constructor in a class called "whatthe".

Greatings
theuserbl

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

3

Monday, October 14th 2013, 10:44pm

RE: Using a final variable in Jabaco

, how do you call the constructor from Jabaco?


Oh, it IS an constructor. Sorry, I have overread it.

Calling it like in Java:

Jabaco Source

1
Dim a As New whatthe(something)

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

4

Tuesday, October 15th 2013, 12:02am

Hmmm. Thanks theuserbl, but it's not working for me.

The actual code that I'm trying to instantiate is attached, it's part of the SetlX distribution.

In the Java sample that's provided in Setlx, there is


final PcEnvProvider envProvider = new PcEnvProvider();
final State state = new State(envProvider);


, and these work fine. But I can't seem to do the equivalent, in Jabaco. Not getting the results that you are.

Also, it's optional to use the State constructor without any parameters, and it provides a dummy environment. But if you do that in Jabaco, there's the error

java/lang/InstantiationError


What you're saying makes perfect sense, but Jabaco doesn't want to allow it, in this case.

Is there anything in the attached State.java code that pops out, as problematic?

I'll try your sample, to confirm that my version of Jabaco will be able to do the same.


Regards,


Ste.zip

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

5

Tuesday, October 15th 2013, 12:10am

Here are the kinds of things I tried, in Jabaco:


Const envProvider As PcEnvProvider = New PcEnvProvider()

Const state As org#randoom#setlx#utilities#State = New org#randoom#setlx#utilities#State(envProvider)

, making the assumption that a Jabaco Const might be the same as a Java final.

Also, tried


Const envProvider As Variant = New PcEnvProvider()
Const state As Variant = New State( envProvider )


, as well as just plain Dims. All sorts of permutations, with and without a parameter for State(). All, to no avail.

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

6

Tuesday, October 15th 2013, 2:42pm

For me, it works fine:

Jabaco Source

1
2
3
4
Public Sub Command1_Click()
   Dim envProvider As New PcEnvProvider
   Dim state1 As New org#randoom#setlx#utilities#State(envProvider)
End Sub


Greatings
theuserbl

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

7

Tuesday, October 15th 2013, 6:42pm

For me, it works fine:

Jabaco Source

1
2
3
4
Public Sub Command1_Click()
   Dim envProvider As New PcEnvProvider
   Dim state1 As New org#randoom#setlx#utilities#State(envProvider)
End Sub


Greatings
theuserbl
Still no go, on this side, even your code is reproduced letter for letter.

I'm using Beta 1.5.2.

Well, maybe it's related to my framework jar. I had to switch to a previous version, sometime back, for some problems I don't recall. The one in the ..\program files...\jabaco folder is 519,284 bytes.

Will try switching frameworks, and see what happens. Thanks, theuserbl.

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

8

Tuesday, October 15th 2013, 6:49pm

Nope, no good. After switching to the most recent framework at http://www.jabaco.org/framework.html, 01/15/2011,

there's an immediate

Baseclass 'VB'Form' not found

compilation error.


Not sure where to go from here, maybe a reinstall of Jabaco, on all the PCs.

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

9

Tuesday, October 15th 2013, 7:18pm

Nope, no good. After switching to the most recent framework at http://www.jabaco.org/framework.html, 01/15/2011,

there's an immediate

Baseclass 'VB'Form' not found

compilation error.


Not sure where to go from here, maybe a reinstall of Jabaco, on all the PCs.
Ok, I downloaded the jar that you referenced, in the July 23rd post, and tried to recompile. Same error as the original one, that

'org/randoom/setlx/utilities/State' not found with this parameters!'

( ..#State( envProvider ) )

This is a mystery, but might also be the cause for previous Jabaco issues, that were impossible to resolve.

Using Java 7.

Dani

Intermediate

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

10

Tuesday, October 15th 2013, 7:20pm

Hey there,

Jabaco.jar rev. 117, 2013/10/15

You are using a State.class in a .zip, not the source you provided in the Ste.zip right?

Dani

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

11

Tuesday, October 15th 2013, 7:41pm

Hey there,

Jabaco.jar rev. 117, 2013/10/15

You are using a State.class in a .zip, not the source you provided in the Ste.zip right?

Dani
Yes, from the setlx.jar supplied by the developer.

However, I just noticed that the State.class from the most recent library build, is earlier (07/30/2013) than the most recent State.java source (08/11/2013). Will try to obtain a more recent build, and try again, thanks Dani.

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

12

Tuesday, October 15th 2013, 8:07pm

That's it, that's the ticket. The author of setlx included the ant build.xml and associated files in the development distribution, fortunately.

After I rebuilt, everything compiled fine.

Dani and theuserbl, thanks for all the assistance. Happy camper, now.

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

13

Tuesday, October 15th 2013, 8:14pm

Still no go, on this side, even your code is reproduced letter for letter.

I'm using Beta 1.5.2.

Well, maybe it's related to my framework jar. I had to switch to a previous version, sometime back, for some problems I don't recall. The one in the ..\program files...\jabaco folder is 519,284 bytes.

Will try switching frameworks, and see what happens. Thanks, theuserbl.
I think, not the framework is the problem.

Going step by step:

  1. download Stelx. As you can read at [ http://randoom.org/Software/SetlX ] you can download it at [ http://download.randoom.org/setlX/pc/set…binary_only.zip ].
  2. After downloading it, unzip this zip file. Important are now the files setlX.jar and setlx-gfx.jar. I don't know if you really need both, the needed classes are in setlX.jar, but I used the other one, too.
  3. Now start Jabaco and select, if you want to start an SDI-Application or Console-Application.
  4. If you are now in the GUI-Designer or Code-Editor press [F1] or over the menu "Project" -> "References (Classpath)"
  5. Now click in this "Imports"-dialog on the "Add Jar-Archive..."-button
  6. Browse through your directory to the directory where the two jar-files are in and select setlX.jar. After that press the "Open"-button.
  7. Do the same with setlX-gfx.jar
  8. Now both packages are in the tree-view of the "Imports"-dialog. Now you have to select the classes, that Jabaco knows about them. The easy way: Click on the [+] before "C:\Documents and Settings\...\SetlX.jar" and "C:\Documents and Settings\...\SetlX-gfx.jar"
  9. Now under both pakcges is a "org" as directory. Mark both "org"-Checkboxes.
  10. If both checkboxes are marked press the "Close"-Button of the "Imports"-dialog
  11. Go now to the code part. Now you can use the classes. For example, if you have choosen "SDI-Application" at the beginning, you can draw in the designer a button and for the code of it you can write

    Jabaco Source

    1
    2
    3
    4
    
    Public Sub Command1_Click()
       Dim envProvider As New PcEnvProvider
       Dim state1 As New org#randoom#setlx#utilities#State(envProvider)
    End Sub
    now it should work.


Between designer-mode and code-mode you can switch on the right side of the Jabaco-window under the word "Project". The two icons standing for designer-mode and editor-mode.

Greatings
theuserbl

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

14

Wednesday, October 16th 2013, 12:44am

Theuserbl, all set on this side. Rebuilding the Setlx.jar solved the problem, thanks.

Still no go, on this side, even your code is reproduced letter for letter.

I'm using Beta 1.5.2.

Well, maybe it's related to my framework jar. I had to switch to a previous version, sometime back, for some problems I don't recall. The one in the ..\program files...\jabaco folder is 519,284 bytes.

Will try switching frameworks, and see what happens. Thanks, theuserbl.
I think, not the framework is the problem.

Going step by step:

  1. download Stelx. As you can read at [ http://randoom.org/Software/SetlX ] you can download it at [ http://download.randoom.org/setlX/pc/set…binary_only.zip ].
  2. After downloading it, unzip this zip file. Important are now the files setlX.jar and setlx-gfx.jar. I don't know if you really need both, the needed classes are in setlX.jar, but I used the other one, too.
  3. Now start Jabaco and select, if you want to start an SDI-Application or Console-Application.
  4. If you are now in the GUI-Designer or Code-Editor press [F1] or over the menu "Project" -> "References (Classpath)"
  5. Now click in this "Imports"-dialog on the "Add Jar-Archive..."-button
  6. Browse through your directory to the directory where the two jar-files are in and select setlX.jar. After that press the "Open"-button.
  7. Do the same with setlX-gfx.jar
  8. Now both packages are in the tree-view of the "Imports"-dialog. Now you have to select the classes, that Jabaco knows about them. The easy way: Click on the [+] before "C:\Documents and Settings\...\SetlX.jar" and "C:\Documents and Settings\...\SetlX-gfx.jar"
  9. Now under both pakcges is a "org" as directory. Mark both "org"-Checkboxes.
  10. If both checkboxes are marked press the "Close"-Button of the "Imports"-dialog
  11. Go now to the code part. Now you can use the classes. For example, if you have choosen "SDI-Application" at the beginning, you can draw in the designer a button and for the code of it you can write

    Jabaco Source

    1
    2
    3
    4
    
    Public Sub Command1_Click()
       Dim envProvider As New PcEnvProvider
       Dim state1 As New org#randoom#setlx#utilities#State(envProvider)
    End Sub
    now it should work.


Between designer-mode and code-mode you can switch on the right side of the Jabaco-window under the word "Project". The two icons standing for designer-mode and editor-mode.

Greatings
theuserbl

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

15

Wednesday, October 16th 2013, 2:45pm

By the way, if anyone is interested in using Setlx in a Jabaco application, it's as simple as the statements we discussed in this thread:


Const envProvider As PcEnvProvider = New PcEnvProvider()
Const state As State = New State( envProvider )


, and to evaluate valid Setlx statements,
...
...
Dim expr As Expr

...
...

expr = ParseSetlX.parseStringToExpr( state, sXsetlInput )
sOutput = expr.eval( state )

Where sXsetlInput is a Setlx statement (without the semicolon at the end), and sOutput contains the result of the evaluation.

Rate this thread
WoltLab Burning Board