codeapp icon indicating copy to clipboard operation
codeapp copied to clipboard

For multi-file programs, use javac command in the terminal to compile manually.

Open MTraveller opened this issue 1 year ago • 11 comments

          For multi-file programs, use javac command in the terminal to compile manually.

Originally posted by @bummoblizard in https://github.com/thebaselab/codeapp/issues/1028#issuecomment-1976423228

This still does not work, not even using javac. Tried everything at this point, please fix this.

MTraveller avatar May 03 '24 13:05 MTraveller

Thanks for reminding me. I will fix this as soon as possible.

bummoblizard avatar May 03 '24 13:05 bummoblizard

This will be fixed in 1.7.2, which is expected to release in a couple days.

bummoblizard avatar May 03 '24 14:05 bummoblizard

Thanks looking forward.

MTraveller avatar May 03 '24 14:05 MTraveller

@MTraveller @kvARCalsovonal07 @Sadasak The fix (1.7.2) is now available on the App Store. It should work right away without needing to use the command in the terminal.

bummoblizard avatar May 04 '24 06:05 bummoblizard

@MTraveller @kvARCalsovonal07 @Sadasak The fix (1.7.2) is now available on the App Store. It should work right away without needing to use the command in the terminal.

Alright, did some testing and it works but not as expected.

If I press the play button in top right corner with the:

-test --Main.java --Test.java

it wont work as is. But if I compile first with javac and then run with java test.Main, it works, being inside the package in terminal.

The other method that seems to work as well is importing the Test.java class, as:

import test.Test;

Works with the top right play button.

Another thing I noticed, the && does not work when entered manually into the terminal.

MTraveller avatar May 04 '24 08:05 MTraveller

@MTraveller , @bummoblizard

The key is to make sure that you are inside the directory at the terminal

For example, if the main class you are trying to run by the run button is in documents/project1/package1/ the terminal should look like this

package1 $ 

And if you are in documents/ it won't work

documents $ 

.

Sadasak avatar May 04 '24 16:05 Sadasak

@MTraveller , @bummoblizard

The key is to make sure that you are inside the directory at the terminal

For example, if the main class you are trying to run by the run button is in documents/project1/package1/ the terminal should look like this

package1 $ 

And if you are in documents/ it won't work

documents $ 

.

True for import test.Test;

But not for package test;

I'll get a class error both with the button and running java test.Main or java Main.

Also for package test; being in parent folder of test works and not inside test.

If you are able to provide a sample would be great.

I have:

-javaplayground --textbox ---Main.java // Main. package textbox;

public class Main { public static void main(String[] args) { TextBox textBox1 = new TextBox(); textBox1.setText("Box 1");

    System.out.println(textBox1.text);
}

}

---TextBox.java // TextBox.

package textbox;

public class TextBox { public String text = "";

public void setText(String text) {
  this.text = text;
}

public void clear() {
  text = "";
}

}

In terminal I am in javaplayground $ java textbox.Main which works otherwise nothing works, just errors.

MTraveller avatar May 04 '24 17:05 MTraveller

@MTraveller

I think you have to be at textBox $ Try that if it doesn't work then screenshot the errors

Sadasak avatar May 06 '24 05:05 Sadasak

Play button inside textbox:

IMG_0157

java textbox.Main in parent folder:

IMG_0158

MTraveller avatar May 06 '24 05:05 MTraveller

@MTraveller I really don't know what's going wrong

It's running good with me

Sadasak avatar May 06 '24 06:05 Sadasak

Found the issue. package textbox; is doing the mess up.

MTraveller avatar May 06 '24 06:05 MTraveller