Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MTraveller opened this issue May 3, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@MTraveller
Copy link

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

Originally posted by @bummoblizard in #1028 (comment)

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

@bummoblizard
Copy link
Member

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

@bummoblizard
Copy link
Member

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

@bummoblizard bummoblizard added the bug Something isn't working label May 3, 2024
@MTraveller
Copy link
Author

Thanks looking forward.

@bummoblizard
Copy link
Member

bummoblizard commented May 4, 2024

@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.

@MTraveller
Copy link
Author

@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.

@Sadasak
Copy link

Sadasak commented May 4, 2024

@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 $ 

.

@MTraveller
Copy link
Author

@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.

@Sadasak
Copy link

Sadasak commented May 6, 2024

@MTraveller

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

@MTraveller
Copy link
Author

MTraveller commented May 6, 2024

Play button inside textbox:

IMG_0157

java textbox.Main in parent folder:

IMG_0158

@Sadasak
Copy link

Sadasak commented May 6, 2024

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

It's running good with me

@MTraveller
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants